} else { $order = 'ORDER BY sort_order ASC'; } unset($url[$n]); unset($current_url_pages[count($current_url_pages) - 1]); } $smarty->assign("dir", $dirs); for ($f = 0; $f < count($cat_list); $f++) { $url_to_check = implode("/", $url) . '/'; if ($cat_list[$f]['full_url'] == $url_to_check) { $cat_content = $cat_list[$f]; $page_found = true; //находим родителя уровня 1 if (!in_array($cat_content['id'], array(TIRES_ID, DISK_ID))) { //$parent = $db->get_single("SELECT id FROM fw_catalogue WHERE param_left < '{$cat_content['param_left']}' and param_right > '{$cat_content['param_right']}' and param_level = '1'"); $parent = $shop->getParent($cat_content); } else { $parent = $cat_content; } if ($cat_content['param_level'] > 2) { $parent2 = $db->get_single("SELECT id FROM fw_catalogue WHERE param_left < '{$cat_content['param_left']}' and param_right > '{$cat_content['param_right']}' and param_level = '2'"); } elseif ($cat_content['param_level'] == 2) { $parent2 = $cat_content; } $smarty->assign('parent', $parent); if (isset($parent2)) { $smarty->assign('parent2', $parent2); } if ($cat_content['title'] != '') { $page_title = $cat_content['title']; } else {
if (!$page_found) { if (preg_match("/^([0-9]+)\$/", $url[$n])) { $product_content = $shop->getProductInfo(intval($url[$n])); if ($product_content['id'] != '') { for ($f = 0; $f < count($cat_list); $f++) { $url_to_check = implode("/", $url) . '/'; if ($cat_list[$f]['full_url'] == '/') { $cat_list[$f]['full_url'] = ''; } if ($cat_list[$f]['full_url'] . $product_content['id'] . '/' == $url_to_check && $product_content['parent'] == $cat_list[$f]['id']) { foreach ($cat_list as $key => $val) { if ($val['param_left'] < $cat_list[$f]['param_left'] && $val['param_right'] > $cat_list[$f]['param_right'] && $val['param_level'] == $cat_list[$f]['param_level'] - 1) { $cat_parent_info = $val; $smarty->assign('cat_parent_info', $cat_parent_info); $smarty->assign('cat_content', $cat_list[$f]); $cat_parent = $shop->getParent($cat_parent_info); $smarty->assign('parent', $cat_parent); } } $page_found = true; if ($product_content['title'] != '') { $page_title = $product_content['title']; } else { $page_title = 'Продукция ' . $product_content['name']; } if ($product_content['meta_keywords'] != '') { $meta_keywords = $product_content['meta_keywords']; } else { $meta_keywords = $page_title; } if ($product_content['meta_description'] != '') {