statistics.php (2661B)
1 <?php 2 class ControllerEventStatistics extends Controller { 3 // model/catalog/review/addReview/after 4 public function addReview(&$route, &$args, &$output) { 5 $this->load->model('report/statistics'); 6 7 $this->model_report_statistics->addValue('review', 1); 8 } 9 10 // model/account/return/addReturn/after 11 public function addReturn(&$route, &$args, &$output) { 12 $this->load->model('report/statistics'); 13 14 $this->model_report_statistics->addValue('return', 1); 15 } 16 17 // model/checkout/order/addOrderHistory/before 18 public function addOrderHistory(&$route, &$args, &$output) { 19 $this->load->model('checkout/order'); 20 21 $order_info = $this->model_checkout_order->getOrder($args[0]); 22 23 if ($order_info) { 24 $this->load->model('report/statistics'); 25 26 // If order status in complete or proccessing add value to sale total 27 if (in_array($args[1], array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status')))) { 28 $this->model_report_statistics->addValue('order_sale', $order_info['total']); 29 } 30 31 // If order status not in complete or proccessing remove value to sale total 32 if (!in_array($args[1], array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status')))) { 33 $this->model_report_statistics->removeValue('order_sale', $order_info['total']); 34 } 35 36 // Remove from processing status if new status is not array 37 if (in_array($order_info['order_status_id'], $this->config->get('config_processing_status')) && !in_array($args[1], $this->config->get('config_processing_status'))) { 38 $this->model_report_statistics->removeValue('order_processing', 1); 39 } 40 41 // Add to processing status if new status is not array 42 if (!in_array($order_info['order_status_id'], $this->config->get('config_processing_status')) && in_array($args[1], $this->config->get('config_processing_status'))) { 43 $this->model_report_statistics->addValue('order_processing', 1); 44 } 45 46 // Remove from complete status if new status is not array 47 if (in_array($order_info['order_status_id'], $this->config->get('config_complete_status')) && !in_array($args[1], $this->config->get('config_complete_status'))) { 48 $this->model_report_statistics->removeValue('order_complete', 1); 49 } 50 51 // Add to complete status if new status is not array 52 if (!in_array($order_info['order_status_id'], $this->config->get('config_complete_status')) && in_array($args[1], $this->config->get('config_complete_status'))) { 53 $this->model_report_statistics->addValue('order_complete', 1); 54 } 55 } 56 } 57 }