public function addPages($pages = null, $changefreq = null, $priority = null, $lastmod = null) { $pages = is_array($pages) ? $pages : cf\api\page\getHierarchy(); foreach ($pages as $page) { $this->addUrl($page['link'], $changefreq, $priority, $lastmod); $this->addPages($page['children'], $changefreq, $priority, $lastmod); } }
<?php require_once cf\Config::path . 'api/gallery.php'; $smarty->assign('hitsCategory', cf\api\page\get('hits')); $hits = prepareProducts(cf\api\shop\getProducts('hits', array(), 0, 3)); $smarty->assign('hits', $hits); $smarty->assign('newCategory', cf\api\page\get('new')); $new = prepareProducts(cf\api\shop\getProducts('new', array(), 0, 3)); $smarty->assign('new', $new); $smarty->assign('discountCategory', cf\api\page\get('discount')); $discount = prepareProducts(cf\api\shop\getProducts('discount', array(), 0, 3)); $smarty->assign('discount', $discount); $smarty->assign('products', array_merge($hits, $new, $discount)); $smarty->assign('banners', cf\api\gallery\getImages($page['id'])); $smarty->assign('blocks', cf\api\page\getHierarchy($page['id'], true, 1)); $smarty->assign('newslist', cf\query2arrays("\n\tSELECT IFNULL(code,cf_news.id) AS code,name,image,short_txt \n\tFROM cf_news \n\tINNER JOIN cf_news_in_category ON cf_news.id=cf_news_in_category.news_id\n\tWHERE cf_news_in_category.category_id = :pid\n\tORDER BY dt DESC\n", array('pid' => $page['id'])));
<?php require_once cf\Config::path . 'api/form.php'; require_once cf\Config::path . 'cart.php'; if (cf\api\cart\isempty()) { $page = cf\Page::get('empty'); return; } $orderform = cf\api\form\get('order'); $clientInfo = cf\api\form\results($orderform); if ($clientInfo) { cf\api\cart\add($_REQUEST['delivery']); $payMethod = ''; if ($_REQUEST['pay']) { $paymentPage = cf\Page::get($_REQUEST['pay']); $payMethod = $paymentPage['menu_name']; } $orderId = cf\Cart::order($clientInfo['name'], $clientInfo['email'], $clientInfo['phone'], $clientInfo['address'], $clientInfo['comments'], $payMethod); $smarty->assign('orderId', $orderId); $page = cf\Page::get('success'); } else { $smarty->assign('orderform', $orderform); $smarty->assign('deliveries', cf\api\shop\getProducts('delivery')); $smarty->assign('payment', cf\api\page\getHierarchy('pay', false, 1)); }
<?php try { require_once 'init.php'; function format_price($params, $content) { if (isset($content)) { return number_format($content, 0, '.', ' '); } } $smarty->registerPlugin('block', 'price', 'format_price'); $smarty->assign('topMenu', cf\api\page\getHierarchy(0, false, 1)); $catalogMenu = cf\api\page\getHierarchy('catalog'); $hiddenCategories = array(); foreach (array('hits', 'new', 'discount') as $cid) { $c = cf\Page::get($cid); 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);
<?php $product = cf\api\shop\findProductByPath($productId); $page['name'] = $product['full_name']; $page['title'] = $product['full_name']; $page['keywords'] = $product['name'] . (strlen($product['model']) ? ',' . $product['model'] : ''); $page['descr'] = $product['full_name']; $page['template'] = 'product'; $smarty->assign('categories', cf\api\page\getHierarchy($product['main_category']['branch'][1]['id'], false, 1)); $page['crumbs'][] = array('name' => $product['full_name'], 'link' => ''); $smarty->assign('product', $product); $smarty->assign('related', cf\api\shop\relatedProducts($product['id'], 'catalog'));
} $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)); $smarty->assign('productsOnPage', $productsOnPage); $smarty->assign('p', $p); $smarty->assign('baseURL', strtok($_SERVER["REQUEST_URI"], '?')); $smarty->assign('categories', cf\api\page\getHierarchy(count($page['branch']) > 1 ? $page['branch'][1]['id'] : $page['id'], false, 1)); $smarty->assign('prices', cf\api\shop\prices($params)); $attributes = array(); foreach (cf\api\shop\getCategoryAttributes($page['id']) as $a) { if ($a['isList']) { $attributes[] = $a; } } $smarty->assign('attributes', $attributes); $smarty->assign('filter', $filter); $smarty->assign('query', empty($filter) ? '' : '?' . http_build_query($filter));
<?php require_once 'init.php'; $smarty->assign('pages', cf\api\page\getHierarchy('catalog')); $smarty->assign('products', cf\api\shop\getProducts('catalog')); $smarty->display('prices.yml');
<?php $smarty->assign('hits', cf\api\shop\getProducts('hits')); $smarty->assign('slides', cf\api\page\getHierarchy('slideshow', false, 1)); $smarty->assign('banners', cf\api\page\getHierarchy('banners', false, 1)); $smarty->assign('tabs', cf\api\page\getHierarchy('tabs', false, 1));
<?php header('Content-type: text/html; charset=utf-8'); require_once dirname(__FILE__) . '/cf/config.php'; require_once cf\Config::path . 'param.php'; require_once cf\Config::path . 'image.php'; require_once cf\Config::path . 'api/page.php'; define('SMARTY_DIR', cf\Config::smarty_dir); require_once SMARTY_DIR . 'Smarty.class.php'; $smarty = new Smarty(); $smarty->compile_check = true; $smarty->debugging = false; $smarty->addPluginsDir(cf\Config::path . 'components'); date_default_timezone_set('UTC'); setlocale(LC_ALL, "en_US.utf8"); $smarty->assign('topMenu', cf\api\page\getHierarchy());