Active
Project:
Commerce Quick add to cart
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Jul 2015 at 10:59 UTC
Updated:
18 Jul 2015 at 18:58 UTC
Jump to comment: Most recent
Comments
Comment #1
spacetaxi commentedI'm following up on my own question, hopefully for the help of others.
First, Commerce Examples provides an add to cart form that by default searches both sku and product/name title. I ended up using it as the basis of my own custom module.
Second, in answering my main question, Drupal 7 provides the EntityFieldQuery API which is a pretty straight forward way of getting a list of entities, but would require doing another database query to get field values. There is a useful module, EntityFIeldQuery Extra Fields which will allow you to load these fields with the same query, which I ended up using.
Third, in terms of handing additional product line item fields with the add to cart, you can access these through the line item object, which is similar to accessing fields in a node (or other entity). This is best explained by showing an add to cart example:
Many thanks to the module author for posting this module.