This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Add following lines on view.phtml. Done for the case of Color and Size. | |
This will not work for all but get the idea! | |
*/ | |
<?php | |
// Making the first selection of the color selected when only one | |
if ($_product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE):?> | |
<script> | |
document.observe("dom:loaded", function() { | |
var options = $$('#attribute272 option'); //#first attribute ID | |
var len = options.length; | |
if (len == 2) { | |
$('attribute272').options[1].selected = true; | |
spConfig.fillSelect($('attribute525')); //Second attribute ID | |
$('attribute525').disabled = false; | |
} | |
}); | |
</script> | |
<?php endif;?> |