0

Lets say i have a configurable product. The base price is null. Then when you select a variant from the dropdown menu, the price changes dynamicly in frontend. So. How do i hide the price if the price is $0.00? I have tried

if($this->getPriceHtml($_product) == 0:
//Do nothing
else:
echo $this->getPriceHtml($_product);
endif;

But this just hide all the price. So if the user changes the price from non variant to some variant, the price does not show at all.

Any ideas how to solve this? :)

2 Answers 2

2

The problem you have is, that the whole price handling is made in JS for configurable products. So you need to change the JS to solve this issue.

this method is yours:

/js/varien/configurable.js:271
reloadPrice: function(){
    if (this.config.disablePriceReload) {
        return;
    }
    var price    = 0;
    var oldPrice = 0;
    for(var i=this.settings.length-1;i>=0;i--){
        var selected = this.settings[i].options[this.settings[i].selectedIndex];
        if(selected.config){
            price    += parseFloat(selected.config.price);
            oldPrice += parseFloat(selected.config.oldPrice);
        }
    }

    optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice});
    optionsPrice.reload();

    return price;

    if($('product-price-'+this.config.productId)){
        $('product-price-'+this.config.productId).innerHTML = price;
    }
    this.reloadOldPrice();
},

To overwrite this method do something like this:

var ExtendedConfigurable = Class.create();
// inherit from Config class:
ExtendedConfigurable.prototype = Object.extend(new Product.Config(), {

  reloadPrice: function(message) {
      // do whatever
  }
});

Product.Config = ExtendedConfigurable;
-1

Hi you can try Call For PRice extension. It can replace price with custom text for several products. Also you can select Customer group which you want to show price or hide. http://www.magentocommerce.com/magento-connect/call-for-price-hide-price-3163.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.