1

Would appreciate some advice.

I created the configurable product in the image but it won't allow you to leave the price for the configurable part blank and to just choose the prices for each of the simple products. Is there a way round this please? When the page loads I would like a default item with it's price to be displayed. In the dropdown list I need to have the price for each next to the option and for that price to be displayed when chosen.

I don't understand the way magento works in this respect. It doesn't seem intuitive to me to have an abstract base price whether that be zero as in my example then for the options to be + or - that. Each of my products is not related in price at all but it seemed the obvious choice to make them configurable as they share the same specifiations except width.

Many thanks for any help.

enter image description here

  • you need the select the default option in product view page right? – saravanavelu Jul 16 '15 at 17:13
  • 1
    No one knows why Varien made configurables work this way. – benmarks Jul 16 '15 at 17:31
  • I selected a default option when i was setting up the attribute for the product but 'choose an option' is highlighted instead of the default product. – PeterC Jul 16 '15 at 18:14
  • Check the answer – saravanavelu Jul 17 '15 at 11:37
0

To choose the default configurable options in product view page, try the below script in app\design\frontend\package\theme\template\catalog\product\view\type\options\configurable.phtml it works,

<script type="text/javascript">

 function fireEvent(element,event)
{
    if (document.createEventObject)
    {
        // dispatch for IE
        var evt = document.createEventObject();
        return element.fireEvent('on'+event,evt);
    }
    else
    {
        // dispatch for firefox + others
        var evt = document.createEvent("HTMLEvents");
        evt.initEvent(event, true, true );
        return !element.dispatchEvent(evt);
    }
}

function setDefaultConfigOptions()
{

    if (spConfigIndex >= spConfig.settings.length)
    {
        return; // stop
    }

    spConfig.settings[spConfigIndex].selectedIndex = 1;
    var obj = spConfig.settings[spConfigIndex];
    ++spConfigIndex;

    Event.observe(obj,'change',function(){});
    fireEvent(obj,'change');

    window.setTimeout("setDefaultConfigOptions()", 1); // Add a small delay before moving onto the next option
}

var spConfigIndex = 0;
Event.observe(window, 'load', function() {
    setDefaultConfigOptions();
});
</script>
  • Thank You so much saravanavelu, it works great, I really appreciate your time. – PeterC Jul 17 '15 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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