Dashboard orders this month

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
1 year 9 months ago #348940

-- HikaShop version -- : 4.7.1
-- Joomla version -- : 4.2.7
-- PHP version -- : 8.0

Hi,

I just updated to version 4.7.1. In the backend dashboard the "orders this month" is showing the wrong amount, looks like "orders this year".

Regards,
Michel.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 9 months ago #348947

Hi,

Which version of HikaShop were you using before ?
We didn't change anything to the dashboard since April 2021, so if you had a more recent version of HikaShop, updating HikaShop shouldn't change anything, which might point to another issue.
Also, looking at the code on our end, it still looks correct:

		$ret['sales_sum'] = array(
			'slot' => 0,
			'order' => 1,
			'published' => 1,
			'class' => 'hkc-lg-3 hkc-sm-6',
			'label' => JText::_('HIKA_STATS_ORDERS_THIS_MONTH'),

			'format' => 'price',
			'type' => 'tile',
			'tile' => array(
				'icon' => array('type' => 'fa', 'value' => 'credit-card'),
				'view' => hikashop_completeLink('order&task=listing'),
			),
			'vars' => array(
				'DATE_RANGE' => 'past.month',
			),
			'query' => array(
				'get' => 'list',
				'select' => array(
					'SUM(hk_order.order_full_price) as value',
					'hk_order.order_currency_id as currency'
				),
				'tables' => hikashop_table('order') . ' AS hk_order ',
				'filters' => array(
					'order_type' => 'hk_order.order_type = '.$order_type.'',
					'order_status' => ('hk_order.order_status IN ('.implode(',', $valid_order_statuses).')'),
					'order_created' => ($created_status ?
						'hk_order.order_created >= {DATE_START} AND ({DATE_END} <= 0 OR hk_order.order_created <= {DATE_END})':
						'hk_order.order_invoice_created >= {DATE_START} AND ({DATE_END} <= 0 OR hk_order.order_invoice_created <= {DATE_END})'),
				),
				'group' => 'hk_order.order_currency_id'
			)
		);
This is from the file administrator/components/com_hikashop/classes/statistics.php
As you can see, the DATE_RANGE is set to past.month
So I don't see how it could be a whole year. What is could be is that it doesn't take into account the correct order statuses because of how the statuses are configured under the "Statistics" column of the System>Order statuses menu. Could you check these ?

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

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
1 year 9 months ago #348951

Hi Nicolas,

Version 4.7.0. Thanks for your reply.

I've changed it again to this.month, the update has overwritten the changed file I think. But the amount displayed is not the amount of the past 3 days in februari 2023.

In the statuses I only have activated the paid or shipped statuses.

The amount for februari should show € 451.85 but the dashboard shows € 1732,94. If I change DATE_RANGE in statistics.php to this.week the amount shown is € 1887,78.

Something is going wrong?

Last edit: 1 year 9 months ago by michelpouli.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 9 months ago #348955

Hi,

That's really strange. I don't see how that could be possible.
Could you provide a backend and a FTP access so that we could check the situation ?

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

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
1 year 9 months ago #349032

HI,

Yes, I've sended you the credentials through pm.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 9 months ago #349048

Hi,

I've created a mass action for you to see the orders taken into account since the beginning of february :
i.imgur.com/RkjXMoi.png
As you can see, all the orders there combined give the total amount 2437.47
And that's the exact amount I can see in the dashboard, after changing past.month to this.month in the code with the FTP access provided:
i.imgur.com/pZXzz90.png
So to me it works just fine.

The problem is probably what you said "The amount for februari should show € 451.85". I suppose you manually looked at the orders in the orders listing. However, the problem is that you're not not looking at the same thing. On the orders listing, the date you see is when the order was created (order_created). The date taken into account by the statistics is the date of the confirmation of the order (order_invoice_created), when the order was paid. As you can see in my screenshot, half of the orders taken into account for the sum were created in January but paid in February. And that's why you get that huge difference between what you expect and the number you calculated by HikaShop.

That's actually the main reason why we chose to use past.month (the last 30 days) instead of this.month. Because merchants would come to us telling us the number was wrong when in fact it wasn't.
With past.month, it's always the last 30 days and thus it's more consistent with what they believe the number should be.

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

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
1 year 9 months ago #349070

HI,

Thanks for your explanation, I understand now what's happening.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum