ecshop 属性筛选在category.php 页面显示顺序错误,调整和后台排序一致

在category.php 行 272处查找

$attr_list = $db->getAll($sql);
字样然后下面增加如下代码 
从phpsir_filter_code_start 到 phpsir_filter_code_end 中间部分
$attr_list = $db->getAll($sql);
//phpsir_filter_code_start
                $phpsir_tmp=$attr_list[0];
                $phpsir_sql= "select attr_values from " . $ecs->table('attribute') . " WHERE attr_id = '$phpsir_tmp[attr_id]' ";
                $phpsir_attribute = $db->getOne($phpsir_sql);  
                $phpsir_ga = explode("\n",$phpsir_attribute);
                $phpsir_new_attr_list = array();
                foreach($attr_list as $kk=>$vv)
                {
                    foreach($phpsir_ga as $kkk => $vvv){
                        if(trim($vv['attr_value']) == trim($vvv))
                        {
                            $phpsir_new_attr_list[$kkk] = $vv;
                        }
                    }
                }
                ksort($phpsir_new_attr_list);
                $attr_list = $phpsir_new_attr_list;
//phpsir_filter_code_end

前台显示例子如下

phpsir_filter_code1

 

代码在上面,或者如下图

phpsir_filter_code

 

 

发表评论

邮箱地址不会被公开。 必填项已用*标注