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');

The node title is a property, not a field:

  ->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'product')
  ->fieldCondition('field_line', 'tid', $selected)
  ->propertyOrderBy('title', 'DESC');
  • 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
    Jul 21 '15 at 19:53
                $queryst = new EntityFieldQuery();
                $queryst->propertyCondition('status', 1);   
                $queryst->fieldOrderBy('field_sort_order', 'value', 'ASC');
                $result_st = $queryst->execute();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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