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

Multiple pricing and missing price in category

Started by rayge, October 10, 2014, 21:51:43 PM

Previous topic - Next topic

rayge

Here is the problem:
when using multiple pricing with quantities only the first price appears in the category page.
That is not the problem in itself.

the problem is it ONLY appears if there is a pricing record with a starting quantity of 0.
I need it to show the LOWEST starting quantity rather than a fixed 0.

how might i do this?

**UPDATE** I have found the file related to my issue
/public_html/administrator/components/com_virtuemart/models/product.php
public function loadProductPrices

The code related to QUANTITY needs re-thought out.
I am open to any Ideas.
I Use: Joomla 3.4.1 & VM 3.0.9

rayge

#1
HERE is the solution.
in the file /administrator/components/com_virtuemart/models/product.php
change line 827 from
$q = 'SELECT * FROM `#__virtuemart_product_prices` WHERE `virtuemart_product_id` = "'.$productId.'" ';
TO
if($front){
$q = 'SELECT *, MIN(price_quantity_start) FROM `#__virtuemart_product_prices` WHERE `virtuemart_product_id` = "'.$productId.'" ';
} else {
$q = 'SELECT * FROM `#__virtuemart_product_prices` WHERE `virtuemart_product_id` = "'.$productId.'" ';
}


and comment out lines 841-844 like this
// $quantity = (int)$quantity;
// if(!empty($quantity)){
// $q .= ' AND( (`price_quantity_start` IS NULL OR `price_quantity_start`="0" OR `price_quantity_start` <= '.$quantity.') AND (`price_quantity_end` IS NULL OR `price_quantity_end`="0" OR `price_quantity_end` >= '.$quantity.') )';
// }


this solves the issue and there is no need for the extra code as this is expected to only get 1 resulting record.
MIN() is an aggregate function which return one record for every group hence why you get the right result.

Can someone see if we can get this into future update of VM? I would hate to loose this fix with an update.
I Use: Joomla 3.4.1 & VM 3.0.9

Milbo

As said in the other post. Please test if this is solved for vm3, thank you.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/