ecshop

推荐列表 站点导航

当前位置:首页 > 建站教程 > ecshop >

ecshop网页模板商品页详情页添加同类随机商品

来源:网络整理  作者:  发布时间:2020-12-14 12:20
在ecshop商品页详情页添加同类随机商品,能起到更好的展示效果,美观的客户体验,加让系统更方便搜索引擎抓...

    $arr = array();//www.zuimoban.com

 

        {

        $arr[$row['goods_id']]['goods_img']    = get_image_path($row['goods_id'], $row['goods_img']);

再在ecshop最底部添加上 随机同类商品的函数, 以下代码

 

        <!--{foreach from=$category_related_random_goods item=category_related_random_goods_data}-->           

                "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " .

<div class="blank5"></div>

        </ul>

        $arr[$row['goods_id']]['url']          = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);

其他ecshop模块是同理的

            $arr[$row['goods_id']]['promote_price'] = 0;

<!-- #BeginLibraryItem "/library/category_related_random_goods.lbi" --><!-- #EndLibraryItem -->

        {

}

 

            'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .

 

        <!-- {if $category_related_random_goods_data.promote_price neq 0} -->

        {$lang.promote_price}<font class="f1">{$category_related_random_goods_data.formated_promote_price}</font>

function category_related_random_goods($category_id)

        $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);

        <h3>Related Products</h3>

3,ecshop找到  /themes/你使用的商城模板/goods.dwt  文件

        <li class="li1" style="float:left; margin-bottom:20px;"><a href=http://www.ym97.com/ecshopjc/"{$category_related_random_goods_data.url}"><img src="{$category_related_random_goods_data.goods_thumb}" alt="{$category_related_random_goods_data.goods_name}"/></a></li>

 

            $arr[$row['goods_id']]['formated_promote_price'] = price_format($arr[$row['goods_id']]['promote_price']);

/*同分类下随机推荐商品*/

 <div class="box">

    {

 

        <!--{/foreach}-->

样式可以自己定义

        </div>

加上

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

 

 

在上面加代码 $smarty->assign('category_related_random_goods',       category_related_random_goods($goods['cat_id'])); // 同分类随机商品

        {$lang.shop_price}<font class="f1">{$category_related_random_goods_data.shop_price}</font>

1,ecshop根目录下找到goods.php文件

<!-- {if $category_related_random_goods} -->

        else

加在 <!-- #BeginLibraryItem "/library/goods_tags.lbi" --><!-- #EndLibraryItem -->

        <div>

 </div>

                "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " .

{

        if ($row['promote_price'] > 0)

        $arr[$row['goods_id']]['goods_name']   = $row['goods_name'];

        $arr[$row['goods_id']]['shop_price']   = price_format($row['shop_price']);

        }

        <!-- {/if} --></li>

            "WHERE $where ORDER BY rand() limit 12";

            $arr[$row['goods_id']]['promote_price'] = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);

        $arr[$row['goods_id']]['short_name']   = $GLOBALS['_CFG']['goods_name_length'] > 0 ?

2,新建ecshop模板文件 category_related_random_goods.lbi

        $arr[$row['goods_id']]['goods_id']     = $row['goods_id'];

    $where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND ".

        <!-- {else} -->

            'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' .

    }

        <li class="li2" style="float:left; margin-bottom:20px;"><a href=http://www.ym97.com/ecshopjc/"{$category_related_random_goods_data.url}" title="{$category_related_random_goods_data.goods_name}">{$category_related_random_goods_data.short_name}</a><br />

    while ($row = $GLOBALS['db']->fetchRow($res))

    return $arr;

        <ul>

在ecshop商品页详情页添加同类随机商品,能起到更好的展示效果,美观的客户体验,加让系统更方便搜索引擎抓取。

            sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];

        }

        $arr[$row['goods_id']]['goods_thumb']  = get_image_path($row['goods_id'], $row['goods_thumb'], true);

找到ecshop代码  $smarty->assign('properties',          $properties['pro']);                              // 商品属性

 

 

 

    $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .

PS: googs.php 里 ORDER BY rand() limit 12   这个代码 12 就是显示个数的

<!-- {/if} -->

代码如下

把category_related_random_goods.lbi文件复制到 /themes/你使用的模板/library/   文件夹里

                'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .

    $res = $GLOBALS['db']->query($sql);

            "g.is_delete = 0 AND g.cat_id=$category_id ";

相关热词: ecshop

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jz/ecshop/3737.shtml

