[eluser]predat0r[/eluser]
[quote author="LuckyFella73" date="1297890000"]
Quote:... by filtering and sorting, too. Filtering is OK, but if I filter stg and then sort it, it sorts ALL the products not only the filtered products
It's hard to say without seeing the whole code. If you can
post the complete Model code (at least the method we are
talking about here) and the complete controller method the
chance would be much higher we can help you

[/quote]
sure, here they are
controller:
Code:
$man_value = $this->input->post('gyartok');
if(strlen($man_value) > 0) {
$filter = $this->input->post('gyartok');
} else {
$filter = '';
}
$srd = $this->input->post('sorrend');
if(strlen($srd) > 0) {
$order = $this->input->post('sorrend');
} else {
$order = '';
}
...
$data['listing'] = $this->MProducts->getProductByCategory($id, $config['per_page'], $this->uri->segment(5). $filter, $order);
...
model:
Code:
function getProductByCategory($catid, $limit, $offset, $filter = '', $order = '') {
$data = array();
$this->db->select('id,name,shortdesc,thumbnail,price,manufacturer_id');
$this->db->where('category_id', $catid);
$this->db->where('status', 'active');
if(strlen($filter) > 0) {
$this->db->where('manufacturer_id', $filter);
}
if(strlen($order) > 0) {
switch($order) {
case 'ASC' :
$this->db->order_by('name', 'ASC');
break;
case 'DESC' :
$this->db->order_by('name', 'DESC');
break;
case 'PASC' :
$this->db->order_by('price', 'ASC');
break;
case 'PDESC' :
$this->db->order_by('price', 'DESC');
break;
default:
$this->db->order_by('name', 'ASC');
break;
}
}
$this->db->limit($limit, $offset);
$Q = $this->db->get('products');
...
So some way I have to get remembered the manufacturer for sorting..