JModelList::getListQuery - How to expand limit.
I'm using the following code in my Component Model to retrieve my database array
protected function getListQuery()
{
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('product_id,product_sku,product_s_desc,product_thumb_image');
// From the virtuemart product table
$query->from('#__vm_product');
$query->where('product_in_stock >0','product_publish =1');
$query->limit('0,40');
return $query;
}
the problem with this is that it's only return me 20 results at a time. And I need this to be unlimited. The solution for this I found in this post JModelList::getListQuery limits to 20 only
What you need to do is add this code above the function getListQuery
protected function populateState()
{
$this->setState('list.limit', 0);
}
and it'll work like magic :)
No comments:
Post a Comment