最新文章
ecshop中设置顺丰快递支持 ecshop中设置顺丰快递支持

时间:2020-12-28

ecshop图文安装过程详解 ecshop图文安装过程详解

时间:2020-12-28

ecshop邮件服务器设置方法 ecshop邮件服务器设置方法

时间:2020-12-23

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

ecshop网页模板商品页详情页添加同类随机商品

2020-12-14 编辑:

    $arr = array();//www.zuimoban.com

 

        {

        $arr[$row['goods_id']]['goods_img']    = get_image_path($row['goods_id'], $row['goods_img']);

再在ecshop最底部添加上 随机同类商品的函数, 以下代码

 

        <!--{foreach from=$category_related_random_goods item=category_related_random_goods_data}-->           

                "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " .

<div class="blank5"></div>

        </ul>

        $arr[$row['goods_id']]['url']          = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);

其他ecshop模块是同理的

            $arr[$row['goods_id']]['promote_price'] = 0;

<!-- #BeginLibraryItem "/library/category_related_random_goods.lbi" --><!-- #EndLibraryItem -->

        {

}

 

            'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .

 

        <!-- {if $category_related_random_goods_data.promote_price neq 0} -->

        {$lang.promote_price}<font class="f1">{$category_related_random_goods_data.formated_promote_price}</font>

function category_related_random_goods($category_id)

        $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);

        <h3>Related Products</h3>

3,ecshop找到  /themes/你使用的商城模板/goods.dwt  文件

        <li class="li1" style="float:left; margin-bottom:20px;"><a href=http://www.ym97.com/ecshopjc/"{$category_related_random_goods_data.url}"><img src="{$category_related_random_goods_data.goods_thumb}" alt="{$category_related_random_goods_data.goods_name}"/></a></li>

 

            $arr[$row['goods_id']]['formated_promote_price'] = price_format($arr[$row['goods_id']]['promote_price']);

/*同分类下随机推荐商品*/

 <div class="box">

    {

 

        <!--{/foreach}-->

样式可以自己定义

        </div>

加上

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

 

 

在上面加代码 $smarty->assign('category_related_random_goods',       category_related_random_goods($goods['cat_id'])); // 同分类随机商品

        {$lang.shop_price}<font class="f1">{$category_related_random_goods_data.shop_price}</font>

1,ecshop根目录下找到goods.php文件

<!-- {if $category_related_random_goods} -->

        else

加在 <!-- #BeginLibraryItem "/library/goods_tags.lbi" --><!-- #EndLibraryItem -->

        <div>

 </div>

                "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " .

{

        if ($row['promote_price'] > 0)

        $arr[$row['goods_id']]['goods_name']   = $row['goods_name'];

        $arr[$row['goods_id']]['shop_price']   = price_format($row['shop_price']);

        }

        <!-- {/if} --></li>

            "WHERE $where ORDER BY rand() limit 12";

            $arr[$row['goods_id']]['promote_price'] = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);

        $arr[$row['goods_id']]['short_name']   = $GLOBALS['_CFG']['goods_name_length'] > 0 ?

2,新建ecshop模板文件 category_related_random_goods.lbi

        $arr[$row['goods_id']]['goods_id']     = $row['goods_id'];

    $where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND ".

        <!-- {else} -->

            'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' .

    }

        <li class="li2" style="float:left; margin-bottom:20px;"><a href=http://www.ym97.com/ecshopjc/"{$category_related_random_goods_data.url}" title="{$category_related_random_goods_data.goods_name}">{$category_related_random_goods_data.short_name}</a><br />

    while ($row = $GLOBALS['db']->fetchRow($res))

    return $arr;

        <ul>

在ecshop商品页详情页添加同类随机商品,能起到更好的展示效果,美观的客户体验,加让系统更方便搜索引擎抓取。

            sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];

        }

        $arr[$row['goods_id']]['goods_thumb']  = get_image_path($row['goods_id'], $row['goods_thumb'], true);

找到ecshop代码  $smarty->assign('properties',          $properties['pro']);                              // 商品属性

 

 

 

    $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .

PS: googs.php 里 ORDER BY rand() limit 12   这个代码 12 就是显示个数的

<!-- {/if} -->

代码如下

把category_related_random_goods.lbi文件复制到 /themes/你使用的模板/library/   文件夹里

                'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .

    $res = $GLOBALS['db']->query($sql);

            "g.is_delete = 0 AND g.cat_id=$category_id ";

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jz/ecshop/3737.shtml

相关文章

风云图片

推荐阅读

返回ecshop频道首页