Change product Order in Category view by product_in_stock from ASC to DESC

Started by Mole_LR, September 19, 2012, 03:54:01 AM

Previous topic - Next topic

Mole_LR

Hello!

I have 2 questions:
*)if it possible and how can I change the default ordering in category view for product_in_stock as DESC instead of ASC (it means - fever products (or 0) in stock are showing as lasts, by default they are showing as firsts - "100, 97, 45, 9, 0, 0, 0" instead of "0, 0, 0, 9, 45, 97, 100");
*)if it possible and how can I change the product ordering in category view combined with 3 fields (first need product_in_stock as DESC, then low_stock_notification as DESC and then by Price as ASC (cheapest products first)!

Thank You!

I'm using the last stable VM2 - 2.0.10!

Mole_LR

Hello!

I see that for nobody at this moment there is no need for order by products by 3 columns with combination...? ;-) What about developers comments, suggests?

Now - I have another (a bit different, more concrete) question/problem according to product ordering in combination by 3 columns by different directions (lets say, product_price - ASC, product_in_stock  - ASC and low_stock_notification - DESC). I found that it can be done in file ../administrator/components/com_virtuemart/models/product.php, in line 468 I can modificate it as follows:

$product_ids = $this->exeSortSearchListQuery (2, $select, $joinedTables, $whereString, ' ORDER BY p.`product_in_stock` DESC, p.`low_stock_notification` DESC, `pp`.`product_price` ASC ', $nbrReturnProducts);


but it is not working as I want - there is no errors, but products are filtered as DESC just by product_in_stock, so - ordering by low_stock_notification and product_price are randomly (as it was before)... I tried to use VM table _virtuemart_products (without JOINS, just 1 table, as testing) and tried to use mixed ORDER BY with ASC and DESC - it's not working too...? According to MySQL manuals it should work (the mixing ASC and DESC in ORDER BY clause)..?

Any suggests, ideas?

Maybe developers can think about including into next realizes this feature, as I think that it could be helpfull and normally that I can show products for customers ordering by X columns (instead of just 1, it could also be SKU, name, price, product_in_stock...etc.)? ;-)