- Posts: 259
- Thank you received: 22
Help needed handling Advanced Date Picker field
- rodfarrell
-
Topic Author
- Offline
Less
More
11 years 2 weeks ago #214592
by rodfarrell
Help needed handling Advanced Date Picker field was created by rodfarrell
I have a custom field for products which is using Advanced date Picker. the field is for the date new stock is expected to arrive. There is no default and the field is not a required field.
Here is my challenge. Whenever a product is saved, a default date of 01 Jan 1970 appears which I presume is a MySQL thing. This can be stopped by typing some spacebars in the field but the chances of the site users remembering to do that is minimal.
So I need a way to stop this happening, OR a way to stop the date displaying on the front end if the day is less than today. If the later I need a specific example because my ability with dates in PHP is limited. Thanks in advance.
Here is my challenge. Whenever a product is saved, a default date of 01 Jan 1970 appears which I presume is a MySQL thing. This can be stopped by typing some spacebars in the field but the chances of the site users remembering to do that is minimal.
So I need a way to stop this happening, OR a way to stop the date displaying on the front end if the day is less than today. If the later I need a specific example because my ability with dates in PHP is limited. Thanks in advance.
Please Log in or Create an account to join the conversation.
11 years 2 weeks ago #214620
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Help needed handling Advanced Date Picker field
Hi,
Would it be possible to know what is stored in the product field ?
Because the "advanced date picker" should not display any date if the value is really empty.
So I suppose that the value in the field is not really empty ; knowing what is that value will help us to find an appropriate patch (or a solution).
Regards,
Would it be possible to know what is stored in the product field ?
Because the "advanced date picker" should not display any date if the value is really empty.
Code:
public function show(&$field, $value) {
if(!$this->init())
return '';
if($value === '')
return '';
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
Less
More
- Posts: 259
- Thank you received: 22
11 years 2 weeks ago #214669
by rodfarrell
Replied by rodfarrell on topic Help needed handling Advanced Date Picker field
Correct Jerome, by default it is empty and doesn't display. The problem is that the 1970 date inserts anytime you open and save the product even though no default value is specified so we need that to stop happening or to hide it if the date is older than today.
Please Log in or Create an account to join the conversation.
11 years 2 weeks ago #214852
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Help needed handling Advanced Date Picker field
Hi,
I'm sorry but I'm not able to reproduce your issue.
If I clear the "advanced date picker" product field in the HikaShop backend interface ; I got an empty field in the backend and in the front-end the first is not displayed.
Please be sure that your field configuration is correct and you do not have a "default value" set for it.
Regards,
I'm sorry but I'm not able to reproduce your issue.
If I clear the "advanced date picker" product field in the HikaShop backend interface ; I got an empty field in the backend and in the front-end the first is not displayed.
Please be sure that your field configuration is correct and you do not have a "default value" set for it.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
Less
More
- Posts: 259
- Thank you received: 22
11 years 2 weeks ago #214894
by rodfarrell
Replied by rodfarrell on topic Help needed handling Advanced Date Picker field
Did you then try opening a product and saving without touching the date field? Default is blank and when initially created, doesn't display. Its only after opening and saving a product that a default is inserted into the field. It looks like a MySQL default date.
Please Log in or Create an account to join the conversation.
11 years 2 weeks ago #214898
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Help needed handling Advanced Date Picker field
Hi,
Regards,
Yes, I did that test too.Did you then try opening a product and saving without touching the date field?
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
Less
More
- Posts: 259
- Thank you received: 22
11 years 1 week ago #215040
by rodfarrell
Replied by rodfarrell on topic Help needed handling Advanced Date Picker field
Further testing shows it does the same in the actual custom field editor. See attached pdf with images. On saving the advanced date picker the default date of 1 Jan 1970 is automatically inserted. If I type spaces into the default field it will save with apparently no date inserted but the 1 Jan 1970 date still appears in the product files when they are saved.
I've checked the database and the field is a text field with default NULL so the date is coming from the Advanced date picker itself. Getting desperate now.
I've checked the database and the field is a text field with default NULL so the date is coming from the Advanced date picker itself. Getting desperate now.
Please Log in or Create an account to join the conversation.
11 years 1 week ago #215087
by nicolas
Replied by nicolas on topic Help needed handling Advanced Date Picker field
I've just tried too with the latest version of HikaShop and cannot reproduce the problem you're talking about either.
Are you sure that you're using the latest version of HikaShop ?
Maybe it comes from something that we already fixed in a previous release, so make sure that you have the latest version.
If you do have the latest one but still have the problem, please provide a backend access so that we can check the issue out.
Are you sure that you're using the latest version of HikaShop ?
Maybe it comes from something that we already fixed in a previous release, so make sure that you have the latest version.
If you do have the latest one but still have the problem, please provide a backend access so that we can check the issue out.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
Less
More
- Posts: 259
- Thank you received: 22
11 years 1 week ago #215170
by rodfarrell
Replied by rodfarrell on topic Help needed handling Advanced Date Picker field
I downloaded and reinstalled the latest release of the latest version (I seem to have four different releases of Hikashop Business 2.5.0 all with different file sizes and dates which is quite confusing) and the problem seems to have resolved. Thanks for your help.
The following user(s) said Thank You: Jerome
Please Log in or Create an account to join the conversation.
Time to create page: 0.220 seconds