ecshop首页如何调用指定分类下的推荐热销最新商品

2025-03-26 10:44:06
推荐回答(1个)
回答1:

1.在首页index.php中找到 1 /* 页面中的动态内容 */ 2 assign_dynamic('index'); 2.在上面添加如下代码 1 $children = get_children(1); 2 $smarty->assign('index_hot_goods_1', get_category_recommend_goods("hot", $children)); // 热销商品 其中分类编号1,根据你想调用分类而填写 如果是最新产品就再加上 1 $children = get_children(1); 2 $smarty->assign('index_new_goods_1', get_category_recommend_goods("new", $children)); // 最新商品 若果是精品产品 1 $children = get_children(1); 2 $smarty->assign('index_best_goods_1', get_category_recommend_goods("best", $children)); // 精品商品 3.然后再模板库文件中新建index_hot_goods_1.lbi。文件内容如下: 1 2

  • {$goods.name|escape:html} 3

    {$goods.short_name|escape:html}

    4 5 一口价 {$goods.promote_price} 6 7 一口价 {$goods.shop_price} 8 9
  • 10 4.然后在首页模板index.dwt中调用index_hot_goods_1.lbi。 1 5.如果有多个分类要调用,可以重复1-3的步骤