VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: serapol on April 05, 2012, 17:43:15 PM

Title: BUG in the sorting of products. A large load on the server.
Post by: serapol on April 05, 2012, 17:43:15 PM
Error in vmModel Product with list of products for the module in the "Latest". There is a big load on MSQL server and incorrectly showing the last products

you must add the file product.php  $orderBy = 'ORDER BY p.`virtuemart_product_id'; in case 'latest':

if($group){

$groupBy = 'group by p.`virtuemart_product_id`';
switch ($group) {
case 'featured':
$where[] = 'p.`product_special`="1" ';
$orderBy = 'ORDER BY RAND()';
break;
case 'latest':
$date = JFactory::getDate( time()-(60*60*24*7) );
$dateSql = $date->toMySQL();
$where[] = 'p.`modified_on` > "'.$dateSql.'" ';
$this->filter_order_Dir = 'DESC';
$orderBy = ' ORDER BY p.`virtuemart_product_id`'; // <<<--------------------  ADD THIS CODE
break;
case 'random':
$orderBy = ' ORDER BY RAND() ';
break;
case 'topten';
$orderBy = ' ORDER BY product_sales ';
$this->filter_order_Dir = 'DESC';
}
$joinPrice = true ;
$this->searchplugin = false ;
}
}
Title: Re: BUG in the sorting of products. A large load on the server.
Post by: Milbo on April 05, 2012, 20:59:28 PM
or orderBy p modified on, or?
Title: Re: BUG in the sorting of products. A large load on the server.
Post by: serapol on April 06, 2012, 13:32:42 PM
there is a selection a WHERE
Title: Re: BUG in the sorting of products. A large load on the server.
Post by: Milbo on April 06, 2012, 15:32:00 PM
? anyway checkout the svn.