Saturday 27 June 2015

How can add custom option title in dropdown option in magento

Open file:  app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php


Find following code (Maybe line number - 59):


         $select->setName('options['.$_option->getid().']')
                              ->addOption('', $this->__('-- Please Select --'));


add this line at above of code:


                      $getOptionTitle= ucwords($_option->getTitle());


Now code looks like as:


         $getOptionTitle = ucwords($_option->getTitle());

                                ->setName('options['.$_option->getid().']')

                                      ->addOption('', $this->__('-- Please Select'.$getOptionTitle. '--'));


Now go to frontend. And check now, Title of Custom Option is displaying in drop down.