Hi all my friends.
I need to solve one problem. How to sort a product without price last? The customer has a sorting of products from the cheapest. I understand that VM will first display products without a specified price (because the price is 0). But can I set an exception so that products without a price are always the last? These are usually very expensive and complex products, where the price cannot be set in advance and must be calculated additionally according to the complex configuration of the product.
Thx
I don't know if such option exists. I had to resort to using a core hack in administrator/components/com_virtuemart/models/product.php.
Changed this:
case 'product_price':
$orderBy = ' ORDER BY `product_price` '.$filterOrderDir.', p.`virtuemart_product_id` '.$filterOrderDir;
to:
case 'product_price':
$orderBy = ' ORDER BY `product_price` IS NULL ASC, `product_price` '.$filterOrderDir.', p.`virtuemart_product_id` '.$filterOrderDir;
Hi. Two days its work fine. Now dont work :( File is without changes. Maybe any in administration VM?
On czech website not workong: https://vybaveniprovozu.cz/reznicke-vybaveni/udirny
On slovak website are good: https://vybavenieprevadzky.sk/maesiarske-vybavenie/udiarne
It's a very interesting bug. When I reopened the goods without the price and then saved them, it started to sort correctly at the bottom of the page.
Martine,
problem is not: How to sort a product without price last?
but why developer created eshop, where is showing product without price on FE?
Do you see this option on alza.cz?
Quote from: Ghost on June 29, 2020, 10:14:49 AM
I don't know if such option exists. I had to resort to using a core hack in administrator/components/com_virtuemart/models/product.php.
Changed this:
case 'product_price':
$orderBy = ' ORDER BY `product_price` '.$filterOrderDir.', p.`virtuemart_product_id` '.$filterOrderDir;
to:
case 'product_price':
$orderBy = ' ORDER BY `product_price` IS NULL ASC, `product_price` '.$filterOrderDir.', p.`virtuemart_product_id` '.$filterOrderDir;
Price isnt NULL but 0.
work this:
$orderBy = ' ORDER BY coalesce(`product_price`, 0) = 0 ASC, `product_price` '.$filterOrderDir.', p.`virtuemart_product_id` '.$filterOrderDir;
Payment gate Gopay not function with product's price == 0.