1

Configure Product :

Base Price :Rs.1000

Size : Small - 1500 Size : Medium - 2000

instead of increment with base price, want to replace this to main price

checked few solution but nothing is working with Magento version 1.9

Thankyou

ranjit
  • 21
  • 4
  • Related Question: http://stackoverflow.com/questions/6225093/replace-price-difference-with-actual-price-in-magento-configurable-product-optio?rq=1 – Mukesh Chapagain Nov 11 '15 at 15:13

1 Answers1

1

This is performed by javascript. You need to modify the method getOptionLabel in js/varien/configurable.js

The first few lines of the method look like this:

getOptionLabel: function(option, price){
    var price = parseFloat(price);

You need to change it to:

getOptionLabel: function(option, price){
    var basePrice = parseFloat(this.config.basePrice);
    // 'price' as passed is the RELATIVE DIFFERENCE. We won't use it.
    //  The ABSOLUTE DIFFERENCE is in option.price (and option.oldPrice)
    var absoluteDifference = parseFloat(option.price);
    var absoluteFinalPrice = basePrice + absoluteDifference;
    // var price = parseFloat(price);
    var price = absoluteFinalPrice;

To remove + and - symbols in the options, find call to this.formatPrice function and change the second paramter to false in each call.

Just like this:

if(price){
        if (this.taxConfig.showBothPrices) {
            str+= ' ' + this.formatPrice(excl, false) + ' (' + this.formatPrice(price, false) + ' ' + this.taxConfig.inclTaxTitle + ')';
        } else {
            str+= ' ' + this.formatPrice(price, false);
        }

Remember, if you make changes in core magento files, then next time you upgrade Magento you will probably lose your changes. Better to create another file like js/varien/custom_configurable.js or whatever name you like, and call it in the config file (product.xml) for whatever theme you are using.

That's all.

Note: This method is not tested on Magento version >1.7

Mohit Kumar Arora
  • 2,204
  • 2
  • 21
  • 29