I've modified currencydisplay.php in order to add a crossed price by using the following code -
// Checks if there is a discount.
if ($name == "discountAmount" && $vis == "none") {
// If discount is empty (discountAmount) (display: none) it gives you an empty string instead of <div>
return "";
}
// If you have an discount and want to show the Price with Tax
if ($name == "basePriceWithTax") {
// Checks if there is a discount.
if(!empty($product_price['discountAmount'])) {
// Discount exist: Show Price with Tax and with an extended CSS class
$css = "crossed";
return '<div class="Price'.$name.'" style="display : '.$vis.';" ><span class="vm-price-desc">'.$descr.'</span><span class="Price'.$name.' '.$css.'" >'.$this->getFormattedCurrency($product_price['basePrice'],$nb).'</span></div>';
}
}
When I change product's quantity that price disappears, I guess the solution is simple and I'm missing it.
VirtueMart 3.0.12
the code is incomplete.. where r u getting $name and $vis from?
Check what they are after a q change
They are all declared at the same PHP file (currencydisplay.php) -
$vis = " vm-display vm-price-value";
if($sprgrp){
if($sprgrp->custom_price_display){
if($sprgrp->show_prices){
foreach($priceFieldsRoots as $name){ ...
You should not hack the code for that, do it by CSS itself.
Like how, Milbo? I've took this solution from numerous threads here who addressed the same hack.
there are many ways to this
obviously the simpler the better and in the template over rides
e.g. something like below in the prices.php sublayout
echo $currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
if ($product->prices['discountAmount'] != -0) {
echo $currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);
}
echo $currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices);
with css
.PricebasePrice.vm-display.vm-price-value .PricebasePrice {
color: #bf112b;
text-decoration: line-through;
}
gives http://www.baby-natur.ch/bekleidung/basics/bodys/be-lake-bodensee-body-bodenseeraeuber-tuerkis-detail