Wednesday, January 21, 2015

Magento - Change the text “Choose an option…” on product page



Open PHTML
app/design/frontend/your_package/your_theme/template/catalog/product/view/type/options/configurable.phtml

and put below java script code


<script type="text/javascript">
      
        function changeFristText(){
            <?php foreach($_attributes as $_attribute): ?>
                <?php
                    $_attributeId = $_attribute->getAttributeId();
                    $_attributeInfo = Mage::getModel('eav/entity_attribute')->load($_attributeId);
                    $_attributeLabel = str_replace(' ','-',strtolower($_attributeInfo->getFrontendLabel()));
                    $_attributeLabel = $_attributeInfo->getFrontendLabel();
                ?>
                var label = '<?php echo $_attributeLabel;?>';
                var attid = '<?php echo $_attributeId;?>';
                $$('#attribute'+attid).each(function(elem){
                    var options = elem.childElements();
                    options[0].update(label);
                });
            <?php endforeach;?>
        }
     window.onload = changeFristText;
    </script>

No comments :

Post a Comment