Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By ETENTION on
Hi
I've been fiddling around with EFQ to get Commerce related data.
I've got following code which produces result '11' but I've got no idea what it represents:
$reserved = new EntityFieldQuery();
$reserved
->entityCondition('entity_type', 'commerce_line_item', '=')
->count();
It should count the number of line items? Included in orders and "active" carts?
Shop has only one order(cart) with 3 products so I can't tell what is this 11.
If I modify it as follows it returns 7:
$reserved = new EntityFieldQuery();
$reserved
->entityCondition('entity_type', 'commerce_line_item', '=')
->fieldCondition('commerce_product','product_id','2','=')
->count();
And how could I check which fields and properties are available for line item?
I know how I've customized them and
Comments
It may be that the record
It may be that the record count is affected by table joins. For example, if you have 5 line items and 3 products referenced from those line items, you could see 15 records in the results (5 x 3 records in the join).