Reputation: 43
I want to change the dropdown message or remove it all together. I've searched for instances of --Please Select-- but I cannot find the one that controls the Custom Option dropdowns.
Searched high and low but I cannot find where this code lives in Magento, any help will be greatly appreciated!
Upvotes: 3
Views: 8216
Reputation: 29
I had a similar issue myself and, after searching high and low, decided to take what I knew about Magento and tackle it alone.
And here's your answer:
Open: \app\code\core\Mage\Catalog\Block\Product\View\Options\Type\Select.php
Alter the following lines:
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
$select->setName('options['.$_option->getid().']')
->addOption('', $this->__('-- Please Select --'));
}
To:
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
$select->setName('options['.$_option->getid().']');
// ->addOption('', $this->__('-- Please Select --'))
}
Summary of changes: I commented out the ->addOption line with two forward slashes AND - and this is important - I moved the semi-colon from the end of that line to the end of the previous line. Reversing this change allows you to undo the changes you made.
When you plug that pup in, you'll see on the frontend your first custom option displaying as the default text.
Here's an example from my website, a product page for my Rugged Notebooks distribution company.
Upvotes: 2
Reputation: 37700
The easiest way to change the text would be through translation. Open app/locale/en_US/Mage_Adminhtml.csv
(or whichever language you have installed) and you'll see a row for "-- Please Select --" already there, change the text in the second column and clear the translation cache. This affects all instances of "-- Please Select --" throughout the admin.
To be more specific copy the file app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Type.php
to an equivalently named folder in app/core/local/
and either change or delete the line that looks like this:
array('value' => '', 'label' => Mage::helper('adminhtml')->__('-- Please select --'))
Upvotes: 5