Ejemplo n.º 1
0
<?php

if (strlen($pathInfo['notfound'])) {
    $news = cf\query2array("\n\t\tSELECT * FROM cf_news WHERE id=:id OR code=:id", array('id' => $pathInfo['notfound']));
    $page['keywords'] = $news['tag_meta_keywords'];
    $page['descr'] = $news['tag_meta_descr'];
    $page['title'] = $news['tag_title'];
    $page['name'] = $news['name'];
    $page['template'] = 'article';
    $crumbs[] = array('name' => $news['name']);
    $pageText = $news['txt'];
    $productIDs = cf\query2vector("\n\t\tSELECT product_id AS id FROM cf_products_in_news WHERE news_id=:newsid ORDER BY sort_order\n\t", array('newsid' => $news['id']));
    $products = array();
    foreach ($productIDs as $pid) {
        $products[] = cf\api\shop\getProduct($pid);
    }
    $smarty->assign('products', prepareProducts($products));
    return true;
}
$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'])));
Ejemplo n.º 2
0
<?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());
Ejemplo n.º 3
0
<?php

require_once 'init.php';
require_once cf\Config::path . 'api/shop.php';
$page = cf\api\page\get(cf\param::get('id'));
if (!$page) {
    $page = cf\api\page\get('error');
}
$smarty->assign('pageText', cf\api\page\getText($page['id']));
$smarty->assign('pageId', $page['depth'] <= 2 ? $page['id'] : $page['parent']['id']);
$crumbs = array();
foreach ($page['branch'] as $p) {
    $crumbs[] = array('name' => $p['menu_name'], 'link' => $p['path']);
}
$smarty->assign('children', cf\api\page\getTree($page['id'], false, 1, '/articles'));
if ($page['parent']['code'] == 'articles') {
    $smarty->assign('isarticle', true);
    $products = array();
    foreach (cf\query2vector("SELECT product_id FROM products_in_articles WHERE article_id=:aid", array('aid' => $page['id'])) as $pid) {
        $p = cf\api\shop\getProduct($pid);
        $p[] = $p['id'];
        $p[2] = $p['name'];
        $p[8] = $p['price'];
        $p[14] = $p['article'];
        $p[15] = $p['state_id'];
        $p[16] = $p['state'];
        $products[] = $p;
    }
    $smarty->assign('products', $products);
}
show($page['code'] == 'faq' ? 'faq' : 'page', $page['name'], $crumbs, $page['title'], $page['keywords'], $page['descr']);