Author Topic: sort products order by product_special  (Read 717 times)

reivaj01

  • Beginner
  • *
  • Posts: 13
sort products order by product_special
« 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 :
Code: [Select]
...
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:
Code: [Select]
...
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