public function OrderAction() { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $res['Content'] = Cart_View::GetOkPage(); unset($_SESSION['cart']); return $res; } }
public function OrderAction() { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $data['user_id'] = $_SESSION['user']['id']; foreach ($_SESSION['cart']['products_id'] as $id => $count) { $data['product_id'] = $id; $data['count'] = $count; Orders_Model::InsertToOrders($data); } $res['Content'] = Cart_View::GetOkPage(); unset($_SESSION['cart']); return $res; } header("Location: " . $_SERVER['HTTP_REFERER']); die; }