Wrong dates statistics per month

  • Posts: 220
  • Thank you received: 8
4 years 4 months ago #322664

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.2.31

Hi,

Strange things are happening in the statistic reports.
When daily or weekly figures are displayed, the associated dates are correct.
But after switching to monthly statistic suddenly a gap has arisen between the associated date and the actual period to which the statistic shown refers.

It's all about a line chart with start date 2020-01-01 and end date 2020-12-31.
Two screenshots are attached to make clear what happens.
.
In screenshot 1 the items are grouped per week.
The X-axis displays the correct dates: Jan 01 unto Jan 01.
An example of the statistics: on Aug. 10 the sales of the previous week are displayed.

In screenshot 2 the items are grouped per month Start date and end date are unchanged.
Now the dates on the X-axis haven been moved forward a month: Dec. 01 untill Dec. 01
Remarkable: on Jul. 1 the sales of August are displayed., on Jun. 1 the sales of July and so on.
This is very confusing and incorrect.

The red lines in the charts are sales in the same period last year.

Please advice.

Regards,
Udo.

Regards,
Udo

Attachments:

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

  • Posts: 220
  • Thank you received: 8
4 years 4 months ago #323228

Hi,
Something went wrong, I'm afraid.
I never received an answer on this topic.

regards,
Udo

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
4 years 4 months ago #323355

Hello,

Can you please provide a screenshot of your "report" configuration ?

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: 220
  • Thank you received: 8
4 years 4 months ago #323358

Hi,

Attached is a screenshot of the configuration of the monthly sales report.

Before updating to Hikashop 4.3.0 I used the columns display type. That was working fine.
Alas that display type is removed.

Regards,
Udo

Attachments:

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
4 years 4 months ago #323363

Hello,

Do you know which version you were using before your update to HikaShop 4.3.0 ?

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: 220
  • Thank you received: 8
4 years 4 months ago #323392

I was using Hikashop 3.5.1

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
4 years 4 months ago #323403

Hello,

Between HikaShop 3.5.1 and HikaShop 4.3.0 ; there was a fix related to the handle of the timezone in the reports.
So, I suppose the issue you see is related to a swift of few hours which would correspond to the timezone.

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: 220
  • Thank you received: 8
4 years 3 months ago #323458

Hi,

If the issue is caused by this timezone fix it did not affect items grouped by week, only intems grouped by month.

Is there any way to address the problem?

regards,
Udo

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

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

Hello Udo,

I just tested it with the same configuration and it worked fine, can you download the last Hikashop version through our website, install it and test it again ?

If you're still having that issue can you send us a temporary access to your back-end so that we can directly test it ? Thank you.

You can send it using our contact form via :
www.hikashop.com/support/contact-us.html

Also, don't forget to add a link to that thread in your message, thank you.

Kind regards,
Mohamed.

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

  • Posts: 220
  • Thank you received: 8
4 years 3 months ago #323996

Hi Mohamed,

I'm using the last Hikashop version 4.3.0

The access details are mailed via the contact form.

Looking at the recent reports I notice that the months Aug and Oct are displayed but Sept is missing.
Aug shows the statistics of the current month September.

Thnaks,
Udo

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

  • Posts: 220
  • Thank you received: 8
4 years 2 months ago #324479

Any advice?

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

  • Posts: 220
  • Thank you received: 8
4 years 2 months ago #324962

Hi,
Your temporay access to the website is now disabled.
Unfortunately you didnot reply anymore.

Regards,
Udo

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

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

Hello Udo and sorry for the late reply,

We were actually able to reproduc that issue on our end, and made a fix. The solution will be to edit the file "administrator\components\com_hikashop\classes\widget.php" and change these lines :

function _jsDate($group,&$element, $widget=null, $diff=null){
	if(!isset($element->timestamp)){
		switch($group){
			case '%H %j %Y'://day
				$parts = explode(' ',$element->calculated_date);
				$element->timestamp = gmmktime($parts[2], 0, 0, 1, $parts[1], $parts[0]) - $this->timeoffset;
				break;
			case '%j %Y'://day
				$parts = explode(' ',$element->calculated_date);
				$element->timestamp = gmmktime(0, 0, 0, 1, $parts[1], $parts[0])- $this->timeoffset;
				break;
			case '%u %Y'://week
				$parts = explode(' ',$element->calculated_date);
				$element->timestamp = gmmktime(0, 0, 0, 1, $parts[1]*7, $parts[0])- $this->timeoffset;
				break;
			case '%m %Y'://month
				$parts = explode(' ',$element->calculated_date);
				$element->timestamp = gmmktime(0, 0, 0, $parts[1], 1, $parts[0])- $this->timeoffset;
				break;
			case '%Y'://year
				$element->timestamp = gmmktime(0, 0, 0, 1, 1, $element->calculated_date)- $this->timeoffset;
				break;
		}
	}

	if(isset($widget->widget_params->period_compare)){
		if($widget->widget_params->period_compare=='last_period' && isset($widget->elements)){
				$element->timestamp=$element->timestamp+$diff;
		}
	}

	$element->year = date('Y',$element->timestamp);
	$element->month = date('m',$element->timestamp)-1;
	$element->day = date('j',$element->timestamp);
	if($widget->widget_params->date_group=="%H %j %Y"){
		$element->hour = date('G',$element->timestamp);
	}
}
By :
function _jsDate($group,&$element, $widget=null, $diff=null){
	if(!isset($element->timestamp)){
		switch($group){
			case '%H %j %Y'://day
				$parts = explode(' ',$element->calculated_date);
				$element->timestamp = gmmktime($parts[2], 0, 0, 1, $parts[1], $parts[0]);
				break;
			case '%j %Y'://day
				$parts = explode(' ',$element->calculated_date);
				$element->timestamp = gmmktime(0, 0, 0, 1, $parts[1], $parts[0]);
				break;
			case '%u %Y'://week
				$parts = explode(' ',$element->calculated_date);
				$element->timestamp = gmmktime(0, 0, 0, 1, $parts[1]*7, $parts[0]);
				break;
			case '%m %Y'://month
				$parts = explode(' ',$element->calculated_date);
				$element->timestamp = gmmktime(0, 0, 0, $parts[1], 1, $parts[0]);
				break;
			case '%Y'://year
				$element->timestamp = gmmktime(0, 0, 0, 1, 1, $element->calculated_date);
				break;
		}
	}

	if(isset($widget->widget_params->period_compare)){
		if($widget->widget_params->period_compare=='last_period' && isset($widget->elements)){
				$element->timestamp=$element->timestamp+$diff;
		}
	}

	// Setting the timezone
	$joomlaConfig = JFactory::getConfig();
	if(!HIKASHOP_J30)
		$offset = $joomlaConfig->getValue('config.offset');
	else
		$offset = $joomlaConfig->get('offset');		

	date_default_timezone_set(JFactory::getUser()->getParam('timezone', $offset));

	$element->year = date('Y',$element->timestamp);
	$element->month = date('m',$element->timestamp)-1;
	$element->day = date('j',$element->timestamp);
	if($widget->widget_params->date_group=="%H %j %Y"){
		$element->hour = date('G',$element->timestamp);
	}
}

Thanks for your feedback !
Kind regards,
Mohamed

Last edit: 4 years 2 months ago by Mohamed Thelji.
The following user(s) said Thank You: Udo

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

  • Posts: 220
  • Thank you received: 8
4 years 2 months ago #325007

Thanks a lot, Mohamed.

Problem solved!

regards,
Udo

The following user(s) said Thank You: Philip

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

Time to create page: 0.101 seconds
Powered by Kunena Forum