public function action_post($data = null) { if ($data === null) { $data = $this->request->post(); } $data['customer_id'] = $this->user->id(); return parent::action_post($data); }
public function action_post($data = null) { if ($data === null) { $data = $this->request->post(); } unset($data['password']); unset($data['photoUrl']); return parent::action_post($data); }
public function action_post($data = null) { if ($this->request->param('id')) { throw new HttpException('You can\'t create already existing object.', 400, null, 'Bad Request'); } if ($data === null) { $data = $this->request->post(); } $data['customer_id'] = $this->user->id(); return parent::action_post($data); }
public function action_post($data = null) { if ($data === null) { $data = $this->request->post(); } $data['customer_id'] = $this->user->id(); unset($data['total_price']); unset($data['id']); unset($data['increment_id']); if (!$data['coupon_id']) { $data['coupon_id'] = null; } error_log("Order to be added: " . serialize($data)); return parent::action_post($data); }
public function action_post($data = null) { if ($data === null) { $data = $this->request->post(); } unset($data['id']); if (!$data['product_id'] || !$data['cart_id']) { throw new HttpException(); } // Check whether there is already such a product in the cart $cartItem = $this->pixie->orm->get('CartItems')->where('product_id', '=', $data['product_id'])->where('cart_id', '=', $data['cart_id'])->find(); if ($cartItem->loaded()) { throw new HttpException(); } // Check product is real /** @var Product $product */ $product = $this->pixie->orm->get('product')->where('productID', '=', $data['product_id'])->find(); if (!$product->loaded()) { throw new HttpException(); } $data['price'] = $product->Price; return parent::action_post($data); }