I have read past articles but they dont seem to work in virtuemart 3, how to change the display from amount to percentages in product display? thank you
http://forum.virtuemart.net/index.php?topic=126620.0
http://forum.virtuemart.net/index.php?topic=106402.0
My method works and is tested
http://forum.virtuemart.net/index.php?topic=126620.0 (http://forum.virtuemart.net/index.php?topic=126620.0)
reply #3
I see your code but where do you put it? which file and where? thank you
http://forum.virtuemart.net/index.php?topic=79799.0 (http://forum.virtuemart.net/index.php?topic=79799.0)
you put the wrong link ,I have already said in my first post version 3 8) .can any one else help please?with solution that works in vm 3
::)
Prices are now controlled by a sublayout
Put the change in the override
templates/YOURTEMPLATE/html/com_virtuemart/sublayouts/prices.php (http://templates/YOURTEMPLATE/html/com_virtuemart/sublayouts/prices.php)
The solution works for VM3
Warning: Division by zero in url/public_html/components/com_virtuemart/sublayouts/prices.php on line 52
this is line 52
$discount_percent = round(($product->prices['basePriceWithTax'] - $product->prices['salesPrice']) * 100 /
this is the warning why is that?
No idea
Try debugging in a development environment and see what is happening with the variables.
Or maybe someone else might have time to do the work for you.
I had to use $product->prices['basePrice'] and not $product->prices['basePriceWithTax'].
god I miss woocommerce ;D
use basePriceVariant!
BasepriceVariant does not give the correct calculation if used in:-
$discount_percent = round(($product->prices['basePriceWithTax'] - $product->prices['salesPrice']) * 100 / $product->prices['basePriceWithTax']);
However, this is probably a much better way of achieving the %age using the suggested basePriceVariant !
$discount_percent = round(($product->prices['discountAmount'] / $product->prices['basePriceVariant']) * 100);