I'm using opencart 3 and have created a custom field for Birthday on customer details page.
The date format is YYYY/MM/DD and I want DD/MM/YYYY.
I came across the folllowing instructions and followed it exactly. Sadly, no change.
Could some expert out there kindly look at instructions for 3.0 and verify that the instructions should work.
For OpenCart 2.0.3.x to 2.3.x, you will need to access your catalog/view/theme/default/template/account/register.tpl file, and for OpenCart 3.0 you need to access the catalog/view/theme/default/template/account/register.twig file.
Find this line:
<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo (isset($register_custom_field[$custom_field['custom_field_id']]) ? $register_custom_field[$custom_field['custom_field_id']] : $custom_field['value']); ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD" id="input-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
...and change the date format manually to DD-MM-YYYY, or whichever date format you need.
Mind that DD, refers to Days, MM to Months and YYYY to Year.
You will also need to do the same for your the checkout files, which are available at catalog/view/theme/default/template/checkout/register.tpl for OpenCart 2.3.x and catalog/view/theme/default/template/checkout/register.twig for OpenCart 3.0.
Thanks in advance for any help
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Running 3.03.2
Just want to change the custom field for birth date that we use on checkout page to show as DD-MM-YYYY not YYYY-MM-DD - would welcome any solutions please
catalog/view/theme/<your_theme>/template/checkout/register.twig file, look for these attributes:ru-lefthanded wrote: ↑Thu May 19, 2022 11:30 pmtried the above & didnt work for me - and have cleared all caches etc
Running 3.03.2
Just want to change the custom field for birth date that we use on checkout page to show as DD-MM-YYYY not YYYY-MM-DD - would welcome any solutions please
Code: Select all
data-date-format="YYYY-MM-DD HH:mm"
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Attachments
having changed the above file you still get this format :( - DOB_1.jpg (190.87 KiB) Viewed 730 times
if you click in the box, you get the calender up - DOB_2.jpg (180.79 KiB) Viewed 730 times
Then, you'd need to be more precise about: at checkout on our site . Forum rules.ru-lefthanded wrote: ↑Fri May 20, 2022 4:18 pmThank you - had tried that already but that doesnt change the field [at checkout on our site (had cleared cache & even purged cache at CDN before posting this response)
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
It looks like you are using a custom checkout so one possible issue is you are changing the wrong file? .. but there are a number of other possibilities.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: niagato, Semrush [Bot] and 646 guests