3

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!

lennoxdunce
  • 43
  • 1
  • 3

2 Answers2

5

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 --'))
clockworkgeek
  • 37,650
  • 9
  • 89
  • 127
  • I re-read my question and it wasn't clear that I was asking for the changes to appear on the frontend. Nonetheless, your answer was very, very helpful. Thank you for taking the time! I changed the **-- Please Select --** message in the `app/locale/en_US/Mage_Catalog.csv` file and it was successful! – lennoxdunce Mar 03 '11 at 00:17
2

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.

  • 3
    Be wary of editing core files directly, they can get overwritten automatically by updates. Instead copy the file to "\app\code\ **local** \Mage\Catalog\Block\Product\View\Options\Type\Select.php" and make your changes there. – clockworkgeek May 10 '11 at 21:27