zoukankan      html  css  js  c++  java
  • ECSHOP首页每个商品下显示已销售量

    一、打开文件 includes/lib_goods.php  在该文件的末尾添加如下代码

    function get_buy_sum($goods_id) 
    {
    
    $sql = "select sum(goods_number) from " . $GLOBALS['ecs']->table('order_goods') . " AS g ,".$GLOBALS['ecs']->table('order_info') . " AS o WHERE o.order_id=g.order_id and g.goods_id = " . $goods_id   ;
    
        return $GLOBALS['db']->getOne($sql);
    
    }

    再继续,查找

    $goods[$idx]['brand_name']   = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : '';

    在下面添加代码

    $goods[$idx]['buy_num']= get_buy_sum($row['goods_id']);

    二、模板文件中调用,如下代码

    {if $goods.buy_num}
    {$goods.buy_num}
    {else}
    0
    {/if}
    ------------------------------------------华丽丽的分割线--------------------- ------------------------------------

    源厂制造10-10000级洁净无尘车间防静电防尘用品!网址:http://www.lgfjd.com 微信号:614412
  • 相关阅读:
    query compiler
    non-deterministic-turing-machine
    What-are-P-NP-NP-complete-and-NP-hard
    查询优化器的算法
    Redis 和 I/O 多路复用
    Linux aio
    MySQL 的那些网络超时错误
    MYSQL performance
    jvmti
    JVM Troubleshooting
  • 原文地址:https://www.cnblogs.com/wangblognet/p/2728253.html
Copyright © 2011-2022 走看看