4

Currently building an extension that creates orders programmatically following this guide. I have also added on a section to create an invoice for each order following this guide.

All working as expected and tested. An order is created, along with an invoice.

However, the dashboard statistics revenue counter stays at zero, despite the number of orders counter going up as new orders are created.

My question, is what does it take for the dashboard counter to accept an order as revenue, if an invoice exists?

  • Have you tried creating an order using the built-in checkout process to compare the attributes of that order to the attributes of the orders you're programmatically creating? I've run into this issue myself and have an idea of how you might approach it, but want to make sure I know where you are at in the troubleshooting process...also, how are you creating the orders? via external API's like SOAP or WebServices or via PHP by setting up an application context just outside of the standard Magento UI? – Bryan 'BJ' Hoffpauir Jr. Jun 24 '15 at 21:45
2

Fixed this by going back through the core code and finding what it was that the dashboard stats is calculated from.

Theres a mathematical calculation that works it all out, but at the end of it it multiplies it by something called the 'Base to global rate'. This is so that the dashboard stats show the statistics correctly converted.

Wasn't too much of a problem for me me because my base currency and my global currency were the same so i just added this while programatically creating an order:

$order->setBaseToGlobalRate(1)

That should solve it, if your currencies differ, you are going to have to put a conversion rate in here.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.