Support the VirtueMart project and become a member

Main Menu

Virtuemart 4 removed salesPriceWithDiscount

Started by EIF, October 31, 2023, 10:11:23 AM

Previous topic - Next topic


At the moment I am working on a migration from virtuemart 3 to 4, where I have an styling issue on the sales price with discount on the category page.

In VM3 there I changed the productview. When there is a sales prices (with discount) then the discounted price has a different styling. I used this code:

<div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
if ($this->show_prices == '1') {
if ($product->prices['salesPrice']<=and VmConfig::get ('askprice'1) and  !$product->images[0]->file_is_downloadable) {
if( $product->prices['discountAmount'] ):
echo '<div class="hasDiscount">';
echo '<div class="cat-crossed-price">';
echo $this->currency->createPriceDiv('basePriceWithTax'''$product->prices);
echo '</div>';
echo $this->currency->createPriceDiv('salesPrice',''$product->prices);
echo '<div class="clear"></div>';
echo '</div>';
echo $this->currency->createPriceDiv('basePriceWithTax'''$product->prices);


I like to do the same in VM4 but it seems to be that the product output on the category page is handled differently now. It looks like the product output, with prices is done by currencydisplay.php?

Below there are 2 screenshots, one from VM3 and one from VM as it is now.

Does someone know how I can achieve the sales prices (with discount) in red and crossed old price? The problem is that the salesprices is always the sales price. Discounted or not, it has the same class, so I can no longer distinguish it anymore.