怎样让首页新品显示商品的上架时间??

2016-07-07 15:51 来源:www.chinab4c.com 作者:ecshop专家

默认首页新品只显示相关的名字和价格,怎么样可以显示其上架时间等信息,请问这个代码该怎么写

回答:
lib_goods.php

251行找到
  1. lib_goods.php 251行找到
  2. [code]
  3. //取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中
  4. $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
  5. "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
复制代码
改为
  1. //取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中
  2. $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.add_time, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
  3. "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
复制代码
276行下面增加
  1. $goods[$idx]['add_time']= local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
复制代码
找到383行
  1. $sql ='SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, '
复制代码
改为
  1. $sql ='SELECT g.goods_id, g.goods_name, g.goods_name_style,g.add_time, g.market_price, g.shop_price AS org_price, g.promote_price, '
复制代码
434行增加
  1. $goods[$idx]['add_time']= local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
复制代码
然后找到模板文件recommend_new.lbi,在需要的位置加上{$goods.add_time}