News:

Support the VirtueMart project and become a member

Main Menu

Adding product thumbnail, name and price to addtocartbar.php

Started by dslove, April 15, 2016, 13:24:22 PM

Previous topic - Next topic

dslove

Customizing the addtocartbar.php file so the product thumbnail, name and price display next to the Quantity box, I have run into an issue concerning the price display.

<?php echo $product->prices['salesPrice']; ?>

I wish to display only the final sales price, but the above code 1) returns only an integer if the number is round 2) displays a dot(.) instead of a comma(,) as a decimal separator and 3) does not display currency symbol.

I have already tried calling the prices sublayout but the page breaks since calling a sublayout from a sublayout seems to do just that.

Any advice?

Ghost

You can include a sublayout inside a sublayout. Maybe forgot to set currency or product data? This should work:

$currency = CurrencyDisplay::getInstance();
echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$product,'currency'=>$currency));


Or you can add just the price div:

$currency = CurrencyDisplay::getInstance();
echo $currency->createPriceDiv('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);

dslove