Monday 16 May 2016

Magento : Default to the first item for all required options

Stick the code into 

app/design/frontend/default/theme/template/catalog/product/view/options.phtml

near the end of the file look for this line: 


var opConfig = new Product.Options(<?php echo $this->getJsonConfig() ?>);


and replace with this:


var opConfig = new Product.Options(<?php echo $this->getJsonConfig() ?>);Event.observe(window'load', function() {$$('.product-options select').each(function(element{
element
.selectedIndex 1;opConfig.reloadPrice();});});


Refresh cache and load a product on the frontend which has custom options - after the page loads an option should automatically be selected.

No comments:

Post a Comment