magento 1.7 custom options not updating price

3.1k views Asked by At

Hi I have a simple product with custom options and the input type for this perticular product is set to drop-down.

On the product view page, when drop down select option is changed, the price does not change for the product, instead it displays £0.00. it throws an error in the js console

Uncaught ReferenceError: spConfig is not defined 

Once again this is not a configurable product. If I had to add to cart and proceed to check out, the values are added from the custom options.

I understand this is a javascript problem and I am also aware it is under js/varien/product.js

but I dont see where to make changes or what changes to do.

Many thanks

1

There are 1 answers

0
devgroop On

Your two issues are not directly related. We've had the same issues here - and I assume you are using the 'OrganicInternet' module (http://www.magentocommerce.com/magento-connect/simple-configurable-products.html). The uncaught reference error can be resolved by checking for the presence of the object before running the function. (The spConfig object only exists on configurable product pages.)

In /skin/frontent/base/default/js/scp_product_extension.js wrap the last function like so:

if (typeof spConfig != "undefined") {

    //SCP: Forces price labels to be updated on load
    //so that first select shows ranges from the start
    document.observe("dom:loaded", function() {
        //Really only needs to be the first element that has configureElement set on it,
        //rather than all.
        $('product_addtocart_form').getElements().each(function(el) {
            if(el.type == 'select-one') {
                if(el.options && (el.options.length > 1)) {
                    el.options[0].selected = true;
                    spConfig.reloadOptionLabels(el);
                }
            }
        });
    });
};

The actual issue relating to the 0.00 pricing is due to the fact that the module replaces the product option HTML and JS on the product page with elements that won't return a valid response when grabbing the price of options from the pulldowns. So far, we seem to have resolved this by preventing the module from overwriting in this way. I'm not sure if it's a full fix, we're still testing..

In /app/design/frontent/base/default/layout/simpleconfigurableproducts.xml, comment out - or remove the scpwrapper and scpoptions templates:

  <!--<reference name="product.info.options.wrapper">
        <action method="setTemplate"><template>catalog/product/view/options/scpwrapper.phtml</template></action>
    </reference>

    <reference name="product.info.options">
        <action method="setTemplate"><template>catalog/product/view/scpoptions.phtml</template></action>
    </reference>-->

Will endeavour to update this post if we find more info/issues.