ecshop如何调用优惠活动产品的介绍?跪求。。。。。 5
1个回答
展开全部
修改 includes/lib_goods.php 文件,找到 get_recommend_goods 函数部分
修改下面代码
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.goods_desc, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
"promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ";
$type_merge = array_merge($type_array['new'], $type_array['best'], $type_array['hot']);
$type_merge = array_unique($type_merge);
$sql .= ' WHERE g.goods_id ' . db_create_in($type_merge);
$sql .= ' ORDER BY g.sort_order, g.last_update DESC';
$result = $GLOBALS['db']->getAll($sql);
foreach ($result AS $idx => $row)
{
if ($row['promote_price'] > 0)
{
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
}
else
{
$goods[$idx]['promote_price'] = '';
}
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['goods_desc'] = sub_str(strip_tags($row['goods_desc']), 50);
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : '';
$goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
......................
接下来就是在
/themes/default/library/recommend_best.lbi
/themes/default/library/recommend_hot.lbi
/themes/default/library/recommend_new.lbi
几个文件中的调用了。。
这么调用 {$goods.goods_desc}
主要调用代码 要放在循环里面
修改下面代码
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.goods_desc, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
"promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ";
$type_merge = array_merge($type_array['new'], $type_array['best'], $type_array['hot']);
$type_merge = array_unique($type_merge);
$sql .= ' WHERE g.goods_id ' . db_create_in($type_merge);
$sql .= ' ORDER BY g.sort_order, g.last_update DESC';
$result = $GLOBALS['db']->getAll($sql);
foreach ($result AS $idx => $row)
{
if ($row['promote_price'] > 0)
{
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
}
else
{
$goods[$idx]['promote_price'] = '';
}
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['goods_desc'] = sub_str(strip_tags($row['goods_desc']), 50);
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : '';
$goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
......................
接下来就是在
/themes/default/library/recommend_best.lbi
/themes/default/library/recommend_hot.lbi
/themes/default/library/recommend_new.lbi
几个文件中的调用了。。
这么调用 {$goods.goods_desc}
主要调用代码 要放在循环里面
更多追问追答
追问
貌似不行啊 !
是在activity.dwt里面修改,调用的,不知道怎么去修改activity.php的代码?
追答
你得去activity.php中找到调用的那段代码,然后用联合查询,读出goods数据库中的goods_desc字段才可以,然后模板用{$val.goods_desc}进行调用
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询