Start and end time changes on every save

  • Posts: 86
  • Thank you received: 3
4 years 4 months ago #314165

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.14
-- PHP version -- : 7.1.33

Hi

When entering an additional price with a start and end date in a product the time that I enter gets added an hour when saving the product.
On every save of this product the time gets an additional hour added.

The same happens to start ena end times of coupons, and maybe other places in the component.

Rgds
Picht

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
4 years 4 months ago #314171

Hi,

We've added a patch for that.

Download again the install package of HikaShop on our website again and install it on your website to get the patch added and it should be good.

The following user(s) said Thank You: dvddvd

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

  • Posts: 86
  • Thank you received: 3
4 years 4 months ago #314201

Hi

The shifting of the time has been corrected, but other problems have occurred.

1. In the product page, when adding prices to the Prices and taxes, the times selected are not always saved when pressing OK. It can not be changed, but you have save it and the edit it.
When editing more than one price somoe dissappear when saving.
It has a lot of errors on this part of the products page :(

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

  • Posts: 12953
  • Thank you received: 1778
4 years 4 months ago #314204

Hello,

1. I wasn't able to reproduce your issue, can you give us step by step instructions on how to reproduce it through some screenshots for example ? Thank you.

Kind regards,
Mohamed.

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

  • Posts: 86
  • Thank you received: 3
4 years 3 months ago #314995

Sorry for the late reply

The issue wjth prices that go missing:
On the prices section (see image) I have one price saved a long time ago.


I add a price by pressing the + button. Simple only the price, no dates or other things.
Then press OK
Add another price like the first, but with another number.
Press OK and the Save the product.
Product is saved as expected.
Now edit price number 1 and press OK
(Do NOT save the product)
Edit price numver 2 and press OK.
Now save the product.
Result: One price has dissappeared

Attachments:

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

  • Posts: 86
  • Thank you received: 3
4 years 3 months ago #314997

The other issue could not be reproduced

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

  • Posts: 4519
  • Thank you received: 611
  • MODERATOR
4 years 3 months ago #314998

Hello,

We try to reproduce your issue on our side, unfortunately without success...
Can you provide via our Contact us Form some backend references and backend url, to process some test directly on your website.

Note : Don't forget to add an Url link to this topic, and notify us, here.

Regards

Last edit: 4 years 3 months ago by Philip.

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

  • Posts: 86
  • Thank you received: 3
4 years 3 months ago #315013

Message sent

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

  • Posts: 4519
  • Thank you received: 611
  • MODERATOR
4 years 3 months ago #315019

Hello,

Ok now, we are unable to see it, and better understand what's going on.
To resume, the OK button is built to process one price per process, to be more precise you have to validate each price entry to avoid this issue.

We can understand that this can be confusing and not very user friendly, but once you know this, there is nothing very blocking in your product configuration.
But as your returns is relevant, we will see how we can improve this for our future release, always in order to be more user friendly.

Regards

Last edit: 4 years 3 months ago by Philip.

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

  • Posts: 548
  • Thank you received: 11
  • Hikamarket Multivendor Hikashop Business
3 years 7 months ago #323798

Dear Nicholas

Is there a guide to fix this bug?

As we already have some customization on the system, reinstall will cause all the things have to redo

Can you show us the file that have the changes so we can change that particular file or classses?

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
3 years 7 months ago #323814

Hi,

Well, I'm not sure as it was months ago.
I think it might be this patch:
Change the code:

function hikashop_getTime($date, $format = '%d %B %Y %H:%M') {
	static $timeoffset = null;
	// get timezone offset from Joomla
	if($timeoffset === null){
		$config = JFactory::getConfig();
		if(!HIKASHOP_J30){
			$timeoffset = $config->getValue('config.offset');
		} else {
			$timeoffset = $config->get('offset');
		}
		$dateC = JFactory::getDate('now', $timeoffset);
		$timeoffset = $dateC->getOffsetFromGMT(true);
	}
	if(!is_numeric($date)) {
		// convert date into UTC timestamp
		$format = str_replace(array('%A','%d','%B','%m','%Y','%y','%H','%M','%S','%a'), array('l','d','F','m','Y','y','H','i','s','D'), hikashop_getDateFormat($format));
		try {
			$dateTime = DateTime::createFromFormat($format, $date, new DateTimeZone('UTC'));
			if($dateTime)
				$date = $dateTime->getTimestamp();
			else
				$date = strtotime(str_replace('-','/', $date));
		} catch( Exception $e) {
			$date = strtotime(str_replace('-','/', $date));
		}
	}
	if($date === false)
		return false;
	// account for timezone offset
	return $date - $timeoffset *60*60 + date('Z', $date);
}
to:
function hikashop_getTime($date, $format = '%d %B %Y %H:%M') {
	static $timeoffset = null;
	static $timeZone = null;
	// get timezone offset from Joomla
	if($timeoffset === null){
		$config = JFactory::getConfig();
		if(!HIKASHOP_J30){
			$timeZone = $config->getValue('config.offset');
		} else {
			$timeZone = $config->get('offset');
		}
		$dateC = JFactory::getDate('now', $timeZone);
		$timeoffset = $dateC->getOffsetFromGMT(true);
	}
	if(!is_numeric($date)) {
		// convert date into UTC timestamp
		$format = str_replace(array('%A','%d','%B','%m','%Y','%y','%H','%M','%S','%a'), array('l','d','F','m','Y','y','H','i','s','D'), hikashop_getDateFormat($format));
		try {
			$dateTime = DateTime::createFromFormat($format, $date, new DateTimeZone($timeZone));
			if($dateTime) {
				$date = $dateTime->getTimestamp();
			}else {
				$date = strtotime(str_replace('-','/', $date));
				if($date === false)
					return false;
				// account for timezone offset
				return $date - $timeoffset *60*60 + date('Z', $date);
			}
		} catch( Exception $e) {
			$date = strtotime(str_replace('-','/', $date));
			if($date === false)
				return false;
			// account for timezone offset
			return $date - $timeoffset *60*60 + date('Z', $date);
		}

	}
	return $date;
}
in the file administrator/components/com_hikashop/helpers/helper.php
Make sure you do a backup of the file before as you might have to restore it if that change is not fully compatible with your old version of HikaShop

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

Time to create page: 0.108 seconds
Powered by Kunena Forum