pageMessage("EMPTY_CART", false); $this->redirect($this->url->linkmessage()); } else{ $cart = array(); $sum = 0; $ids = explode(",", $_SESSION["id"]); $cart = $this->product->selectOnIDs($ids, "`price`, `title`, `id`, `img`"); for($i = 0; $i < count($cart); $i++){ $cart[$i]["del_cart"] = $this->url->delCart($cart[$i]["id"]); $cart[$i]["img"] = $this->config->dir_img.$cart[$i]["img"]; $cart[$i]["count"] = $this->getCount($ids, $cart[$i]["id"]); $cart[$i]["sum"] = $cart[$i]["count"] * $cart[$i]["price"]; $sum += $cart[$i]["sum"]; } if($_SESSION["discont"]){ $sum *= 1 - $this->discount->getDiscont($_SESSION["discont"]); } } $this->template->set("cart", $cart); $this->template->set("sum", $sum); $this->template->set("link_order", $this->url->order()); return "cart"; } private function getCount ($ids, $id) { $count = 0; for($i = 0; $i < count($ids); $i ++) if($id == $ids[$i]) $count++; return $count; } } ?>