求助如何首页调用积分商品~~~~~~~~~~~~~~~~~!!!!!

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

以前看过一些类似的帖子但是修改也没有效果,恳求各位大大有改过的或者会改的帮忙详细的帖个代码什么的 小弟在此谢过了~

回答:
告诉你原理.你检索exchange表就可以了

调取exchange就行,查出你要的数据,显示出来不就行了。




我不会php 能给个例子吗?



没有现成的,需要写。




  1. /**
  2. * 获得积分商城热门商品
  3. */
  4. function exchange_gets_goods()
  5. {

  6. $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, eg.exchange_integral, ' .'g.goods_type, g.goods_brief, g.goods_thumb , g.goods_img, eg.is_hot ' .'FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg, ' .$GLOBALS['ecs']->table('goods') . ' AS g ' ." WHERE eg.is_exchange = 1 AND g.is_delete = 0 AND eg.is_hot = 1 ORDER BY g.sort_order, g.last_update DESC limit 4";

  7. $res = $GLOBALS['db']->getAll($sql);
  8. $arr = array();
  9. foreach($res AS $idx => $row)
  10. {
  11. $arr[$idx]['name'] = $row['goods_name'];
  12. $arr[$idx]['goods_brief'] = $row['goods_brief'];
  13. $arr[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
  14. $arr[$idx]['exchange_integral'] = $row['exchange_integral'];
  15. $arr[$idx]['type'] = $row['goods_type'];
  16. $arr[$idx]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
  17. $arr[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
  18. $arr[$idx]['url'] = build_uri('exchange_goods', array('gid'=>$row['goods_id']), $row['goods_name']);
  19. }
  20. return $arr;
  21. }
复制代码



  1. <!--{foreach name=goods_exchange_list from=$goods_exchange_list item=exchange_goods}-->
  2. <li class="w25a">
  3. <p class="tjc"><a href="{$exchange_goods.url}" target="_blank"><img src="{$exchange_goods.goods_thumb}" alt="{$exchange_goods.goods_name}" width="150" height="150" class="imgb" /></a></p>
  4. <p class="tjc"><a href="{$exchange_goods.url}" target="_blank">{$exchange_goods.goods_name}</a></p>
  5. <p class="fshse">消耗积分:<font class="f1">{$exchange_goods.exchange_integral}</font></p>

  6. </li>
  7. <!--{/foreach}-->
复制代码


麻烦帮我看一下 我不太懂Php照着写了一个 但是调用不出来~ 不知道哪里问题 您帮我看一下吧 谢谢了。

我也想知道。希望管理员提供份详细代码及步骤让菜鸟们学习。劳驾了

有人做出来的有吗 ?

可以参照这篇文章

http://www.ecshop120.com/ecshop-ercikaifa/article-129.html