Beispiel #1
0
        $crumbs[] = array('name' => $p['menu_name'], 'link' => $p['path']);
    }
    if (!strlen($page['template'])) {
        if (cf\Page::isDescendantOf($page, 'catalog')) {
            $page['template'] = 'category';
        } else {
            $page['template'] = 'page';
            //resolveTemplate($page['parent_id']);
        }
    }
    function includePage(&$page, &$crumbs, $pathInfo)
    {
        global $smarty;
        return require_once dirname(__FILE__) . '/' . $page['template'] . '.php';
    }
    $pageFound = false;
    if (file_exists(dirname(__FILE__) . '/' . $page['template'] . '.php')) {
        $pageFound = includePage($page, $crumbs, $pathInfo);
    }
    if (strlen($pathInfo['notfound']) && !$pageFound) {
        $page = cf\Page::get('error404');
        includePage($page, $crumbs, $pathInfo);
    }
    $smarty->assign('page', $page);
    $smarty->assign('crumbs', $crumbs);
    $tpl = file_exists(dirname(__FILE__) . '/templates/' . $page['template'] . '.tpl') ? $page['template'] : 'page';
    $smarty->display("{$tpl}.tpl");
} catch (Exception $e) {
    header("Location: /error404");
    exit;
}
Beispiel #2
0
<?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));
}
Beispiel #3
0
<?php

require_once cf\Config::path . 'api/form.php';
$feedback = cf\api\form\get('feedback');
if (cf\api\form\send($feedback)) {
    $page = cf\Page::get('sent');
    return;
}
$smarty->assign('feedback', $feedback);
Beispiel #4
0
                    }
                }
            } 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']);
    }
    if (cf\Page::isDescendantOf($page, 'catalog')) {
        $page['template'] = $productId ? 'product' : 'category';
    }
    if (strlen($page['template']) && file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $page['template'] . '.php')) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/' . $page['template'] . '.php';
    }
    $tpl = 'page';
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/templates/' . $page['code'] . '.tpl')) {
        $tpl = $page['code'];
    }
    $smarty->assign('page', $page);
    $smarty->assign('pageText', $pageText);
    $smarty->assign('crumbs', $crumbs);
    $smarty->assign('cart', cf\api\cart\getList());
    $smarty->display((strlen($page['template']) ? $page['template'] : $tpl) . '.tpl');
} catch (Exception $e) {
Beispiel #5
0
 /**
 	Get products that belong to ANY group in the set
 	@param  $groupIDs          array of IDs/CODEs or sigle number ID/string CODE
 */
 function __construct($catIDs = false)
 {
     if ($catIDs) {
         $catIDs = $this->parseIDs($catIDs);
     } else {
         $catIDs = cf\Page::descendantIDs(null, true);
     }
     $this->sqlWhere['(cf_products.enabled_from IS NULL OR NOW() >= cf_products.enabled_from)'] = 1;
     $this->sqlWhere['(cf_products.enabled_to IS NULL OR NOW() < cf_products.enabled_to)'] = 1;
     $this->sqlJoin["INNER JOIN cf_products_in_category ON cf_products.id = cf_products_in_category.product_id"] = 1;
     $this->sqlWhere["page_id IN (" . implode(',', $catIDs) . ")"] = 1;
 }