$pdo = db_connect(); $sql = $pdo->prepare("SELECT * FROM `oc_category` INNER JOIN `oc_category_description` ON `oc_category`.`category_id` = `oc_category_description`.`category_id` WHERE parent_id=0"); $sql->execute(); $big_categories = $sql->fetchAll(); $sql = $pdo->prepare("SELECT name, description, status, category_id, image, p.price p_price, p.product_id p_product_id, p.minimum p_minimum, p.cant_buy cant_buy, p.coffee_house_only coffee_house_only FROM `oc_product` p INNER JOIN `oc_product_description` ON p.product_id = `oc_product_description`.product_id INNER JOIN `oc_product_to_category` ON p.product_id = `oc_product_to_category`.product_id ORDER BY cant_buy, sort_order "); $sql->execute(); $prod_list = $sql->fetchAll(); $sql = $pdo->prepare("SELECT * FROM `oc_category` INNER JOIN `oc_category_description` ON `oc_category`.`category_id` = `oc_category_description`.`category_id` WHERE parent_id!=0"); $sql->execute(); $sub_categories = $sql->fetchAll(); function is_available_item($cant_buy) { return $cant_buy < 1; } function get_thumb_image($image_url) { $default_url_image = "/image/catalog/206220738703302.jpg"; if ($image_url) { return '/image/' . $image_url; } return $default_url_image; } function get_href_product($p_product_id) { if ($p_product_id) { return '/image/' . $p_product_id; } } ?> Вафля House - Соленые вафли
//Массив продуктов основной категории //Массив подкатегорий (Название подкатегории, массив продуктов этой подкатегории) //Useless Code