I created a configurable product, it has three option: color, size and style.
Now in product page, each option has the default text "Choose an Option..." in dropdown, but I want the text should be "Select color", "Select size" and "Select style".
I edited function getJsonConfig() in app\code\core\Mage\Catalog\Block\View\Type\Configurable.php
From:
'chooseText' => Mage::helper('catalog')->__('Choose an Option...'),
To:
'chooseText' => ('Select ').$attribute->getLabel(),
And edit line 39 of the file frontend/base/default/template/catalog/product/view/type/options/configurable.phtml
to:
<option><?php echo $this->__('Select ') ?><?php echo $_attribute->getLabel() ?></option>
But the result is not good, it alway show the text "Choose style" in three options. Please give me a hint for this issue, thank you very much!
I was looking for a more simple way to do this. I didn't want to extend any core files or muck around with extending JavaScript. Instead I parsed the settings JSON, updated the
chooseText
setting, and converted back to JSON:/~theme/default/template/catalog/product/view/type/options/configurable.phtml
More information and further examples here.
This worked for me on CE 1.8.1. It's based off Shein's answer, and addresses the wrong option getting selected on load. I basically just copied/pasted the Product.Config.fillSelect() method from /js/varien/product.js. Within the pasted code I changed:
to
This allows keeping product.js unmodified, and just override the method. The only drawback is any future core updates to that method will need migrating.
Since the new code just gets the "label" setting, the data-choose-text attribute on isn't needed on the select tag
If you only change file configurable.js
It will only change first select when page load
So I must change template file
Get attached file for test.(I just write it to an small extension)
It for all attribute set .
My version of the same problem. You need to change only template catalog/product/view/type/options/configurable.phtml:
Note (extracted from comments) If the selected default value happens not to be "Select %s", replace
with
I extended class Product.Config (method fillselect) by these code:
It's ok!
file catalog/product/view/type/options/configurable.phml
and add one line
changeFristText();
after line 171 (element.options[0] = new Option(this.config.chooseText, '');
) in file js/varien/configurable.jsIt for all attribute set.