Beispiel #1
1
    $page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
    $pages = ceil($num / $page_num);
    if ($page <= 0) {
        $page = 1;
    }
    if ($pages == 0) {
        $pages = 1;
    }
    if ($page > $pages) {
        $page = $pages;
    }
    $i = 1;
    foreach ($cat_goods['goods'] as $goods_data) {
        if ($i > $page_num * ($page - 1) && $i <= $page_num * $page) {
            $price = empty($goods_info['promote_price_org']) ? $goods_data['shop_price'] : $goods_data['promote_price'];
            //$wml_data .= "<a href='goods.php?id={$goods_data['id']}'>".encode_output($goods_data['name'])."</a>[".encode_output($price)."]<br/>";
            $data[] = array('i' => $i, 'price' => encode_output($price), 'id' => $goods_data['id'], 'name' => encode_output($goods_data['name']));
        }
        $i++;
    }
    $smarty->assign('goods_data', $data);
    $pagebar = get_wap_pager($num, $page_num, $page, 'category.php?c_id=' . $c_id, 'page');
    $smarty->assign('pagebar', $pagebar);
}
$pcat_array = get_parent_cats($c_id);
if (!empty($pcat_array[1]['cat_name'])) {
    $pcat_array[1]['cat_name'] = encode_output($pcat_array[1]['cat_name']);
    $smarty->assign('pcat_array', $pcat_array[1]);
}
$smarty->assign('footer', get_footer());
$smarty->display('category.wml');
/**
 * 取得当前位置和页面标题
 *
 * @access  public
 * @param   integer     $cat    分类编号(只有商品及分类、文章及分类用到)
 * @param   string      $str    商品名、文章标题或其他附加的内容(无链接)
 * @return  array
 */
