zoukankan      html  css  js  c++  java
  • ECSHOP任意页面调用商品属性

    直接用下面的方法,就可以在ECSHOP的任意页面调用商品属性

    1、打开includes\lib_insert.php文件,在最后面增加一个函数:

    --------------------------------------------------------------

    function insert_attr($arr)


    {

    static $static_res = NULL;

     $aid= isset($arr['aid'])?$arr['aid']:0;

     $gid= isset($arr['gid'])?$arr['gid']:0;

     if($aid==0) return '';

     if ($static_res[$aid][$gid] === NULL)

     {

      if($gid>0)

      {

       $static_res[$aid][$gid] =  $GLOBALS['db']->getOne('select attr_value from ' . $GLOBALS['ecs']->table('goods_attr') . " where attr_id ='$aid' and goods_id='$gid' ");     

      }

      else

      {

       $static_res[$aid][$gid] = $GLOBALS['db']->getOne('select attr_name from ' . $GLOBALS['ecs']->table('attribute') . " where attr_id ='$aid' ");

      }
     

     }


        return $static_res[$aid][$gid];

    }


    --------------------------------------------------------------

    注意要加在  ?>  的前面


    2、接下来就可以直接在
    ECSHOP模板中(dwt文件、lib文件皆可)中调用,


    调用方法:


    {insert name='attr' aid=属性id gid=商品编号} 调用商品的属性值


    {insert name='attr' aid=属性id} 调用商品的属性


    经过上面修改代码或增加代码后,就可以在ECSHOP的任意页面调用商品属性了。

  • 相关阅读:
    1167E (尺取法)
    Report CodeForces
    Maximum Xor Secondary CodeForces
    Sliding Window POJ
    单调队列 Sliding Window POJ
    尺取法
    目标
    NOIP系列(续)
    NOIP系列
    近期目标
  • 原文地址:https://www.cnblogs.com/wangblognet/p/2809951.html
Copyright © 2011-2022 走看看