I have added an identifier in the url when selecting a color using the core swatches magento provides in 1.9.1 for configurable products. Ex. Blue shirt links adds shirt.html?color=blue. I'm wondering if there is a simple way to make the product view page acknowledge the identifier and show the appropriate selected color when loading the product. Thanks for any help.

1 Answer 1


there is already a core way of doing this.
You have to pass the configurable attribute values like this:


So if your color attribute has the id 99 and the option blue has the id 12 it will look something like this


Here is an example on the demo website: http://demo.magentocommerce.com/men/shirts/plaid-cotton-shirt-482.html#92=17&180=78 This will select color charcoal and size large.
If you only specify http://demo.magentocommerce.com/men/shirts/plaid-cotton-shirt-482.html#92=17 it will select the color only.

The color swatches are linked to the dropdown options so they should work too.

  • This seems like a viable option, I'm a little lost how call the attribute id and option id in product-list.js. By default it only products the product color and product id. Jun 15, 2015 at 13:47
  • Mage::getModel('eav/config')->getAttribute('catalog_product', 'color')->getId() will get you the id of the attribute. I'll have to check for option id.
    – Marius
    Jun 15, 2015 at 13:49
  • How is it possible to call that within jquery? Jun 15, 2015 at 16:05

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.