Esempio n. 1
0
$brand_id = isset($_REQUEST['brand_id']) ? intval($_REQUEST['brand_id']) : '';
$seltype = isset($_REQUEST['seltype']) ? $_REQUEST['seltype'] : '';
$selweight = isset($_REQUEST['selweight']) ? $_REQUEST['selweight'] : '';
$cat_handler =& xoops_getmodulehandler('category', 'catalog');
$item_handler =& xoops_getmodulehandler('item', 'catalog');
$brand_handler =& xoops_getmodulehandler('brand', 'catalog');
$cat_obj =& $cat_handler->get($cat_id);
if (!is_object($cat_obj) || empty($cat_id) && empty($brand_id)) {
    redirect_header('index.php', 3, _MD_CATALOG_NOCATEGORY);
}
$brand_obj =& $brand_handler->get($brand_id);
if (!is_object($brand_obj) || empty($cat_id) && empty($brand_id)) {
    redirect_header('index.php', 3, _MD_CATALOG_NOBRAND);
}
$category = $cat_obj->getValues(null, 'n');
$xoopsOption['template_main'] = catalog_getTemplate("category", $category['cat_tpl']);
include_once XOOPS_ROOT_PATH . '/header.php';
global $xoopsDB;
$dbnane = $xoopsDB->prefix('catalog_category');
$sql = "select  *  from  {$dbnane} where `cat_id`= '{$cat_id}'";
$result = $xoopsDB->query($sql) or die($sql);
list($cat_id, $cat_name, $cat_unit, $cat_image, $cat_pid, $type_id, $cat_keywords, $cat_description, $isnav, $cat_status, $cat_weight, $cat_level, $cat_properties, $cat_tpl, $cat_tpl_css, $cat_published, $cattext) = $xoopsDB->fetchRow($result);
$xoopsTpl->assign('cattext', $cattext);
$criteria = new CriteriaCompo();
if (!empty($cat_id)) {
    include_once XOOPS_ROOT_PATH . "/class/pagenav.php";
    $ext = 'cat_id=' . $cat_id . '&seltype=' . $seltype . '&selweight=' . $selweight;
    $category_ids = $cat_handler->getTrees($cat_id);
    foreach ($category_ids as $k => $v) {
        $cat_ids[] = $k;
    }
Esempio n. 2
0
$item_obj = $item_handler->get($item_id);
if (!is_object($item_obj)) {
    redirect_header('index.php', 3, _MD_CATALOG_NOTHISITEM);
}
$item = $item_obj->getValues(null, 'n');
$comparison = isset($_REQUEST['comparison']) ? intval($_REQUEST['comparison']) : '';
$action = isset($_REQUEST['action']) ? intval($_REQUEST['action']) : '';
if (!empty($action) && $action == 1) {
    if (!empty($comparison)) {
        item_setcookie("favorites[" . $item_id . "]", $item_id, 3600 * 24);
    } else {
        item_setcookie("favorites[" . $item_id . "]", '', time() - 1);
    }
    redirect_header('item.php?item_id=' . $item_id . '&#A', 3, _MD_CATALOG_SAVED);
}
$xoopsOption['template_main'] = catalog_getTemplate('item', $item['item_tpl']);
include_once XOOPS_ROOT_PATH . '/header.php';
/*
//set pid
if($item['cat_pid']){
    $category_obj = $category_handler->get($item['cat_pid']);
    $item['cat_pname'] = $category_obj->getVar('cat_name');
    $xoBreadcrumbs[] = array("title" => $item['cat_pname'], 'link' =>  'itemlist.php?cat_id='. $item['cat_pid'] );
} else {
    $item['cat_name'] = '沒有選擇類別';
}

//set cid
if($item['cat_id']){
    $category_obj = $category_handler->get($item['cat_id']);
    $item['cat_name'] = $category_obj->getVar('cat_name');