Hi everybody,
I'm working on a Virtuemart site and try to make some changes in prices.php sublayouts.
The page to see where I work is :
http://biosource2020.xlcrea373030.com/produits/etancheite/adhesifs-colles-primaires/prodtestxavier-1-detail.htmlTake the child product to see the prices.
At the end of the prices.php (just before the closing div) i have added this code :
<?php
$discount_percent = round(($product->prices['discountAmount'] / $product->prices['basePriceVariant']) * 100);
$prixbase = $product->prices['unitPrice'] - ($product->prices['unitPrice'] * $discount_percent)/100
?>
<?php if (round($product->prices['discountAmount'] != 0 )) { ?>
<span style="text-decoration: line-through;">
<?php echo '<span style="font-size:16px;font-family: robotomedium;;">' . number_format($prixbase, 2) . '</span> €'; ?>
<?php if ($product->product_unit <> '') { ?>
<?php echo ' / ' . $product->product_unit; ?>
<?php } ?>
</span>
<?php echo ' <span style="font-size:16px;font-family: robotomedium;color:#85C14C">' . $discount_percent .'%</span>'; ?>
<?php echo ' soit '; ?>
<?php echo '<span style="font-size:16px;font-family: robotomedium;">' . $product->prices['unitPrice'] . '</span> €'; ?>
<?php if ($product->product_unit <> '') { ?>
<?php echo ' / ' . $product->product_unit; ?>
<?php } ?>
<?php } else { ?>
<?php echo '<span style="font-size:16px;font-family: robotomedium;">' . number_format($product->prices['unitPrice'], 2) . '</span> €'; ?>
<?php if ($product->product_unit <> '') { ?>
<?php echo ' / ' . $product->product_unit; ?><br/>
<?php } ?>
<?php } ?>
</div>
<?php // } ?>
This is used if you check the page to show the price calculated as m² (i give a price for the pack, in this example 3,4 square meters and the price unit is used calculate with the product unit the price in m²).
All is working here except this : as soon I add my code, the total price is not updated in the product details page on quantity change. If I remove my code, the total is correctly updated.
Then, I have something which is not correctly targeted in the div, but I dont know how to solve this..
If somebody is able to help me on this, this could be great

Thanks a lot,
Xavier
EDIT : last version of Virtuemart (3.8.x) and last version of Joomla (3.x)

EDIT2 : I also tried to call the prices directly in product_details to see if this could a solution (call the "formatted" block separated from the total price TT called in the prices.php), but the price are not raised if I use my code outside of prices.php... If it is possible to call the prices fields directly in product_details, it could help me too...