Help needed handling Advanced Date Picker field

  • Posts: 259
  • Thank you received: 22
9 years 11 months ago #214592

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.

Please Log in or Create an account to join the conversation.

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 11 months ago #214620

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.

	public function show(&$field, $value) {
		if(!$this->init())
			return '';

		if($value === '')
			return '';
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,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 259
  • Thank you received: 22
9 years 11 months ago #214669

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.

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 11 months ago #214852

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,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 259
  • Thank you received: 22
9 years 11 months ago #214894

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.

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 11 months ago #214898

Hi,

Did you then try opening a product and saving without touching the date field?

Yes, I did that test too.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 259
  • Thank you received: 22
9 years 11 months ago #215040

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.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 84305
  • Thank you received: 13700
  • MODERATOR
9 years 11 months ago #215087

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.

Please Log in or Create an account to join the conversation.

  • Posts: 259
  • Thank you received: 22
9 years 11 months ago #215170

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.066 seconds
Powered by Kunena Forum