Date/time error message on checkout

  • Posts: 15
  • Thank you received: 0
  • Hikashop Business
10 years 8 months ago #170665

-- 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.

  • Posts: 26247
  • Thank you received: 4038
  • MODERATOR
10 years 8 months ago #170677

Hi,

Please edit the file "administrator/components/com_hikashop/classes/field.php" and replace

		JPluginHelper::importPlugin('hikashop');
		$dispatcher = JDispatcher::getInstance();
		$dispatcher->trigger('onFieldDateDisplay', array($field->field_namekey, $field, &$value, &$map, &$format, &$size));
By
		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.

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.
The following user(s) said Thank You: gmarsh

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

  • Posts: 15
  • Thank you received: 0
  • Hikashop Business
10 years 8 months ago #170693

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