VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: nrobert on September 23, 2013, 08:53:45 AM

Title: Function sortSearchListQuery (Product Model): invariable behavior
Post by: nrobert on September 23, 2013, 08:53:45 AM
I have started topic here (http://forum.virtuemart.net/index.php?topic=118967.0) with  false alarm. Problem is invariable behavior of function sortSearchListQuery (Product Model) when $virtuemart_category_id != FALSE and $group != FALSE. Seems that bug was found here:

case 'recent';
$rSession = JFactory::getSession();
$rIds = $rSession->get('vmlastvisitedproductids', array(), 'vm'); // get recent viewed from browser session
return $rIds;

In this case, function simply finishes, ignoring $virtuemart_category_id existence.
My suggestion:

case 'recent';
$rSession = JFactory::getSession();
$rIds = $rSession->get('vmlastvisitedproductids', array(), 'vm'); // get recent viewed from browser session
// return $rIds;
$where[] = 'p.`virtuemart_product_id` IN ('.implode(',',$rIds).')';