ecshop首页调用指定分类下面的精品商品

1.首先在index.php页面加上这段代码:

function index_get_cat_id_goods_best_list($cat_id, $num)
{
    $sql = ‘Select g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price, g.promote_price, ‘ .
                "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, " .
                "g.is_best, g.is_new, g.is_hot, g.is_promote " .
            ‘FROM ‘ . $GLOBALS[‘ecs‘]->table(‘goods‘) . ‘ AS g ‘ .
            "Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_best = 1 AND g.cat_id = ‘$cat_id‘".
            " LIMIT $num";
    $res = $GLOBALS[‘db‘]->getAll($sql);

$goods = array();
    foreach ($res AS $idx => $row)
    {
        $goods[$idx][‘id‘]           = $row[‘article_id‘];
        $goods[$idx][‘id‘]           = $row[‘goods_id‘];
        $goods[$idx][‘name‘]         = $row[‘goods_name‘];
        $goods[$idx][‘brief‘]        = $row[‘goods_brief‘];
        $goods[$idx][‘brand_name‘]   = $row[‘brand_name‘];
        $goods[$idx][‘goods_style_name‘]   = add_style($row[‘goods_name‘],$row[‘goods_name_style‘]);

$goods[$idx][‘short_name‘]   = $GLOBALS[‘_CFG‘][‘goods_name_length‘] > 0 ?
                                           sub_str($row[‘goods_name‘], $GLOBALS[‘_CFG‘][‘goods_name_length‘]) : $row[‘goods_name‘];
        $goods[$idx][‘short_style_name‘]   = add_style($goods[$idx][‘short_name‘],$row[‘goods_name_style‘]);
        $goods[$idx][‘market_price‘] = price_format($row[‘market_price‘]);
        $goods[$idx][‘shop_price‘]   = price_format($row[‘shop_price‘]);
        $goods[$idx][‘thumb‘]        = empty($row[‘goods_thumb‘]) ? $GLOBALS[‘_CFG‘][‘no_picture‘] : $row[‘goods_thumb‘];
        $goods[$idx][‘goods_img‘]    = empty($row[‘goods_img‘])   ? $GLOBALS[‘_CFG‘][‘no_picture‘] : $row[‘goods_img‘];
        $goods[$idx][‘url‘]          = build_uri(‘goods‘, array(‘gid‘ => $row[‘goods_id‘]), $row[‘goods_name‘]);
    }

return $goods;
}

2.然后声明用$smarty调用
在$smarty->assign(‘shop_notice‘,     $_CFG[‘shop_notice‘]);       // 商店公告      的 下面写上:

$smarty->assign(‘cat_id2_best_goods‘, index_get_cat_id_goods_best_list(2,4));
//2指分类id,4指循环次数

3.打开index.dwt,调用即可

<!--{foreach from=$cat_id2_best_goods item=goods}-->
     <div class="goodsItem" style="float:left ; margin-left:10px;" >
           <a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" class="goodsimg" width="100" height="100" /></a><br />
           <p><a href="{$goods.url}" title="{$goods.name|escape:html}">{$goods.short_name|truncate:7:true}</a></p>
           <div class="shop_s" style="text-align:center; color:#CC0000 " >
             <strong>
            {$goods.shop_price}
            </strong>
           </div>
     </div>
<!--{/foreach}-->

ecshop首页调用指定分类下面的精品商品

时间: 2024-08-26 18:23:46

ecshop首页调用指定分类下面的精品商品的相关文章

ecshop 首页调用指定分类下的销售排行

/*首页调用指定分类下的销售排行*/ function get_cats_top10($cat = '') { $sql = 'SELECT cat_id, cat_name ' . 'FROM ' . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '$cat' ORDER BY sort_order ASC, cat_id ASC LIMIT 3"; $res = $GLOBALS['db']->getAl

ecshop首页调用指定商品分类下的商品品牌列表

转之--http://www.16css.com/ecshop/735.html 通过二次开发可以实现ECSHOP首页调用指定分类下的品牌列表. 第一步: 打开根目录下的index.php 在最后面 ?> 前面加入以下代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 /** * 获得某个分类下的品牌 列表 * * @access  public * @param   int     $cat * @return 

ecshop调用指定分类热销-新品-精品

在模板页里首页写上代码: <?php$children = get_children(16);//此处为产品分类ID $smarty->assign( 'bestGoods16',get_category_recommend_goods('best', $children)); ?> 然后在模板文件里调用就行了. ecshop调用指定分类热销-新品-精品,布布扣,bubuko.com

ectouch手机商城首页调用指定分类下的商品

ECTouch是国内市面上唯一开源的ECSHOP移动商城系统,为广大电商以最低的成本快速搭建移动商城.最近最一商城实例,手机版首页需要调用指定分类下的商品,ECtouch商城默认好像没有此调用方式,只能自己动手添加了. 方法如下: 1.打开mobile\include\apps\default\model\IndexModel.class.php 在最下面 } 之前添加以下代码 /**      * 获得指定分类下的商品      */      function assign_cat_good

ecshop首页调用某分类下的商品|assign_cat_goods()

ecshop首页调用分类下的商品其实很简单,也有模板设置那里可以设置,不过那个只可以用cat_goods.lib,不方便,所以我想看看怎么能简单的实现ecshop首页调用分类下的商品 只需要在index.php写上这么一句:assign_cat_goods(20,10); 其中20是分类id,10是调用的条数 assign_cat_goods这个函数是在includes/lib_goods.php里面的 然后就是ecshop模板里调用商品了 <!–{foreach from=$cat_goods

首页调用指定分类下子分类方法

模板首页一般都有分楼层显示的分类商品,每个楼层右上角会有该分类下小分类排列显示的: 以往有些模板这里都是静态显示的,需要客户手动依次修改,现在模板中心告诉您怎样修改成动态调用,只需修改一个id即可. 1.打开您的文件根目录下 includes/lib_goods.php 文件,在最后一行加入一个方法: function get_parent_id_tree($parent_id){$three_c_arr = array();$sql = 'SELECT count(*) FROM ' . $G

EcShop首页显示特定分类的精品新品热销特价等推荐商品

EcShop首页显示特定分类的精品新品热销特价等推荐商品 很多大型的B2C商城都有特定分类专区,该分类下的[分类名称].[推荐子分类 或 推荐品牌].[大图片/推荐单品].[推荐商品].[促销商品].[推荐商品/热销排行]等,这是基于SEO及用户体验来开发的.ECSHOP虽然有类似的功能,并且推荐商品还分[精品].[新品].[热销]三类,但灵活性不是很好,首页第一次加载的时候,无论是[精品].[新品]还是[热销]都不能指定分类,只能不分类别地显示所有.即使是在分类的设置里面有[设置为首页推荐:

ecshop3 调用指定分类下推荐/热卖/新品商品,可指定调用数量

第一步:--------------------------------------------------------------------------------------/** * 取指定分类ID及类型的商品信息 * @access public * @param string $cat_id 分类ID * @param string $num 显示商品数量 * @param string $cat_type 显示商品类型 new新品,hot热销,best为精品,promote特价 *

织梦dedecms 中怎么在首页调用指定单篇文章的body主体内容和简介?

在使用织梦dede建站的过程中,我们通常会在首页或者列表页调用文章内容,官方的做法一 般是调用描述内容,但是调用描述存在相应的缺点:调用的内容有限,默认描述内容较短,并且文章修改后,描述不能自动修改,需要手动修改.下面分享一个可以 实现首页或者列表页调用文章body内容而不是description的方法: {dede:arclist row='1' addfields='body' idlist='18' typeid='1' channelid='1'} [field:body functio