1

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

0

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.

  • I don't have this folder "\app\code\local\Mage\Catalog", I have only "Customer" & "Eav" – Ricardo DeLa Rosa Nieto Mar 19 '16 at 16:08
  • first check this available \app\code\core\Mage\Catalog\Block\Product\View\Options\Type\Select.php – Magento 2 Mar 19 '16 at 16:11
  • Hi again. I access to the Select.php file and I comment the line "// ->addOption('', $this->__('-- Please Select --'))" and now it's done. You can check the result here: store.hbros.co.uk/beef-aubergine.html Thanks for your help :) – Ricardo DeLa Rosa Nieto Mar 19 '16 at 16:12
  • Okay cool But don't edit core file it's not recommended one – Magento 2 Mar 19 '16 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.