magento2: Cannot create full datetime product attribute
It appears to be impossible to add a complete datetime attribute, one that saves both date and time. I’ve created the attributes with backend_type => 'datetime' and included custom frontend_input_renderers to get a calendar picker that has both date and time. Unfortunately, the time is always stripped off due to the hardcoded force for datetime attributes to be filtered by date. This occurs here.
Please let me know if there is an intended way around this. Seems like a lot of trouble to create an entire new backend type for this, when it should be stored in the catalog_product_entity_datetime table.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 24 (8 by maintainers)
Commits related to this issue
- Cannot create full datetime product attribute #4053. Added new frontend_input type: datetime — committed to novikor/magento2 by deleted user 6 years ago
- Cannot create full datetime product attribute #4053. Removed extra comma — committed to novikor/magento2 by deleted user 6 years ago
- Cannot create full datetime product attribute #4053. Some code refactoring — committed to novikor/magento2 by deleted user 6 years ago
- Merge pull request #4053 from magento-engcom/graphql-develop-prs [EngCom] Public Pull Requests - GraphQL — committed to magento/magento2 by naydav 5 years ago
@jzahedieh yea sorry for the wait. It’s been a while, but I think these are all the pieces. Keep in mind this code is from like a year ago, I think we were still on 2.0.* or something. So for the helper preference, you might want to check on that copy-pasted stuff and make sure it’s up to date.
New datetime form element
Block/Adminhtml/Form/Element/Datetime.php
Use it in install script
Setup/InstallData.php
Overwrite product initialization helper
etc/di.xml
Helper/Adminhtml/Catalog/Product/Initialization.php
If you are implementing start/end, set max value stuff
etc/adminhtml/events.xml
Observer/Adminhtml/Product/SetStartDateMaxValue.php
I opened this issue in 2016… haven’t worked on Magento in years. Congrats though!