News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Change product order in vm->category->default.php

Started by ExSpirit, June 15, 2015, 08:15:18 AM

Previous topic - Next topic

ExSpirit

I would like to change the order of products in category->default.php, just before foreach ( $this->products as $product ). I need o list products first all products which are in one category, then some other and on the end all other products. Also all those products should have "second ordering condition", which is availability date. So items should be listed first if contains category X and those items are sorted by availability date, next are shown items from category Y and those items are sorted by availability date, and on the end all other items are shown and those items are sorted by availability date. How could I do that (arrange the array in correct order)?

lindapowers

I find this quite interesting, sorry I cant help you but yes in many cases the use of 2 conditions is necessary.

We for example would like to order by in stock - out of stock and per sales, something currently not possible.

This guys could help you:

https://forum.virtuemart.net/index.php?action=profile;u=47167
https://forum.virtuemart.net/index.php?action=profile;u=36504

Milbo

The new ordering for product name is already "ordering, product_name". Your case brings up the idea to allow to enter your own SQL value for "ORDER BY"
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ExSpirit

Is PHP sorting is to complicated, maybe it would be easier to modify SQL query? Which file gets all product data in object?