Jump to content
zumbador

Dashboard shows zero sales

Recommended Posts

Hi, are there any new suggestions about how to get the dashboard to show sales volume. mine is at zero. The graphs seem to be working ok as well as the Orders, Cart Value,Visits and Conversion Rate. I have tried everything icould find on teh forum to no avail. Prestashop v1.6.1.1

Share this post


Link to post
Share on other sites

I'm having the same issue. Just started today. Not sure what's going on. All my sales stats say Zero except visits and conversion rate. The graph is working just fine. 

Share this post


Link to post
Share on other sites

i see seems like its a module bug

if you will downgrade it, do you see the same problems?

Share this post


Link to post
Share on other sites

I would try that but I am not sure which module it actually is and dont see a "downgrade" function within the right-click options.

Share this post


Link to post
Share on other sites

Hi,

 

Easiest way I found to downgrade this module besides using a backup  --- download latest PS version 1.6.1.1 to your PC --- Extract on PC  ----  Go to Modules folder --- find and use the dashtrends module (0.7.5) from this download to replace the updated 0.8 version on your web server.

 

Don't update it until fixed. (It should show version 0.7.5 in BO Modules now)

 

I have done above and all working fine now.

It's missing the improvements added (ex tax wording and decimal point) but it shows Sales, Cart Value and Profit. 

Share this post


Link to post
Share on other sites

Yeah, there's definitely a bug in the newest version.  I just found an old version and replaced the updated module and it's working again.  Does anyone test this stuff?  :) #getyourshittogether  #dashtrends

  • Like 2

Share this post


Link to post
Share on other sites

I found this post and few similar other that Prestashop doesn't show sales statistics. I am experiencing the same problem even after upgrading Dashboard trends module to v0.8.1.
I only see stats for orders that has invoice generated. I don't generate invoice for all orders, but I need to see statistics.

I have two store - one is 1.6.0.9 and other 16.1.1 both are having the same problem with sales statistics.

Does anybody has any clue how to enable sales statistics for all orders, not just for those with invoices?

Share this post


Link to post
Share on other sites

Why does dashtrends not calc net profit from wholesale proce - price - fees? And still count in some Average gross margin percentage?

Share this post


Link to post
Share on other sites

in statistics you see proper sales count?

Hello,

 

I am having this problem and it isn't recording in the sales count in statistics either. The only thing I had changed prior to this problem starting is a timezone as the time was an hour out since daylight savings here in the UK. I read somewhere else that I had to change the time zone, now sales numbers are not recorded anywhere, but the orders are being taken. 

 

I am on 1.6.1.1

 

Thanks for looking. 

 

EDIT: 

 

Ignore this. I just remembered that I had also changed the settings so an invoice is only available after shipment where as I allowed it from the initial order so this may be the issue. We wouldn't have shipped anything over the weekend so that wouldn't show on our sales now. 

Edited by djpat99 (see edit history)

Share this post


Link to post
Share on other sites

I dont know if this module will ever work/be fixed.  For as long as I have used Prestashop, it hasnt worked correctly: never has correct month.

  • Like 1

Share this post


Link to post
Share on other sites
On 18/10/2017 at 2:49 PM, Israel A Santos said:

I have the same problem... downgrade did not work

The problem started on 2017-10-16

All days prior to 16 are ok

16,17 and 18 = 0 sales :/

 

- In AdminStats > Sales and Orders = ok ( click here and see print )

- In DashboardError ( click here and see print )

 

Prestashop 1.6.1.17

 

Hi! We have the same problem. It started at 2017-10-16 too. And 0 sales,, 0 visits, 0 all, however we have sales!  Did you find a solution?

PS 1.6.0.9

Share this post


Link to post
Share on other sites
Posted (edited)

Tested in Prestashop 1.7.5.1, but probably same problem happens on other versions:

Looking at the code, the problem is quite obvious. Prestashop assumes that  "orders.invoice_date" is present. So if the invoice date is not set on your orders (let say you have disabled the invoices), the query won't find any records to sum, thus in some cases you get $0, or less than you expect.

I fixed it by replacing invoice_date with "date_add" which is the date when the order is created. Also the query checks if the order is valid.

With this fix there's no need to depend on invoices anymore.

What to do:

You need to update get getTotalSales method in:
controllers/admin/AdminStatsController.php

With:
 

public static function getTotalSales($date_from, $date_to, $granularity = false)
    {
        if ($granularity == 'day') {
            $sales = array();
            $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
                '
			SELECT LEFT(`date_add`, 10) AS date, SUM(total_products / o.conversion_rate) AS sales
			FROM `' . _DB_PREFIX_ . 'orders` o
			LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON o.current_state = os.id_order_state
			WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" AND os.logable = 1 AND `valid` = 1
			' . Shop::addSqlRestriction(false, 'o') . '
			GROUP BY LEFT(`date_add`, 10)'
            );
            foreach ($result as $row) {
                $sales[strtotime($row['date'])] = $row['sales'];
            }

            return $sales;
        } elseif ($granularity == 'month') {
            $sales = array();
            $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
                '
			SELECT LEFT(`date_add`, 7) AS date, SUM(total_products / o.conversion_rate) AS sales
			FROM `' . _DB_PREFIX_ . 'orders` o
			LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON o.current_state = os.id_order_state
			WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" AND os.logable = 1 AND `valid` = 1
			' . Shop::addSqlRestriction(false, 'o') . '
			GROUP BY LEFT(`date_add`, 7)'
            );
            foreach ($result as $row) {
                $sales[strtotime($row['date'] . '-01')] = $row['sales'];
            }

            return $sales;
        } else {
            return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
                '
			SELECT SUM(total_products / o.conversion_rate)
			FROM `' . _DB_PREFIX_ . 'orders` o
			LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON o.current_state = os.id_order_state
			WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" AND os.logable = 1 AND `valid` = 1
			' . Shop::addSqlRestriction(false, 'o')
            );
        }
    }

 

Same thing happens with # of Orders, so here's the code (also in AdminStatsController.php😞

public static function getOrders($date_from, $date_to, $granularity = false)
    {
        if ($granularity == 'day') {
            $orders = array();
            $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
                '
			SELECT LEFT(`date_add`, 10) AS date, COUNT(*) AS orders
			FROM `' . _DB_PREFIX_ . 'orders` o
			LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON o.current_state = os.id_order_state
			WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" AND os.logable = 1 AND `valid` = 1
			' . Shop::addSqlRestriction(false, 'o') . '
			GROUP BY LEFT(`date_add`, 10)'
            );
            foreach ($result as $row) {
                $orders[strtotime($row['date'])] = $row['orders'];
            }

            return $orders;
        } elseif ($granularity == 'month') {
            $orders = array();
            $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
                '
			SELECT LEFT(`date_add`, 7) AS date, COUNT(*) AS orders
			FROM `' . _DB_PREFIX_ . 'orders` o
			LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON o.current_state = os.id_order_state
			WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" AND os.logable = 1 AND `valid` = 1
			' . Shop::addSqlRestriction(false, 'o') . '
			GROUP BY LEFT(`date_add`, 7)'
            );
            foreach ($result as $row) {
                $orders[strtotime($row['date'] . '-01')] = $row['orders'];
            }

            return $orders;
        } else {
            $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
                '
			SELECT COUNT(*) AS orders
			FROM `' . _DB_PREFIX_ . 'orders` o
			LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON o.current_state = os.id_order_state
			WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" AND os.logable = 1 AND `valid` = 1
			' . Shop::addSqlRestriction(false, 'o')
            );
        }

        return $orders;
    }


Hope it helps. Good luck.

 

Edited by Mercader Virtual (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More