Skip to main content

Date/time error message on checkout

More
12 years 3 weeks ago #170665 by gmarsh
-- url of the page with the problem -- : sat.kahworld.org/index.php/2012-03-12-23...3-57/product/listing
-- HikaShop version -- : 2.3.2
-- Joomla version -- : 2.5.24
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : unknown - customer
-- Error-message(debug-mod must be tuned on) -- : 500 - DateTime::__construct() [datetime.--construct]: Failed to parse time string (09-28-2014) at position 0 (0): Unexpected character

Haven't had this error before. But a customer's order failed on checkout because of it. There are no dates associated with products, only two custom fields. No problems with it in 2 years of operation.

Thoughts?
Gary

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

More
12 years 3 weeks ago #170677 by Jerome
Hi,

Please edit the file "administrator/components/com_hikashop/classes/field.php" and replace
Code:
JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onFieldDateDisplay', array($field->field_namekey, $field, &$value, &$map, &$format, &$size));
By
Code:
if(HIKASHOP_J25 && !empty($value) && $field->field_options['format'] != "%Y-%m-%d") { $seps = preg_replace('#[a-z0-9%]#iU','',$field->field_options['format']); $seps = str_replace(array('.','-'),array('\.','\-'),$seps); $mConv = false; $yP = -1; $mP = -1; $dP = -1; $i = 0; foreach(preg_split('#['.$seps.']#', $field->field_options['format']) as $d) { switch($d) { case '%y': case '%Y': if($yP<0) $yP = $i; break; case '%b': case '%B': $mConv = true; case '%m': if($mP<0) $mP = $i; break; case '%d': case '%e': if($dP<0) $dP = $i; break; } $i++; } $elems = preg_split('#['.$seps.']#', $value); $value = @$elems[$yP] . '-' . @$elems[$mP] . '-' . @$elems[$dP]; $app = Jfactory::getApplication(); if($app->isAdmin()) { $app->enqueueMessage('Since Joomla 2.5.24 it is not possible anymore to change the format of dates. If you need a different format, please use the advanced datepicker type of custom field.'); } $format = "%Y-%m-%d"; $field->field_options['format'] = $format; } if(HIKASHOP_J25 && !empty($value)) { try{ JHTML::_('date', $value, null, null); }catch(Exception $e) { $value = ''; } } JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onFieldDateDisplay', array($field->field_namekey, $field, &$value, &$map, &$format, &$size));
It will manage the bug introduced in Joomla 2.5.24 and Joomla 3.3

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: gmarsh

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

More
12 years 3 weeks ago #170693 by gmarsh
Thank you for the prompt help! Much appreciated!
Gary

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

Time to create page: 0.153 seconds
Powered by Kunena Forum