<?php require_once 'init.php'; require_once cf\Config::path . 'api/shop.php'; $search = $_REQUEST['search']; $smarty->assign('search', $search); $smarty->assign('products', \cf\api\shop\getProducts(\cf\Group::rootId, array(), array(), array(), $search)); $smarty->assign('pages', \cf\api\page\search($search)); show('search', 'Результаты поиска');
<?php require_once 'init.php'; require_once cf\Config::path . 'api/shop.php'; try { $cat = cf\Group::get(cf\param::get('id')); } catch (Exception $e) { Header('Location: /error'); exit; } $smarty->assign('pageText', $cat->descr()); $smarty->assign('pageId', cf\api\page\getID('products')); $products = cf\api\shop\getProducts($cat->id()); foreach ($products as &$product) { $info = cf\api\shop\getProduct($product[0]); $product['attributes'] = $info['attributes']; } $smarty->assign('products', $products); show('category', $cat->name(), array(), $cat->pageTitle(), $cat->pageKeywords(), $cat->pageDescr());
<?php $productsOnPage = 33; $p = array_key_exists('page', $_REQUEST) ? (int) $_REQUEST['page'] : 1; $products = array(); if ($page['code'] == 'catalog') { $products = cf\api\shop\getProducts($page['id'], array('hits', 'new', 'discount'), ($p - 1) * $productsOnPage, $productsOnPage); } else { $products = cf\api\shop\getProducts($page['id'], array(), ($p - 1) * $productsOnPage, $productsOnPage); } $smarty->assign('products', prepareProducts($products)); if ($page['code'] == 'catalog') { $smarty->assign('numOfProducts', cf\api\shop\countProducts($page['id'], array('hits', 'new', 'discount'))); } else { $smarty->assign('numOfProducts', cf\api\shop\countProducts($page['id'])); } $smarty->assign('productsOnPage', $productsOnPage); $smarty->assign('p', $p); $smarty->assign('baseURL', strtok($_SERVER["REQUEST_URI"], '?'));
<?php $search = $_REQUEST['search']; $smarty->assign('search', $search); $smarty->assign('products', cf\api\shop\getProducts(null, array(), null, null, array(), array(), '', $search)); $page['name'] .= ": {$search}";
<?php require_once 'init.php'; require_once cf\Config::path . 'api/shop.php'; $page = cf\api\page\get('products'); $smarty->assign('pageId', $page['id']); $smarty->assign('pageText', cf\api\page\getText($page['id'])); $categories = cf\api\shop\getCategoriesTree(); $smarty->assign('categories', $categories); $products = array(); foreach ($categories as $cat) { $products[$cat['id']] = cf\api\shop\getProducts($cat['id']); foreach ($products[$cat['id']] as &$product) { $info = cf\api\shop\getProduct($product[0]); $product['attributes'] = $info['attributes']; } } $smarty->assign('products', $products); $smarty->assign('reviews', cf\query2arrays("SELECT author, review FROM reviews ORDER BY sort_order LIMIT 4")); show('products', $page['name'], array(), $page['title'], $page['keywords'], $page['descr']);
<?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 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));