How to add "date" type custom option for products and make it work?

Last modified by sptman on Thu, June 24, 2010 16:51
Source|Old Revisions  

This is an old revision of the document!


This is a common topic.

Many Magento users, like my company, have similar requirements to let customers choose date through pop-up calendar in the product view page. But Magento merely offer 2 groups of input type, “Text” and “Select”, in Catelog→Manage Products→Custom Options page by default. Is there any possibility for us to add the support for “Date” or “Date Time” input types?

The answer is absolutely “Yes, we can”. Actually, Magento do have all the necessary components such as js libraries, phtml templates and predefined classes to achieve this goal. So what you have to do is just amending limited files to enable the built-in function.

Let’s do it step by step.

Step 1: Create model entry for “Date” input type. Edit “appcodecoreMageCatalogetcconfig.xml” and look for the tag <groups>. Once you find the tag, insert the following code below it.

  1.                             <date translate="label" module="adminhtml">
  2.                                 <label>Date</label>
  3.                                 <render>adminhtml/catalog_product_edit_tab_options_type_date</render>
  4.                                 <types>
  5.                                     <date translate="label" module="adminhtml">
  6.                                         <label>Date</label>
  7.                                     </date>
  8.                                 </types>
  9.                             </date>



 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs