News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Modified price disappears on quantity change

Started by OriyanJ, February 07, 2016, 09:11:14 AM

Previous topic - Next topic

OriyanJ

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
VirtueMart 3.2.2

GJC Web Design

the code is incomplete.. where r u getting $name and $vis from?

Check what they are after a q change
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

OriyanJ

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){ ...


VirtueMart 3.2.2

Milbo

You should not hack the code for that, do it by CSS itself.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

OriyanJ

Like how, Milbo? I've took this solution from numerous threads here who addressed the same hack.
VirtueMart 3.2.2

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation