public function actionItem() { $basket_ob = new BasketModel(); // Создаем проверку на тип запроса if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_POST['quantity'] == 0) { $error_message = array('show', 'Количество не может быть равным 0'); } else { $res = $basket_ob->addToBasket($_POST['id'], $_POST['quantity'], $_POST['price']); $error_message = $res; } } else { $error_message = array('hidden', ''); } $link = $this->LinkExplode(); // Получаем данные для корзины $basket = $basket_ob->getBasket(); // Запускаем проверку на реальность параметров в базе $product = $this->checkParam($link[1], 'products'); if (empty($product)) { die("Такого товара не существует!"); } else { $labelprod = new ProductLabelModel(); $slabel_items = $labelprod->getLabelProducts(0, 6); // Создаем шаблон и передаем ему нужные переменные $left_content = $this->template('/main/tpl_left.php', array('categories' => $this->catmenu->showMenu())); $random_module = $this->template('/main/tpl_new_sales.php', array('stitle' => 'Сопутствующие товары', 'sitems' => $slabel_items)); $right_content = $this->template('/main/tpl_product.php', array('product' => $product[0], 'error_message' => $error_message, 'random_module' => $random_module)); $tmp = $this->template('/main/tpl_main.php', array('title' => $product[0]->name_ru, 'top_menu' => $this->top_menu, 'basket' => array('quantity' => $basket[0], 'price' => $basket[1]), 'left_content' => $left_content, 'right_content' => $right_content, 'fmenu' => $this->footer_menu)); echo $tmp; } }