0

I am having trouble removing the price increase from configurable swatches. As you can see in the image it says +$10.00 - this bit is what i am trying to remove. The price should still change but the area in red should not be shown.

Example of price increase

The indigo colored area is: <dt class="swatch-attr">

The red colored ares is: <span id="select_label_wd_sssg">

The swatch buttons are wrapped in: <span class="swatch-label">

I have unsuccessfully tried to remove this using this bit of code //

    jQuery("swatch-label").click(function(){
        checkswatches();
    });
});

function checkswatches(){
  jQuery("#select_label_wd_sssg").select(function(){
    var optiontext = jQuery(this).text();
    var addsignpos = optiontext.indexOf('+');
    var subtractsignpos = optiontext.indexOf('-');
    if(addsignpos>0){
        var result = optiontext.substring(0,addsignpos-1);
        jQuery(this).html(result);
    }

    if(subtractsignpos>0){
        var result = optiontext.substring(0,subtractsignpos-1);
        jQuery(this).html(result);
    }
  });
}
// ]]>

Can't get code to format correctly

I have put the code above inside of

app/design/frontend/[package]/[theme]/template/catalog/product/view/type/options/configurable.phtml

and app/design/frontend/[package]/[theme]/template/configurableswatches/catalog/product/view/type/options/configurable/swatches.phtml with no luck.

Any advice is appreciated.

2
  • Are you saying you want to have parent product price for all config child products? In another word, price shouldn't change no matter what customer chooses from config option. Feb 8, 2016 at 4:36
  • No the price should change. It should not however show the price increase/decrease from the parent (default) product. In the example above the +$10.00 should not show. The code shows this action.
    – beepboop
    Feb 8, 2016 at 4:49

2 Answers 2

1

In skin/frontend/rwd/default/js/configurableswatches/swatches-product.js find this:

/**
     * Return text that should be displayed in attribute label for a certain option
     *
     * @param {object} option
     * return {string}
     */
    getOptionLabel: function(option) {
        return this.productConfig.getOptionLabel(option, option.price);
    },

and change it to this:

/**
     * Return text that should be displayed in attribute label for a certain option
     *
     * @param {object} option
     * return {string}
     */
    getOptionLabel: function(option) {
        return this.productConfig.getOptionLabel(option);
    },
5
  • I'm using CE 1.9.3.x and this didn't work for me. Still seeing the price adjustment after cache flush and reindex. Applied to RWD & my theme
    – Steven J
    Jul 17, 2017 at 23:26
  • It's weird cause I just did it yesterday on a 1.9.3.3 community edition and it worked both on local and prod Jul 18, 2017 at 8:55
  • I checked my files and caching but still don't see the desired change. I updated the file in RWD and copied it to my theme as well. Is there anywhere else that I should check?
    – Steven J
    Jul 18, 2017 at 15:50
  • 1
    Maybe it depends on your theme? Try and switch to rwd and see if the fix works there so you can rule out any theme related issues Jul 19, 2017 at 7:24
  • Coming back to this - the .js file was being loaded from a different area in my theme. Once I found this, the change worked. Use your "view source" and search for the .js file being used - it may be different than the path given in this answer, but the modification definitely works.
    – Steven J
    Aug 14, 2017 at 23:07
0

Try to add:

Event.observe(window, 'load', function() {
    Product.ConfigurableSwatches.prototype.getOptionLabel = function(option){
       return option.label;
    };
});

Into any script to overwrite default swatches-product.js behaviour

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.