orderBy value in related table

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 14, 2011   (RSS)

Re: [rjbathgate] orderBy value in related table

By Jason - November 14, 2011

Hi,

Yes, you can do this by using the leftJoin option in getRecords. For example:

list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'allowSearch' => false,
'leftJoin' => array('categories' => 'category'),
'orderBy' => 'categories.featured DESC',

));


This returns the records in "products" sorted so that the products with a category where the featured checkbox is checked appear first.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/