using custom date field with date picker plugin

  • Posts: 100
  • Thank you received: 1
11 years 3 months ago #159229

-- HikaShop version -- : 2.3.1
-- Joomla version -- : 3.3
-- PHP version -- : 5X

Hi

I am using a custom field and applying advance date picker plugin with field type "advance date picker" for table "product". I am setting format as "D d M Y".
When I select 30 June 2014, it writes the value in the database as "20140630000000".

I am using this custom date field by using $row->course_start_date. However it prints out the string 20140630000000, rather than the Mon 30 Jun 2014.






Could you advise how you are formatting this?

Thanks

Attachments:
Last edit: 11 years 3 months ago by paddyrolls.

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

  • Posts: 26275
  • Thank you received: 4045
  • MODERATOR
11 years 3 months ago #159237

Hi,

To display the custom field, you have to use the HikaShop field class and call the "show" function with the field object.
You can't use a raw value like that with the custom fields.

The date is stored in a fixed format in order to be displayed dynamically.
The other date custom field store the pre-formated date in the database, so it does not allow you to sort or filter easily (depending the format you use).
The "pro" is that you can display the raw value from the database, the "con" is that you can't change the format or use it in code/sql.

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: 100
  • Thank you received: 1
11 years 3 months ago #159371

HI Jerome

Thank you for your response. Could you please give me an example of how to use this show function.

Thanks

Patrick

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

  • Posts: 84298
  • Thank you received: 13694
  • MODERATOR
11 years 3 months ago #159385

Like that:

$fieldsClass = hikashop_get('class.field');
$fields = $fieldsClass->getFields('frontcomp',$this->row,'product','checkout&task=state');
echo $fieldsClass->show($fields['course_start_date'],$this->row->course_start_date);

Last edit: 9 years 6 months ago by nicolas.

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

  • Posts: 100
  • Thank you received: 1
11 years 3 months ago #159451

Hi Nicolas and Jerome

This worked.

Thanks for your assistance.

Patrick

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

Time to create page: 0.067 seconds
Powered by Kunena Forum