Post by paul160442 » Sun Oct 06, 2019 10:09 pm

Hi
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

Newbie

Posts

Joined
Sun Oct 06, 2019 9:46 pm

Post by cyclops12 » Tue Oct 08, 2019 12:50 am

Did you clear ALL caches after making the changes ?

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by thekrotek » Tue Oct 08, 2019 1:22 am

I wouldn't recommend to edit core files for all your work will be wiped out next time you upgrade the theme or OpenCart itself. The proper way to achieve this is to create a modification (XML) file, providing you know how to create one.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by ru-lefthanded » Thu May 19, 2022 11:30 pm

tried 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

New member

Posts

Joined
Tue Sep 03, 2013 3:39 am

Post by straightlight » Fri May 20, 2022 4:28 am

ru-lefthanded wrote:
Thu May 19, 2022 11:30 pm
tried 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
catalog/view/theme/<your_theme>/template/checkout/register.twig file, look for these attributes:

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


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ru-lefthanded » Fri May 20, 2022 4:18 pm

Thank 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)

Attachments

DOB_1.jpg

having changed the above file you still get this format :( - DOB_1.jpg (190.87 KiB) Viewed 534 times

DOB_2.jpg

if you click in the box, you get the calender up - DOB_2.jpg (180.79 KiB) Viewed 534 times


New member

Posts

Joined
Tue Sep 03, 2013 3:39 am

Post by straightlight » Fri May 20, 2022 6:27 pm

ru-lefthanded wrote:
Fri May 20, 2022 4:18 pm
Thank 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)
Then, you'd need to be more precise about: at checkout on our site . Forum rules.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ru-lefthanded » Sat May 21, 2022 12:30 am

How do you get more precise than showing pictures of the problem??

New member

Posts

Joined
Tue Sep 03, 2013 3:39 am

Post by by mona » Sat May 21, 2022 12:42 am

What Straightlight means is for example ..
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


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by straightlight » Mon May 23, 2022 10:25 am

Yes, that is correct.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ru-lefthanded » Mon May 23, 2022 10:18 pm

Thanks Mona - appreciate the clarification.

New member

Posts

Joined
Tue Sep 03, 2013 3:39 am
Who is online

Users browsing this forum: Semrush [Bot] and 102 guests