按大小排序 [英] sort by size opencart

查看:85
本文介绍了按大小排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加一种新的排序方法,即在opencart中 按高度排序" .

I'm trying to add a new sorting method i'e "sort by height" in opencart.

位置是:catalog/model/catalog/product.php->在此处添加了p.height

$sort_data = array(
'pd.name',

'p.model',

'p.quantity',

'p.price',

'rating',

'p.sort_order',

'p.date_added',

'p.height'
);  

B.在同一文件中

elseif($data['sort'] == 'p.height' ){   

    $sql .= " ORDER BY(" . $data['sort'] . ")ASC";

       /*$sql .= "SELECT * FROM". DB_PREFIX . "product p ORDER BY p.height DESC";*/
}

C.位置是:/catalog/controller/product/category.php

        $this->data['sorts'][] = array(

            'text'  => $this->language->get('text_size_asc'),

            'value' => 'height-ASC',

            'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=height&order=ASC' . $url)

        );

结果是我可以在选项中看到按高度排序",但是当我选择它返回默认排序值时没有任何反应.

Result is i can see "sort by height" in option but nothing happens when i select it returns the default sort value.

有人可以建议我做错了什么吗?

Can any one suggest where i am doing wrong?

推荐答案

应该为p.height-ASC而不是height-ASC对于'value'键,否则它将无法识别它.您还需要在'url'键中将&sort=height更改为&sort=p.height

It should be p.height-ASC not height-ASC For the 'value' key otherwise it does not recognise it. You also need to change &sort=height to &sort=p.height in the 'url' key

这篇关于按大小排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