3

I'm getting an error when using this entity field query, the error says that that the field title cannot be found but I'm only querying the basic node table.

$product_query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'product')->fieldCondition('field_line', 'tid', $selected)->fieldOrderBy('title', 'DESC');

2 Answers 2

7

The node title is a property, not a field:

$product_query 
  ->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'product')
  ->fieldCondition('field_line', 'tid', $selected)
  ->propertyOrderBy('title', 'DESC');
1
  • Unless you're using Entity Translation and the Title module. In that case, to get the localized title, you should use: ->fieldOrderBy('title_field', 'value', 'ASC')
    – colan
    Commented Jul 21, 2015 at 19:53
0
                $queryst = new EntityFieldQuery();
                $queryst->entityCondition('entity_type','node');
                $queryst->propertyCondition('status', 1);   
                //$queryst->propertyOrderBy('nid','DESC');
                $queryst->fieldOrderBy('field_sort_order', 'value', 'ASC');
                $queryst->entityCondition('bundle','bill_status'); 
                $result_st = $queryst->execute();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.