Dear All,
pls find here our solution for this problem for
www.quality-tuning.com. It calculates and updates the price of all parent products' price in the database using the minimum price of all children. You can do this in the administration - we have added a new button for this (see attached). This hack adds also the text "From:" near the price of all parent products in browse and product_details pages. We believe a similar solution or same should be included in the standard VM version.
1. New files (See attached)
administrator\components\com_virtuemart\html\product.product_minprice.php
administrator\components\com_virtuemart\class\ps_calminprice.php
components\com_virtuemart\themes\YOUR_TEMPLATE\templates\common\minprice.tpl.php
2. Changed files
2.1 administrator\components\com_virtuemart\ header.php
After line 317: Add:
<hr />
<li class="item-smenu vmicon vmicon-16-editadd">
<a href="<?php $sess->purl($_SERVER['PHP_SELF']."?pshop_mode=admin&page=product.product_minprice") ?>"><?php echo 'Calculate Min Price' ?></a>
</li>
2.2 administrator\components\com_virtuemart\ html\shop.browse.php
After line 31: Add:
require_once(CLASSPATH . 'ps_calminprice.php' );
$ps_calminprice = new ps_calminprice();
After line 443: Add:
$minpriceid = $ps_calminprice->getminprice($db_browse->f("product_id"));
if($minpriceid!=''){
$product_price = $ps_calminprice->show_price($minpriceid);
}
2.3 administrator\components\com_virtuemart\ html\ shop.product_details.php
After line 418: Add:
require_once(CLASSPATH . 'ps_calminprice.php' );
$ps_calminprice = new ps_calminprice();
$minpriceid = $ps_calminprice->getminprice($product_id);
if($minpriceid!=''){
$product_price = $ps_calminprice->show_price($minpriceid);
}
Regards,
Chris