I'm using V 3.0.4.0.
Is there a cron job that I can create to keep statistics up to date? I have to manually go into statistics and update all of them at the moment and the "Order Sales" total is always higher than the actual value until I manually update it.
Thanks.
Matt
Unless using OC v4.x releases, it requires an extension.mattltm wrote: ↑Sat Apr 06, 2024 11:21 pmI'm using V 3.0.4.0.
Is there a cron job that I can create to keep statistics up to date? I have to manually go into statistics and update all of them at the moment and the "Order Sales" total is always higher than the actual value until I manually update it.
Thanks.
Matt
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
You could create an OCMOD where you:
add:
in function index() just before:
then add a new function:
all in file:
admin/controller/report/statistics.php
that would do all updates whenever you visit that page prior to displaying the list..
add:
Code: Select all
$this->refresh_all();
Code: Select all
$this->getList();
Code: Select all
private function refresh_all () {
if ($this->validate()) {
$this->load->model('sale/order');
$this->model_report_statistics->editValue('order_sale', $this->model_sale_order->getTotalSales(array('filter_order_status' => implode(',', array_merge($this->config->get('config_complete_status'), $this->config->get('config_processing_status'))))));
$this->model_report_statistics->editValue('order_processing', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $this->config->get('config_processing_status')))));
$this->model_report_statistics->editValue('order_complete', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $this->config->get('config_complete_status')))));
$this->load->model('localisation/order_status');
$order_status_data = array();
$results = $this->model_localisation_order_status->getOrderStatuses();
foreach ($results as $result) {
if (!in_array($result['order_status_id'], array_merge($this->config->get('config_complete_status'), $this->config->get('config_processing_status')))) {
$order_status_data[] = $result['order_status_id'];
}
}
$this->load->model('sale/order');
$this->model_report_statistics->editValue('order_other', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $order_status_data))));
$this->load->model('sale/return');
$this->model_report_statistics->editValue('return', $this->model_sale_return->getTotalReturns(array('filter_return_status_id' => $this->config->get('config_return_status_id'))));
$this->load->model('customer/customer');
$this->model_report_statistics->editValue('customer', $this->model_customer_customer->getTotalCustomers(array('filter_approved' => 0)));
$this->model_report_statistics->editValue('affiliate', $this->model_customer_customer->getTotalAffiliates(array('filter_approved' => 0)));
$this->load->model('catalog/product');
$this->model_report_statistics->editValue('product', $this->model_catalog_product->getTotalProducts(array('filter_quantity' => 0)));
$this->load->model('catalog/review');
$this->model_report_statistics->editValue('review', $this->model_catalog_review->getTotalReviews(array('filter_status' => 0)));
$this->session->data['success'] = $this->language->get('text_success');
}
}
admin/controller/report/statistics.php
that would do all updates whenever you visit that page prior to displaying the list..
Who is online
Users browsing this forum: No registered users and 16 guests