VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: Picklehead on June 05, 2024, 15:25:14 PM

Title: Unit Base Price without Discount.
Post by: Picklehead on June 05, 2024, 15:25:14 PM
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
Title: Re: Unit Base Price without Discount.
Post by: Picklehead on June 07, 2024, 02:15:37 AM
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]);