/**
  * cart add product
  * @return Object
  */
 public function procShopToolCartAddProduct()
 {
     $cartRepository = new CartRepository();
     if ($product_srl = Context::get('product_srl')) {
         $productsRepo = new ProductRepository();
         if ($product = $productsRepo->getProduct($product_srl))
         {
             if (!($product instanceof SimpleProduct)) {
                 return new Object(-1, 'msg_invalid_request');
             }
             $logged_info = Context::get('logged_info');
             $cart = $cartRepository->getCart($this->module_info->module_srl, NULL, $logged_info->member_srl, session_id(), TRUE);
             $quantity = (is_numeric(Context::get('quantity')) && Context::get('quantity') > 0 ? Context::get('quantity') : 1);
             try {
                 $cart->addProduct($product, $quantity);
             }
             catch (Exception $e) {
                 return new Object(-1, $e->getMessage());
             }
         }
         else return new Object(-1, 'msg_invalid_request');
     }
     else return new Object(-1, 'msg_invalid_request');
     $shop = $this->model->getShop($this->module_srl);
     $this->setRedirectUrlIfNoReferer(getSiteUrl($shop->domain));
 }
Example #2
0
 public function dispShopMyOrders(){
     $logged_user = Context::get('logged_info');
     if(!isset($logged_user)){
         $this->setTemplateFile('not_logged.html');
         return;
     }
     $orderRepository = $this->model->getOrderRepository();
     $extraParams['order_type'] = 'desc';
     $output = $orderRepository->getList($this->module_info->module_srl,$logged_user->member_srl, $extraParams, Context::get('page'));
     Context::set('orders',$output->data);
     Context::set('page_navigation',$output->page_navigation);
     $this->setTemplateFile('my_orders.html');
 }