anoter time i need some help with oxid. I would like to show to the user the original price of a reduced product with an discount. The original code just show the reduced price of this product. I know that it is possible to achieve that by provide the UVP of a product, but in my case I need to work with discounts. Is there a way to manage this in a template or do I have to write a extension class?
do you know a way to get the original price, then i can compare it and adjust the template.
If i call the getPrice function of oxartilce I only get the reduced price
[QUOTE=Vermond;48154]I think a red it already, they suggested to use the UVP value, this is already implemented. but i have to use the discount function[/QUOTE]
I was looking for the same solution and came up with this:
/**
* Returns T price (aka UVP) if exists else returns price without discounts
*
* @return oxPrice
*/
public function getTPrice()
{
$oTPrice = parent::getTPrice();
if (!$oTPrice->getBruttoPrice()) {
$oTPrice->setPrice($this->oxarticles__oxprice->value);
}
return $oTPrice;
}
wrapped in a modul that extends the oxarticle class and you can use:
This way you don’t have to set the tprice on every article instead it returns the orginal price without discounts. Then you can compare the tprice with price and show the discount if needed. This thread gives a good overview where prices are shown in templates