ecshop商品属性按照添加顺序排列
来源:互联网 发布:医保 车祸 知乎 编辑:程序博客网 时间:2024/04/30 04:37
- ecshop商品属性按照添加顺序排列
- ECSHOP模板/ecshop开发中心(www.68ecshop.com) / 2014-07-30
客户在添加新产品时,让属性按照添加的顺序(属性id)排列,下面ecshop开发中心(www.68ecshop.com)教程说明
修改/inclues/lib_goods.php
/* 获得商品的规格 */
$sql = "SELECT a.attr_id, a.attr_name, a.attr_group, a.is_linked, a.attr_type, ".
"g.goods_attr_id, g.attr_value, g.attr_price " .
'FROM ' . $GLOBALS['ecs']->table('goods_attr') . ' AS g ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('attribute') . ' AS a ON a.attr_id = g.attr_id ' .
"WHERE g.goods_id = '$goods_id' " .
'ORDER BY g.goods_attr_id, a.sort_order, g.attr_price';
$res = $GLOBALS['db']->getAll($sql);
情况二:在复制商品时属性排序跟原商品相反到处理
修改/inclues/lib_goods.php
/**
* 取得商品属性
* @param int $goods_id 商品id
* @return array
*/
function get_goods_attr($goods_id)
{
$attr_list = array();
$sql = "SELECT a.attr_id, a.attr_name " .
"FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('attribute') . " AS a " .
"WHERE g.goods_id = '$goods_id' " .
"AND g.goods_type = a.cat_id " .
"AND a.attr_type = 1".' ORDER BY a.attr_id';
$attr_id_list = $GLOBALS['db']->getCol($sql);
$res = $GLOBALS['db']->query($sql);
while ($attr = $GLOBALS['db']->fetchRow($res))
{
if (defined('ECS_ADMIN'))
{
$attr['goods_attr_list'] = array(0 => $GLOBALS['_LANG']['select_please']);
}
else
{
$attr['goods_attr_list'] = array();
}
$attr_list[$attr['attr_id']] = $attr;
}
$sql = "SELECT attr_id, goods_attr_id, attr_value " .
"FROM " . $GLOBALS['ecs']->table('goods_attr') .
" WHERE goods_id = '$goods_id' " .
"AND attr_id " . db_create_in($attr_id_list).' ORDER BY goods_attr_id';
$res = $GLOBALS['db']->query($sql);
while ($goods_attr = $GLOBALS['db']->fetchRow($res))
{
$attr_list[$goods_attr['attr_id']]['goods_attr_list'][$goods_attr['goods_attr_id']] = $goods_attr['attr_value'];
}
return $attr_list;
}
- ecshop商品属性按照添加顺序排列
- ECshop 商品属性后台添加,前台显示
- ecshop 商品属性
- ecshop 批量添加商品
- 如何检测mysql 数据库执行了哪些sql语句 ecshop如何添加商品属性 ecshop 商品属性批量采集入库
- ECSHOP去除商品重复属性
- ecshop订单打印无法显示商品属性,前台商品属性
- ECSHOP批量上传加入自定义商品属性
- ecshop怎么得到商品属性的值
- ecshop二次开发之商品属性选择性遍历
- ecshop商品属性仿淘宝选择功能
- ecshop商品属性仿淘宝选择功能
- ecshop怎么得到商品属性的值
- ecshop二次开发 给商品添加自定义字段
- ecshop优化14-商品属性显示在商品详细页
- ecshop在商品详情页添加商品出售数…
- 商品添加-选择商品类型自动加载商品属性
- Oracle 按照指定顺序排列方法
- 编译原理课设实验报告
- Perl6 文件相关内容
- EPOLL事件之EPOLLRDHUP
- Android特效专辑(一)——水波纹过渡特效(首页)
- SSO
- ecshop商品属性按照添加顺序排列
- Easyui-DataGrid 查询,类序列化(构造匿名对象)
- epoll:EPOLLLT和EPOLLET的区别
- IOS和安卓ui设计常用尺寸及基本知识
- How to configure the kernel parameter "console"
- There is no getter for property named 'xxx' in 'class java.lang.Long'
- strong/weak/assign/copy/retain
- LeetCode 117:Populating Next Right Pointers in Each Node II
- 【Golang】【 Network programming with Go】 Templates(模版)