예제 #1
0
}
unset($_from);
$this->pop_vars();
?>
          </ul>
        </div>
      </div>
      
      <div id="related-brands" class="m m2">
        <div class="mt">
          <h2>同类品牌</h2>
        </div>
        <div class="mc">
          <ul class="lh">
            <?php 
$GLOBALS['smarty']->assign('get_cat_brands', get_cat_brands($this->_var['goods']['cat_id']));
?>
            <?php 
$_from = $this->_var['get_cat_brands'];
if (!is_array($_from) && !is_object($_from)) {
    settype($_from, 'array');
}
$this->push_vars('', 'brand_cat');
$this->_foreach['get_cat_brands'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['get_cat_brands']['total'] > 0) {
    foreach ($_from as $this->_var['brand_cat']) {
        $this->_foreach['get_cat_brands']['iteration']++;
        ?>
            <li><a href="brand.php?id=<?php 
        echo $this->_var['brand_cat']['id'];
        ?>
예제 #2
0
파일: index.php 프로젝트: norain2050/benhu
function get_goods($catid, $ages)
{
    //首页获取热销的商品
    $arr = array();
    $all = array();
    $name = array();
    $id = array();
    foreach ($catid as $key => $cat) {
        //获取所有的商品
        //array(977,981,1000)
        $fen1 = get_children1($cat);
        //cat_id IN ('977','477','1053','1054','1055')
        $all[$key]['name_id'] = $GLOBALS['db']->getAll('select cat_id,cat_name from ' . $GLOBALS['ecs']->table("category") . ' where cat_id=' . $cat);
        /*
        		array
        		  'cat_id' => string '977' (length=3)
        		  'cat_name' => string '母乳喂养用品' (length=18)
        */
        //var_dump($all[$key]['name_id']);exit;
        $age = $ages;
        $age = $age == 0 ? '' : ' AND (is_age =0 OR is_age = ' . $age . ')';
        $cnt_children_goods = get_children_pro_goods_num($cat, $age);
        $fen = array();
        foreach ($cnt_children_goods as $proId => $queryNum) {
            if ($queryNum == 0) {
                continue;
            }
            $sql = 'SELECT goods_id, goods_name,market_price,shop_price,goods_thumb FROM ' . $GLOBALS['ecs']->table("goods") . ' WHERE ' . 'cat_id = ' . $proId . $age . ' LIMIT 0, ' . $queryNum;
            $tmp = $GLOBALS['db']->getAll($sql);
            foreach ($tmp as $val) {
                $val['url'] = build_uri('goods', array('gid' => $val['goods_id']), $val['goods_name']);
                $fen[] = $val;
            }
        }
        $goods_recommend = $GLOBALS['db']->getAll('select a.cat_id,a.cat_name,b.recommend_type from ' . $GLOBALS['ecs']->table("category") . ' AS a LEFT JOIN ' . $GLOBALS['ecs']->table("cat_recommend") . ' AS b on b.cat_id=a.cat_id  where a.parent_id=' . $cat . ' AND b.recommend_type = 3 LIMIT 0,8');
        //获取品牌推荐分类,recommended_type为3的  热门推荐 guan
        foreach ($goods_recommend as $grKey => $grVal) {
            $goods_recommend[$grKey]['url'] = build_uri('category', array('cid' => $grVal['cat_id']), $grVal['cat_name']);
            //build_uri('article', array('aid' => $val['article_id']), $val['title']);;
        }
        $all[$key]['moreUrl'] = build_uri('category', array('cid' => $cat));
        $all[$key]['recommend'] = $goods_recommend;
        $all[$key]['goods'] = $fen;
        $all[$key]['brands'] = get_cat_brands($cat);
    }
    return $all;
}
예제 #3
0
}
unset($_from);
$this->pop_vars();
?>
 </div>
      <div class="promo_brand">
      	<div class="recommend-brand">
        <div class="gw_con">
        	<div class="anli">
			<div class="anli_con">
				<ul class="yyyy_<?php 
echo $this->_var['goods_cat']['id'];
?>
 anli_con_num" style="position: absolute; width:1210px; height:40px; top:0px; left: 0px;">
		<?php 
$GLOBALS['smarty']->assign('catbrand', get_cat_brands($GLOBALS['smarty']->_var['goods_cat']['id'], 14));
?>
        		<?php 
$_from = $this->_var['catbrand'];
if (!is_array($_from) && !is_object($_from)) {
    settype($_from, 'array');
}
$this->push_vars('', 'item');
$this->_foreach['catbrand'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['catbrand']['total'] > 0) {
    foreach ($_from as $this->_var['item']) {
        $this->_foreach['catbrand']['iteration']++;
        ?>
        		<li <?php 
        if ($this->_foreach['catbrand']['iteration'] <= 1) {
            ?>