function assign_ur_here($cat = 0, $str = '')
{
    /* 判断是否重写,取得文件名 */
    $cur_url = basename(PHP_SELF);
    if (intval($GLOBALS['_CFG']['rewrite'])) {
        $filename = strpos($cur_url, '-') ? substr($cur_url, 0, strpos($cur_url, '-')) : substr($cur_url, 0, -4);
    } else {
        $filename = substr($cur_url, 0, -4);
    }
    /* 初始化“页面标题”和“当前位置” */
    $page_title = $GLOBALS['_CFG']['shop_title'];
    $ur_here = '<a href=".">' . $GLOBALS['_LANG']['home'] . '</a>';
    /* 根据文件名分别处理中间的部分 */
    if ($filename != 'index') {
        /* 处理有分类的 */
        if (in_array($filename, array('category', 'goods', 'article_cat', 'article', 'brand'))) {
            /* 商品分类或商品 */
            if ('category' == $filename || 'goods' == $filename || 'brand' == $filename) {
                if ($cat > 0) {
                    $cat_arr = get_parent_cats($cat);
                    $key = 'cid';
                    $type = 'category';
                } else {
                    $cat_arr = array();
                }
            } elseif ('article_cat' == $filename || 'article' == $filename) {
                if ($cat > 0) {
                    $cat_arr = get_article_parent_cats($cat);
                    $key = 'acid';
                    $type = 'article_cat';
                } else {
                    $cat_arr = array();
                }
            }
            /* 循环分类 */
            if (!empty($cat_arr)) {
                krsort($cat_arr);
                foreach ($cat_arr as $val) {
                    $page_title = htmlspecialchars($val['cat_name']) . '_' . $page_title;
                    $args = array($key => $val['cat_id']);
                    $ur_here .= ' <code>&gt;</code> <a href="' . build_uri($type, $args, $val['cat_name']) . '">' . htmlspecialchars($val['cat_name']) . '</a>';
                }
            }
        } else {
            /* 团购 */
            if ('group_buy' == $filename) {
                $page_title = $GLOBALS['_LANG']['group_buy_goods'] . '_' . $page_title;
                $args = array('gbid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="group_buy.php">' . $GLOBALS['_LANG']['group_buy_goods'] . '</a>';
            } elseif ('auction' == $filename) {
                $page_title = $GLOBALS['_LANG']['auction'] . '_' . $page_title;
                $args = array('auid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="auction.php">' . $GLOBALS['_LANG']['auction'] . '</a>';
            } elseif ('snatch' == $filename) {
                $page_title = $GLOBALS['_LANG']['snatch'] . '_' . $page_title;
                $args = array('id' => '0');
                $ur_here .= ' <code> &gt; </code><a href="snatch.php">' . $GLOBALS['_LANG']['snatch_list'] . '</a>';
            } elseif ('wholesale' == $filename) {
                $page_title = $GLOBALS['_LANG']['wholesale'] . '_' . $page_title;
                $args = array('wsid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="wholesale.php">' . $GLOBALS['_LANG']['wholesale'] . '</a>';
            } elseif ('exchange' == $filename) {
                $page_title = $GLOBALS['_LANG']['exchange'] . '_' . $page_title;
                $args = array('wsid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="exchange.php">' . $GLOBALS['_LANG']['exchange'] . '</a>';
            }
            /* 其他的在这里补充 */
        }
    }
    /* 处理最后一部分 */
    if (!empty($str)) {
        $page_title = $str . '_' . $page_title;
        $ur_here .= ' <code>&gt;</code> ' . $str;
    }
    /* 返回值 */
    return array('title' => $page_title, 'ur_here' => $ur_here);
}
Beispiel #3
0
 $smarty->assign('searchkeywords', $searchkeywords);
 //热搜关键词
 /* 或得顶级分类产品名称*/
 $sql = 'SELECT cat_id FROM ' . $GLOBALS['ecs']->table('goods') . ' where goods_id =' . $goods['goods_id'];
 $parentid = $GLOBALS['db']->getOne($sql);
 $sql = 'SELECT parent_id from ' . $GLOBALS['ecs']->table('category') . ' where cat_id =' . $parentid;
 $parentid = $GLOBALS['db']->getOne($sql);
 $sql = 'SELECT cat_name FROM ' . $GLOBALS['ecs']->table('category') . ' where cat_id =' . $parentid;
 $parentcatname = $GLOBALS['db']->getOne($sql);
 if ($parentcatname == '季能赚') {
     $levelinfo = get_twolevel_repay($parentid);
     //查询分类下产品id
     $smarty->assign('goodslevel', $levelinfo);
 }
 $catlist = array();
 foreach (get_parent_cats($goods['cat_id']) as $k => $v) {
     $catlist[] = $v['cat_id'];
 }
 assign_template('c', $catlist);
 /* 上一个商品下一个商品 */
 /*$prev_gid = $db->getOne("SELECT goods_id FROM " .$ecs->table('goods'). " WHERE cat_id=" . $goods['cat_id'] . " AND goods_id > " . $goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1");
         if (!empty($prev_gid))
         {
             $prev_good['url'] = build_uri('goods', array('gid' => $prev_gid), $goods['goods_name']);
             $smarty->assign('prev_good', $prev_good);//上一个商品
         }
 
         $next_gid = $db->getOne("SELECT max(goods_id) FROM " . $ecs->table('goods') . " WHERE cat_id=".$goods['cat_id']." AND goods_id < ".$goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0");
         if (!empty($next_gid))
         {
             $next_good['url'] = build_uri('goods', array('gid' => $next_gid), $goods['goods_name']);
Beispiel #4
0
     $smarty->assign('filter_attr_list', $all_attr_list);
 }
 $filter_info = array(0 => array('id' => 0, 'name' => '全部', 'selected' => 0, 'url' => build_uri('category', array_merge($attr_url_value, array('filter' => 0)), '全部')), 1 => array('id' => 1, 'name' => '网站自营', 'selected' => 0, 'url' => build_uri('category', array_merge($attr_url_value, array('filter' => 1)), '网站自营')), 2 => array('id' => 2, 'name' => '入驻商店铺', 'selected' => 0, 'url' => build_uri('category', array_merge($attr_url_value, array('filter' => 2)), '入驻商店铺')));
 $filter_info[$filter]['selected'] = 1;
 $smarty->assign('filterinfo', $filter_info);
 assign_template('c', array($cat_id));
 $position = assign_ur_here($cat_id, $brand_name);
 $smarty->assign('page_title', $position['title']);
 // 页面标题
 $smarty->assign('ur_here', $position['ur_here']);
 // 当前位置
 $smarty->assign('current_cat_id', $cat_id);
 //取得当前的id
 /*取得顶级ID*/
 $catlist = array();
 foreach (get_parent_cats($cat_id) as $k => $v) {
     $catlist[] = $v['cat_id'];
 }
 $smarty->assign('current_cat_pr_id', $catlist[count($catlist) - 1]);
 /*取得顶级ID*/
 $smarty->assign('current_cat_pr2_id', $catlist[count($catlist) - 2]);
 /*取得二级分类ID*/
 $smarty->assign('categories', get_categories_tree($cat_id));
 // 分类树
 $smarty->assign('helps', get_shop_help());
 // 网店帮助
 $smarty->assign('top_goods', get_top10());
 // 销售排行
 $smarty->assign('show_marketprice', $_CFG['show_marketprice']);
 $smarty->assign('category', $cat_id);
 $smarty->assign('brand_id', $brand);
Beispiel #5
0
$shop_price = $goods_info['shop_price'];
$smarty->assign('rank_prices', get_user_rank_prices($goods_id, $shop_price));
// 会员等级价格
$smarty->assign('footer', get_footer());
/* 查看商品图片操作 */
if ($act == 'view_img') {
    $smarty->display('goods_img.html');
    exit;
}
/* 检查是否有商品品牌 */
if (!empty($goods_info['brand_id'])) {
    $brand_name = $db->getOne("SELECT brand_name FROM " . $ecs->table('brand') . " WHERE brand_id={$goods_info['brand_id']}");
    $smarty->assign('brand_name', encode_output($brand_name));
}
/* 显示分类名称 */
$cat_array = get_parent_cats($goods_info['cat_id']);
krsort($cat_array);
$cat_str = '';
foreach ($cat_array as $key => $cat_data) {
    $cat_array[$key]['cat_name'] = encode_output($cat_data['cat_name']);
    $cat_str .= "<a href='category.php?c_id={$cat_data['cat_id']}'>" . encode_output($cat_data['cat_name']) . "</a>-&gt;";
}
$smarty->assign('cat_array', $cat_array);
$properties = get_goods_properties($goods_id);
// 获得商品的规格和属性
$smarty->assign('specification', $properties['spe']);
// 商品规格
$comment = assign_comment($goods_id, 0);
$smarty->assign('comment', $comment);
$smarty->display('goods.html');
/**
Beispiel #6
0
 	{
 		$kcat_list[$row_kcat['cat_id']] += $row_kcat['cat_count'];
 	}
 	else
 	{
 		$kcat_list[$row_kcat['cat_id']] = $row_kcat['cat_count'];
 	}
 }
 */
 arsort($kcat_list);
 //echo "<pre>";
 //print_r($kcat_list);
 $cat_two_arr = array();
 foreach ($kcat_list as $kkey => $kkcat) {
     //echo $kkey.":".$kkcat."<br>";
     $cat_arr = get_parent_cats($kkey);
     if (!empty($cat_arr)) {
         $anum = count($cat_arr) - 1;
         $name = '';
         krsort($cat_arr);
         foreach ($cat_arr as $val) {
             $name .= $val['cat_name'] . '&gt;';
             $cat_two_arr[$cat_arr[$anum]['cat_id']][$cat_arr[0]['cat_id']]['name'] = rtrim($name, '&gt;');
             $cat_two_arr[$cat_arr[$anum]['cat_id']][$cat_arr[0]['cat_id']]['url'] = 'search.php?category=' . $val['cat_id'] . '&keywords=' . $Recordkw;
             $cat_two_arr[$cat_arr[$anum]['cat_id']][$cat_arr[0]['cat_id']]['count'] = $kkcat;
         }
     }
 }
 if (strlen($Recordkw) > 1) {
     //echo "<pre>";
     //print_r($cat_two_arr);
Beispiel #7
0
/**
 * 取得当前位置和页面标题
 *
 * @access  public
 * @param   integer     $cat    分类编号(只有商品及分类、文章及分类用到)
 * @param   string      $str    商品名、文章标题或其他附加的内容(无链接)
 * @return  array
 */
function assign_ur_here($cat = 0, $str = '')
{
    /* 判断是否重写,取得文件名 */
    $touch =& get_instance();
    $filename = $touch->router->fetch_class();
    /* 初始化“页面标题”和“当前位置” */
    $page_title = C('shop_title') . ' - ' . 'Powered by ECTouch';
    $ur_here = '<a href=".">' . L('home') . '</a>';
    /* 根据文件名分别处理中间的部分 */
    if ($filename != 'index') {
        /* 处理有分类的 */
        if (in_array($filename, array('category', 'goods', 'article_cat', 'article', 'brand'))) {
            /* 商品分类或商品 */
            if ('category' == $filename || 'goods' == $filename || 'brand' == $filename) {
                if ($cat > 0) {
                    $cat_arr = get_parent_cats($cat);
                    $key = 'cid';
                    $type = 'category';
                } else {
                    $cat_arr = array();
                }
            } elseif ('article_cat' == $filename || 'article' == $filename) {
                if ($cat > 0) {
                    $cat_arr = get_article_parent_cats($cat);
                    $key = 'acid';
                    $type = 'article_cat';
                } else {
                    $cat_arr = array();
                }
            }
            /* 循环分类 */
            if (!empty($cat_arr)) {
                krsort($cat_arr);
                foreach ($cat_arr as $val) {
                    $page_title = htmlspecialchars($val['cat_name']) . '_' . $page_title;
                    $args = array($key => $val['cat_id']);
                    $ur_here .= ' <code>&gt;</code> <a href="' . build_uri($type, $args, $val['cat_name']) . '">' . htmlspecialchars($val['cat_name']) . '</a>';
                }
            }
        } else {
            /* 团购 */
            if ('group_buy' == $filename) {
                $page_title = L('group_buy_goods') . '_' . $page_title;
                $args = array('gbid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="group_buy.php">' . L('group_buy_goods') . '</a>';
            } elseif ('auction' == $filename) {
                $page_title = L('auction') . '_' . $page_title;
                $args = array('auid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="auction.php">' . L('auction') . '</a>';
            } elseif ('snatch' == $filename) {
                $page_title = L('snatch') . '_' . $page_title;
                $args = array('id' => '0');
                $ur_here .= ' <code> &gt; </code><a href="snatch.php">' . L('snatch_list') . '</a>';
            } elseif ('wholesale' == $filename) {
                $page_title = L('wholesale') . '_' . $page_title;
                $args = array('wsid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="wholesale.php">' . L('wholesale') . '</a>';
            } elseif ('exchange' == $filename) {
                $page_title = L('exchange') . '_' . $page_title;
                $args = array('wsid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="exchange.php">' . L('exchange') . '</a>';
            }
            /* 其他的在这里补充 */
        }
    }
    /* 处理最后一部分 */
    if (!empty($str)) {
        $page_title = $str . '_' . $page_title;
        $ur_here .= ' <code>&gt;</code> ' . $str;
    }
    /* 返回值 */
    return array('title' => $page_title, 'ur_here' => $ur_here);
}
Beispiel #8
0
       // 提示信息,引用该分类成功 
        $link[] = array('text' => $_LANG['back_list'], 'href' => 'category.php?act=list');
        sys_msg("该分类引用成功", 0, $link); 
    }

}
2015-03-23 注释 ccx 采用了host_category_copy方法 end */
if ($_REQUEST['act'] == 'host_category_copy') {
    //echo "123456789";exit;
    //make_json_error("不能引用该分类");
    include_once ROOT_PATH . 'includes/lib_main.php';
    $cat_id = empty($_REQUEST['cat_id']) ? '' : json_str_iconv(trim($_REQUEST['cat_id']));
    $val = empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val']));
    $admin_agency_id = admin_agency_id();
    //代理商user_id
    $agency_attr = array();
    $cart_number = get_parent_cats($cat_id);
    $cart_number = array_reverse($cart_number);
    /*ccx 2015-03-19 判断该分类(包括上级分类)是否显示 start*/
    foreach ($cart_number as $k => $v) {
        $sql = "SELECT is_show FROM " . $GLOBALS['ecs']->table('category') . " WHERE cat_id = " . $v['cat_id'];
        $is_show = $GLOBALS['db']->getOne($sql);
        if ($is_show == 0) {
            $is_show = 0;
            break;
        }
    }
    if ($is_show == 0) {
        /* 该分类不允许引用 */
        make_json_error("请当前分类,或者当前分类的上一级分类存在不显示的状态,所以该分类不能被引用");
    }
Beispiel #9
0
function archiveHeader()
{
    $img = '';
    $classes = [];
    $parents = get_parent_cats();
    if (function_exists('z_taxonomy_image_url') && is_archive() && !is_tag()) {
        $img = z_taxonomy_image_url(array_values($parents)[0]->term_id);
        if ($img) {
            $classes[] = 'header';
        }
    }
    ?>
  <figure class="archiveheader <?php 
    echo implode(' ', $classes);
    ?>
">
      <img src="/wp-includes/images/blank.gif" style="background-image:url(<?php 
    echo $img;
    ?>
)">
      <figcaption>
      <div class="overview">

          <?php 
    if (function_exists('nav_breadcrumb')) {
        nav_breadcrumb();
    }
    ?>
          <ul class="category_structure">
            <?php 
    $args = array('child_of' => get_query_var('cat') ? get_query_var('cat') : 1, 'title_li' => '', 'show_option_none' => '');
    wp_list_categories($args);
    ?>
          </ul>
          
      </div>
     
       
        <?php 
    get_search_form();
    ?>

      </figcaption>
        <?php 
    if ($img && !empty($data['caption'])) {
        echo '<small>';
        echo __('Copyright: ', 'amnesty');
        echo $data['caption'] . '</small>';
        echo '</small>';
    }
    ?>
      </small>
  </figure>
  <?php 
}
Beispiel #10
0
    $count = get_cagtegory_goods_count($children, $brand, $price_min, $price_max, $ext);
    $max_page = $count > 0 ? ceil($count / $size) : 1;
    if ($page > $max_page) {
        $page = $max_page;
    }
    $goodslist = category_get_goods($children, $brand, $price_min, $price_max, $ext, $size, $page, $sort, $order);
    if ($display == 'grid') {
        if (count($goodslist) % 2 != 0) {
            $goodslist[] = array();
        }
    }
    $smarty->assign('goods_list', $goodslist);
    $smarty->assign('category', $cat_id);
    $smarty->assign('script_name', 'category');
    /* 获得顶级分类 */
    $cat_arr = get_parent_cats($cat_id);
    foreach ($cat_arr as $val) {
        $topcat_id = $val['cat_id'];
        $topcat_name = $val['cat_name'];
    }
    $smarty->assign('topcat_id', $topcat_id);
    $smarty->assign('topcat_name', $topcat_name);
    $smarty->assign('ecy_adpicr', get_ecy_classpic($cat_id, 3));
    $smarty->assign('ecy_adflash', get_ecy_classpic($cat_id, 2));
    $smarty->assign('ecy_adpicl', get_ecy_classpic($cat_id, 4));
    $smarty->assign('ecy_adtext', get_ecy_classpic($cat_id, 6));
    assign_pager('category', $cat_id, $count, $size, $sort, $order, $page, '', $brand, $price_min, $price_max, $display, $filter_attr_str);
    // 分页
    assign_dynamic('category');
    // 动态内容
}
Beispiel #11
0
/**
 * Recursive function which, given a context, find all parent context ids,
 * and return the array in reverse order, i.e. parent first, then grand
 * parent, etc.
 * @param object $context
 * @return array()
 */
function get_parent_contexts($context)
{
    static $pcontexts;
    // cache
    if (isset($pcontexts[$context->id])) {
        return $pcontexts[$context->id];
    }
    switch ($context->contextlevel) {
        case CONTEXT_SYSTEM:
            // no parent
            return array();
            break;
        case CONTEXT_PERSONAL:
            if (!($parent = get_context_instance(CONTEXT_SYSTEM))) {
                return array();
            } else {
                $res = array($parent->id);
                $pcontexts[$context->id] = $res;
                return $res;
            }
            break;
        case CONTEXT_USER:
            if (!($parent = get_context_instance(CONTEXT_SYSTEM))) {
                return array();
            } else {
                $res = array($parent->id);
                $pcontexts[$context->id] = $res;
                return $res;
            }
            break;
        case CONTEXT_COURSECAT:
            // Coursecat -> coursecat or site
        // Coursecat -> coursecat or site
        case CONTEXT_COURSE:
            // 1 to 1 to course cat
            $parents = get_parent_cats($context);
            $parents = array_reverse($parents);
            $systemcontext = get_context_instance(CONTEXT_SYSTEM);
            return $pcontexts[$context->id] = array_merge($parents, array($systemcontext->id));
            break;
        case CONTEXT_GROUP:
            // 1 to 1 to course
            if (!($group = groups_get_group($context->instanceid))) {
                return array();
            }
            if ($parent = get_context_instance(CONTEXT_COURSE, $group->courseid)) {
                $res = array_merge(array($parent->id), get_parent_contexts($parent));
                $pcontexts[$context->id] = $res;
                return $res;
            } else {
                return array();
            }
            break;
        case CONTEXT_MODULE:
            // 1 to 1 to course
            if (!($cm = get_record('course_modules', 'id', $context->instanceid))) {
                return array();
            }
            if ($parent = get_context_instance(CONTEXT_COURSE, $cm->course)) {
                $res = array_merge(array($parent->id), get_parent_contexts($parent));
                $pcontexts[$context->id] = $res;
                return $res;
            } else {
                return array();
            }
            break;
        case CONTEXT_BLOCK:
            // not necessarily 1 to 1 to course
            if (!($block = get_record('block_instance', 'id', $context->instanceid))) {
                return array();
            }
            // fix for MDL-9656, block parents are not necessarily courses
            if ($block->pagetype == 'course-view') {
                $parent = get_context_instance(CONTEXT_COURSE, $block->pageid);
            } else {
                $parent = get_context_instance(CONTEXT_SYSTEM);
            }
            if ($parent) {
                $res = array_merge(array($parent->id), get_parent_contexts($parent));
                $pcontexts[$context->id] = $res;
                return $res;
            } else {
                return array();
            }
            break;
        default:
            error('This is an unknown context (' . $context->contextlevel . ') in get_parent_contexts!');
            return false;
    }
}
Beispiel #12
0
function getSencLeverCatId($catId)
{
    $parentCatIds = get_parent_cats($catId);
    //var_dump($parentCatIds);
    return $parentCatIds[1]['cat_id'];
}