0

Hello I am simply trying to find the array of defaults for the product custom-option date

my goal is to change the month from "01,02,03....12" to a string with the month name "Jan. , Feb. , Mar. - Dec."

I believe I found the date custom-option file in

app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php

and in there you see the 'month' array being called but I can't find the declaration file.

I am new to this stuff so pardon my ignorance if this is obvious or I am making it more convoluted.

0

The month select is generated in the method Mage_Catalog_Block_Product_View_Options_Type_Date::getDropDownsDateHtml by the line $monthsHtml = $this->_getSelectFromToHtml('month', 1, 12);.
You can change that to something that fits your needs.

or you can do an ugly thing and change the dropdown texts via some javascript after the page loads.

0

Go to

app\code\core\Mage\Catalog\Block\Product\View\Options\Type\Date.php

and add the below code into Date.php file.

Mage_Catalog_Block_Product_View_Options_Type_Date (its better to rewrite it in local)

protected function _getMonthSelectFromToHtml($name, $from, $to, $value = null)
{
        $options = array(
                array('value' => '', 'label' => '-')
        );
        for ($i = $from; $i <= $to; $i++) {
                $options[] = array('value' => $i, 'label' => Zend_Locale::getTranslation($i, 'Month', Mage::app()->getLocale()->getLocaleCode()));
        }
        return $this->_getHtmlSelect($name, $value)
                ->setOptions($options)
                ->getHtml();
}

then find out

$monthsHtml = $this->_getSelectFromToHtml('month', 1, 12);

and replace with below code:

$monthsHtml = $this->_getMonthSelectFromToHtml('month', 1, 12);

Hope this helps.

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.