if ($c) { $hiddenCategories[$c['id']] = $c; } } $smarty->assign('catalogMenu', array_merge($hiddenCategories, $catalogMenu)); $smarty->assign('pricelist', cf\Page::get('pricelist')); $smarty->assign('searchPage', cf\Page::get('search')); $pid = 'home'; try { if (array_key_exists('path', $_REQUEST) && strlen($_REQUEST['path'])) { $pathInfo = cf\Page::findByPath($_REQUEST['path']); if (strlen($pathInfo['found'])) { $pid = $pathInfo['page_id']; if (strlen($pathInfo['notfound'])) { $p = cf\Page::get($pid); if (!(cf\Page::isDescendantOf($p, 'catalog') && ($productId = cf\Product::findByPath($pathInfo['notfound']))) && $p['permalink'] != 'articles') { $pid = 'error'; } } } else { $pid = 'error'; } } } catch (Exception $e) { $pid = 'error'; } $page = cf\Page::get($pid); $pageText = cf\api\page\getText($page['id']); $crumbs = array(); foreach ($page['branch'] as $p) { $crumbs[] = array('name' => $p['menu_name'], 'link' => $p['path']);
<?php $p = 1; if (strlen($pathInfo['notfound'])) { $productId = cf\Product::findByPath($pathInfo['notfound']); if ($productId) { require_once dirname(__FILE__) . '/product.php'; return true; } $matches = array(); if (!preg_match('/page-(\\d+)/', $pathInfo['notfound'], $matches)) { return false; } $p = $matches[1]; } $productsOnPage = 9; $params = array('in' => $page['id']); $filter = array(); if (array_key_exists('price', $_REQUEST) && is_array($_REQUEST['price']) && count($_REQUEST['price']) == 2) { $params['price'] = $filter['price'] = $_REQUEST['price']; } if (array_key_exists('attribute', $_REQUEST) && is_array($_REQUEST['attribute'])) { $params['attribute'] = $filter['attribute'] = $_REQUEST['attribute']; } if (array_key_exists('search', $_REQUEST) && strlen(trim($_REQUEST['search']))) { $search = trim($_REQUEST['search']); $params['name'] = $filter['search'] = $search; $page['name'] .= " - поиск: {$search}"; } $smarty->assign('products', cf\api\shop\products(array_merge($params, array('skip' => ($p - 1) * $productsOnPage, 'limit' => $productsOnPage)))); $smarty->assign('numOfProducts', cf\api\shop\count($params));