News:

Looking for documentation? Take a look on our wiki

Main Menu

sort products order by product_special

Started by reivaj01, May 18, 2013, 12:42:41 PM

Previous topic - Next topic

reivaj01

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