Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default selected options in magento product detail page

Tags:

magento

I have requirement in which i am getting product ID from external Application with product super_attribute options like color,size. I am getting all those and i can do the add to cart option.

But here my actual requirement is to select the requested options by customer and redirect them to product detail page in magento so that here they can still enter optional text to print. So i need to set the requested options in detail page and redirect them to product detail page instead of adding it to cart. They will enter more details and then they will do addtocart manually.

How can i set the selected options while loading itself.

Please help me.

like image 620
Elamurugan Avatar asked Jul 01 '11 07:07

Elamurugan


1 Answers

Thankfully this is already built in to most themes. You need to know the ID of both attributes and values from the Simple product that is included in the Configurable product. I've only seen it work with Configurable types so that might be a limitation.

  • For each attribute make a key=value pair
  • Combine the attributes as a query string, eg. "123=345&678=890"
  • Append the string as a hash fragment (not as a query).
    This is an example from the official demo, note that the first option needs to be selected for the second to work so it has two key/value pairs.

    http://demo.magentocommerce.com/zolof-the-rock-and-roll-destroyer-lol-cat-t-shirt-126.html#525=99&272=22

like image 99
clockworkgeek Avatar answered May 10 '23 16:05

clockworkgeek