Remove option from dropdown menu
-
29-09-2020 - |
Question
I would like to remove the 'Please select' option from a dropdown menu and assign my first option as the default option.
You can check it here: http://store.hbros.co.uk/beef-aubergine.html
I've already checked some tutorials but none of them works. What could I do?
Thanks
Solution
Try this before that take Bakup you have to overwrite below file to remove please select for cutom option
Copy \app\code\core\Mage\Catalog\Block\Product\View\Options\Type\Select.php to \app\code\local\Mage\Catalog\Block\Product\View\Options\Type\Select.php
Find below code:
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
$select->setName('options['.$_option->getid().']')
->addOption('', $this->__('-- Please Select --'));
}
Replace it with
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
$select->setName('options['.$_option->getid().']');
// ->addOption('', $this->__('-- Please Select --'));
}
And you have done.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange