0

How to get time field on product form I have attached screenshot what i want to do.enter image description here

any help would be much appreciated.

  • 3
    Why not just add a simple text attribute and fill in what ever you want in it? – Marius Jan 9 '14 at 10:00
  • 2
    What about two time fields? from and to? What you want is not easy to achieve and either hard to parse or more work to show and change – Fabian Blechschmidt Jan 9 '14 at 11:06
1

You can add one simple text attribute where you can enter the desired value.
If you need later to filter products based on start hour or end hour you can do as @FabianBlechschmidt suggests, and add 2 fields, one for start hour and one for end hour.
You can even go further and add 4 fields, 1 for starting hour, 1 for time of the day (AM or PM) then do the same and add 2 fields for closing hour.

| improve this answer | |
-1
$installer->startSetup();
$installer->getConnection()->addAttribute(
    'catalog_product', 'register_time', array(
        'input' => 'time',
        'type' => 'time',
        'backend' => 'customer/entity_attribute_backend_datetime',       
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'required' => 1,
        'sort_order' => 51,
        'label' => 'Register Time',
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'required' => 1,
        'comparable' => '0',
        'searchable' => '0',
        'visible_on_front' => 0, 
        'visible_in_advanced_search' => 0,
        'is_html_allowed_on_front' => 0,
        'unique' => false,
        'note' => 'Time format is Hrs:Mins:Secs',
        'apply_to' => '', 
        'is_configurable' => false
    )
);
$installer->endSetup();
| improve this answer | |
  • I don't think there is such type as 'time' – Tero Lahtinen Oct 9 '17 at 10:00

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.