php专区

 首页 > php专区 > PHP应用 > CMS建站 > ecshop商品属性排序的问题和解决方法 - ecshop

ecshop商品属性排序的问题和解决方法 - ecshop

分享到:
【字体:
导读:
          情况一:添加新产品时,让属性按照添加的顺序(属性id)排列,修改/inclues/lib_goods.php:$sql=SELECTa.attr_id,a.attr_name,a.attr_group,a.is_linked,a.attr_type,.g.goods_attr_id,g.attr_value,......

ecshop商品属性排序的问题和解决方法

情况一:添加新产品时,让属性按照添加的顺序(属性id)排列,修改/inclues/lib_goods.php:

  1. $sql = "SELECT a.attr_id, a.attr_name, a.attr_group, a.is_linked, a.attr_type, "
  2.                 "g.goods_attr_id, g.attr_value, g.attr_price " . 
  3.             'FROM ' . $GLOBALS['ecs']->table('goods_attr') . ' AS g ' . 
  4.             'LEFT JOIN ' . $GLOBALS['ecs']->table('attribute') . ' AS a ON a.attr_id = g.attr_id ' . 
  5.             "WHERE g.goods_id = '$goods_id' " . 
  6.             'ORDER BY g.goods_attr_id, a.sort_order, g.attr_price'
  7.     $res = $GLOBALS['db']->getAll($sql); 

情况二:在复制商品时属性排序跟原商品相反到处理,修改/inclues/lib_goods.php:

  1. function get_goods_attr($goods_id
  2.     $attr_list = array(); 
  3.     $sql = "SELECT a.attr_id, a.attr_name " . 
  4.             "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('attribute') . " AS a " . 
  5.             "WHERE g.goods_id = '$goods_id' " . 
  6.             "AND g.goods_type = a.cat_id " . 
  7.             "AND a.attr_type = 1".' ORDER BY a.attr_id'
  8.     $attr_id_list = $GLOBALS['db']->getCol($sql); 
  9.     $res = $GLOBALS['db']->query($sql); 
  10.     while ($attr = $GLOBALS['db']->fetchRow($res)) 
  11.     { 
  12.         if (defined('ECS_ADMIN')) 
  13.         { 
  14.             $attr['goods_attr_list'] = array(0 => $GLOBALS['_LANG']['select_please']); 
  15.         } 
  16.         else 
  17.         { 
  18.             $attr['goods_attr_list'] = array(); 
  19.         } 
  20.         $attr_list[$attr['attr_id']] = $attr
  21.     } 
  22.     $sql = "SELECT attr_id, goods_attr_id, attr_value " . 
  23.             "FROM " . $GLOBALS['ecs']->table('goods_attr') . 
  24.             " WHERE goods_id = '$goods_id' " . 
  25.             "AND attr_id " . db_create_in($attr_id_list).' ORDER BY goods_attr_id'
  26.     $res = $GLOBALS['db']->query($sql); 
  27.     while ($goods_attr = $GLOBALS['db']->fetchRow($res)) 
  28.     { //开源软件:phpfensi.com 
  29.         $attr_list[$goods_attr['attr_id']]['goods_attr_list'][$goods_attr['goods_attr_id']] = $goods_attr['attr_value']; 
  30.     } 
  31.     return $attr_list

补充:上面说的是同一属性里属性值的排序.

分享到:
ecshop购买商品时提示Select_spe未定义解...
ecshop购买商品时提示Select_spe未定义解决方法 ecshop客户反映,顾客购买商品时,提示JS错误:common.js 文件 Select_spe未定义 这里ECSHOP开发中心分析到其实是缺少JS 定义: function remove(id, url) {   if (document.getCookie("compareItems") != null)   {     va...
让ecshop的浏览历史排序显示方法 - ecsho...
让ecshop的浏览历史排序显示方法 具体的修改方法,如下,首先打开ecshop系统文件 includes/lib_insert.php,找到 insert_history() 函数部分,将: " WHERE $where AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0";//开源软件:phpfensi.com 修改为: " WHERE $where AND is_on_sal...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……