Post by Joe1234 » Thu Nov 21, 2024 10:34 am

When using the custom date field I'm getting a default date value as "YYYY-MM-DD" even though I don't have that set in the creation of the custom field. When I look at the code in the edit.twig under custom date input it shows:

Code: Select all

                <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
with

Code: Select all

{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% else %}
Being the cause of the default value set. The problem is, I have no idea what that is or where it is coming from. I've checked the database, the controller, the twig, I can't figure it out. I really don't have a problem with that default value except for the fact it is causing the date picker to show partial information. I know I can just get rid of that code, but I simply really want to know. Where is that default value coming from and how can I edit it? This is the default OC edit file.
Last edited by Joe1234 on Fri Nov 22, 2024 1:48 am, edited 1 time in total.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by by mona » Thu Nov 21, 2024 10:49 am

datepicker is part of bootstrap
https://www.google.com/search?q=bootstr ... ate+format
https://www.google.com/search?q=datepicker+in+opencart

I have to ask. What did google do to you that has caused such an aversion to using the google search engine?

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 softmonke » Thu Nov 21, 2024 5:51 pm

Hmm if you didn't set a default value in your custom fields in admin, then the custom field shouldn't have any default values. I tested on my own installation of OpenCart and the custom date field shows up empty.

Since you mentioned that you looked into "edit.twig", I assume you are referring to the "edit.twig" in "account" and you assigned the date custom field to "Account" location. If that's the case, won't it be normal for the field to show up with a default value since it's possible that the account already has the value saved?

Even so, I also tried creating the date custom field, and logged into an existing customer account, and the date custom field shows up empty as well. So it's likely that the account you're testing with has already saved a value for the date custom field you've created? Also, maybe you can try registering an account - does the date custom field show up empty or does it come with a default value? If it's empty, then it shows that it's working as intended. If it still comes with a default value, then maybe something else is at play here.

I'm assuming a lot here so maybe you can provide more information on this.

Check out our ever-growing list of extensions for OpenCart here.
Some useful extensions for a better admin experience: Image File Manager ProDrag & Drop Sort Order

Reach out to us at hello@softmonke.com for your OpenCart web development needs or feedback for our extensions.


User avatar
Active Member

Posts

Joined
Tue May 23, 2023 4:42 am


Post by by mona » Thu Nov 21, 2024 7:06 pm

There is nothing else at play, it is the standard behaviour of bootstrap formatting of datetime picker.
The first link - first google result explains how the bootstrap timepicker works and everything you need to know. Further down there are some examples.
The second link - second result on google which has correctly been marked as [SOLVED] gives you everything you need to know specifically for Opencart.

I could repeat the answers, but they are not going to be as good as the in-depth information previously provided by the numerous times it has been asked.

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 Joe1234 » Fri Nov 22, 2024 1:46 am

@mona, you didn't have to ask. I did use google before I posted, and much like the help you provided, I got nothing from google lol, just saying. My issue had nothing to do with bootstrap, and even if it did, how would I know that before coming here to get some type of insight to go off of? And the second link, I found that before I posted as well and it has nothing to do with my issue.
@softmonke, thanks, you were right and pointed me in the right direction to solve my issue....which is what I was looking for....it had to do with something I did a while back that I forgot that was causing the issue. All good now.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by softmonke » Fri Nov 22, 2024 2:20 am

by mona wrote:
Thu Nov 21, 2024 7:06 pm
There is nothing else at play, it is the standard behaviour of bootstrap formatting of datetime picker.
The first link - first google result explains how the bootstrap timepicker works and everything you need to know. Further down there are some examples.
The second link - second result on google which has correctly been marked as [SOLVED] gives you everything you need to know specifically for Opencart.

I could repeat the answers, but they are not going to be as good as the in-depth information previously provided by the numerous times it has been asked.
Hey I think you misunderstood @Joe1234's post - they are not asking about changing the date format or anything about the datetime picker. I believe what they're saying is that the date custom field that they have created has a default value showing up as "YYYY-MM-DD" despite him not setting a default value in his admin. And in the end, it's just something that they had done to their site rather than any issues with OpenCart or Bootstrap's datetime picker.

Check out our ever-growing list of extensions for OpenCart here.
Some useful extensions for a better admin experience: Image File Manager ProDrag & Drop Sort Order

Reach out to us at hello@softmonke.com for your OpenCart web development needs or feedback for our extensions.


User avatar
Active Member

Posts

Joined
Tue May 23, 2023 4:42 am


Post by by mona » Fri Nov 22, 2024 3:03 am

Like this?
Screen-Shot-2024-11-21.jpg

Screen-Shot-2024-11-21.jpg (84.24 KiB) Viewed 1074 times

Joe1234 wrote:
Thu Nov 21, 2024 10:34 am
but I simply really want to know. Where is that default value coming from and how can I edit it? This is the default OC edit file.
answer
viewtopic.php?t=207683
posting.php?mode=quote&p=810081#pr762723
posting.php?mode=quote&p=810081#pr810081

That is where it comes from. He did not say which custom code but every file including the bootstrap timepicker has been included in the zip folder of the download Tasabe kindly offered to the community.

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
Who is online

Users browsing this forum: lockiedownunder and 16 guests