VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: reivaj01 on May 18, 2013, 12:42:41 PM

Title: sort products order by product_special
Post by: reivaj01 on May 18, 2013, 12:42:41 PM
What is the reason because if the user select order the products by product_special the list only show featureed products?

I searched in the forum and doc, but I don't found nothing.

In the administrator/components/com_virtuemart/models/product.php file the code is :

...
switch ($this->filter_order) {
                                case 'product_special':
                                        if($isSite){
                                                $where[] = ' p.`product_special`="1" '; // TODO Change  to  a  individual button
                                                $orderBy = 'ORDER BY RAND()';
                                        } else {
                                                $orderBy = 'ORDER BY `product_special`';
                                        }

break;
...


I think (seeing the comment in the code) that in the future is scheduled to make a check box "show only featured products", but now the behaviour is unexpected for the user.

I think that is better the code:

...
switch ($this->filter_order) {
case 'product_special':
$orderBy = 'ORDER BY `product_special` ';
$this->filter_order_Dir = 'DESC';

break;
...


And, in the future, when there exist the new check box make the new code properly.

Thanks