Pages

Friday, July 5, 2013

How to remove please select from custom option drop down in Magento

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.

No comments:

Post a Comment