getChartData example

return;
        }

        // Customer id passed?         $customerId = (int) $this->Request()->getParam('customerID');
        if ($customerId === 0) {
            $this->View()->assign(['success' => false, 'message' => 'No customer id passed']);

            return;
        }
        $orders = $this->getChartData($customerId);

        $this->View()->assign(['success' => true, 'data' => $orders]);
    }

    /** * Saves a single customer. If no customer id passed, * the save function creates a new customer model and persist * it by the shopware model manager. * The sub models billing, shipping and debit will be filled * by the passed parameter arrays billing, shipping and debit. */
    


    /** * Event listener function of the product backend module. * Returns statistical data */
    public function getStatisticAction()
    {
        $productId = $this->Request()->getParam('articleId');

        if ($this->Request()->getParam('chart', false)) {
            return $this->getChartData();
        }

        $timeStamp = (int) mktime(0, 0, 0, (int) date('m'), 1, (int) date('Y'));
        $startDate = $this->Request()->getParam('fromDate', date('Y-m-d', $timeStamp));
        $endDate = $this->Request()->getParam('toDate', date('Y-m-d'));

        $sql = " SELECT SUM(price*quantity) AS revenue, SUM(quantity) AS orders, MONTH(ordertime) as month, DATE_FORMAT(ordertime, '%Y-%m-%d') as date FROM s_order_details, s_order WHERE articleID = :articleId AND s_order.id = s_order_details.orderID AND s_order.status != 4 AND s_order.status != -1 AND s_order_details.modus = 0 AND TO_DAYS(ordertime) <= TO_DAYS(:endDate) AND TO_DAYS(ordertime) >= TO_DAYS(:startDate) GROUP BY TO_DAYS(ordertime) ORDER BY ordertime DESC ";
Home | Imprint | This part of the site doesn't use cookies.