News:

Looking for documentation? Take a look on our wiki

Main Menu

Unit Base Price without Discount.

Started by Picklehead, June 05, 2024, 15:25:14 PM

Previous topic - Next topic

Picklehead

HI,
If I discount a product my template is set to show the price without discount crossed out and the discounted price.

Example:  £0.89 Sale price: £0.85


I also display the unit price of the product using the following which shows the products discounted unit price.

$unitPriceDescription = JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', JText::_('COM_VIRTUEMART_UNIT_SYMBOL_'.$this->product->product_unit));
echo $this->currency->createPriceDiv ('unitPrice', $unitPriceDescription, $this->product->prices);

Is there a way can show the a crossed out unit price without discount?

Example:   £72.36 Price / m²:£56.96

Many Thanks

Joomla 4.3.3 - Virtuemart 4.0.20

Picklehead

Found some time today to look into this and found a solution.

made this change in my templates default_showprices.php

$unitPriceSale =  number_format($this->product->prices['salesPrice'] * $this->product->product_box , $this->currency->_priceConfig['salesPrice'][1]);
//$unitPrice = $this->product->prices['basePrice'] * $this->product->product_box;
$unitPrice =  number_format($this->product->prices['basePriceWithTax'] * $this->product->product_box, $this->currency->_priceConfig['basePriceWithTax'][1]);