public function execute()
 {
     $lazy = waRequest::get('lazy', 0, waRequest::TYPE_INT);
     $offset = waRequest::get('offset', 0, waRequest::TYPE_INT);
     $limit = 30;
     $model = new shopDiscountcardsPluginOrderModel();
     $sql = "SELECT count(*) " . $this->getSql();
     $total_count = (int) $model->query($sql)->fetchField();
     $sql = "SELECT * " . $this->getSql() . " LIMIT {$offset}, {$limit}";
     $discountcards_orders = $model->query($sql)->fetchAll();
     $discountcards_model = new shopDiscountcardsPluginModel();
     $order_model = new shopOrderModel();
     $workflow = new shopWorkflow();
     foreach ($discountcards_orders as &$discountcards_order) {
         $order = $order_model->getOrder($discountcards_order['order_id']);
         $discountcards_order['order'] = $order;
         $discountcards_order['order_id_encode'] = shopHelper::encodeOrderId($order['id']);
         if ($discountcard = $discountcards_model->getByField('discountcard', $discountcards_order['discountcard'])) {
             $discountcards_order['_discountcard'] = $discountcard;
         }
         $discountcards_order['state'] = $workflow->getStateById($order['state_id']);
     }
     unset($discountcards_order);
     $this->view->assign(array('discountcards_orders' => $discountcards_orders, 'offset' => $offset, 'limit' => $limit, 'count' => count($discountcards_orders), 'total_count' => $total_count, 'lazy' => $lazy));
 }
コード例 #2
0
    public function backendOrder($order)
    {
        if ($this->getSettings('status')) {
            $discountcard_order_model = new shopDiscountcardsPluginOrderModel();
            if ($discountcard_order = $discountcard_order_model->getByField('order_id', $order['id'])) {
                $html = <<<HTML
<p>
    <h3><span class="gray">Дисконтная карта:</span><strong> {$discountcard_order['discountcard']} ({$discountcard_order['discount']}%)</strong></h3>
</p>
HTML;
                return array('info_section' => $html);
            }
        }
    }