Opencart 1.5.1.3 и ниже (admin): колонка SKU (поиск, фильтр, автодополнение, сортировка)

Opencart 1.5.1.3 (admin): products SKU column Opencart 1.5.1.3 (admin): products SKU column

Для OpenCart 1.5.1.3 в админ-части в список товаров добавлена колонка SKU (по-русски -- артикул или складской номер). В отличие от логики авторов поиск возможен по любому вхождению искомых символов - они могут встречаться в любом месте строчки SKU, а не только с её начала. Не знаю, почему у них везде так, мне гораздо удобнее без этого ограничения.

На свежую установку Opencart 1.5.1.3 можно залить поверх изменённые файлы (которые вы найдёте в папке admin внутри архива): oc1513-admin-sku-column.zip 25. Но если вы уже вносили свои изменения в эти файлы, надо вручную внести изменения (см. diff), чтобы не затереть предыдущие исправления.

commit 144af0b3466be74fb55f913686f96290b2c231a5
Author: Ruslan Brest <rb@labtodo.com>
Date:   Mon Oct 10 13:49:45 2011 +0300
    [+] admin: products SKU column (search, filter, autocomplete, sort)
diff --git a/upload/admin/controller/catalog/product.php b/upload/admin/controller/catalog/product.php
index 655b09d..72382b6 100644
--- a/upload/admin/controller/catalog/product.php
+++ b/upload/admin/controller/catalog/product.php
@@ -234,10 +234,16 @@ class ControllerCatalogProduct extends Controller {
        if (isset($this->request->get['filter_model'])) {
            $filter_model = $this->request->get['filter_model'];
        } else {
            $filter_model = null;
        }
+
+       if (isset($this->request->get['filter_sku'])) {
+           $filter_sku = $this->request->get['filter_sku'];
+       } else {
+           $filter_sku = null;
+       }
        
        if (isset($this->request->get['filter_price'])) {
            $filter_price = $this->request->get['filter_price'];
        } else {
            $filter_price = null;
@@ -280,10 +286,13 @@ class ControllerCatalogProduct extends Controller {
        }
        
        if (isset($this->request->get['filter_model'])) {
            $url .= '&filter_model=' . $this->request->get['filter_model'];
        }
+       if (isset($this->request->get['filter_sku'])) {
+           $url .= '&filter_sku=' . $this->request->get['filter_sku'];
+       }
        
        if (isset($this->request->get['filter_price'])) {
            $url .= '&filter_price=' . $this->request->get['filter_price'];
        }
        
@@ -328,10 +337,11 @@ class ControllerCatalogProduct extends Controller {
        $this->data['products'] = array();
 
        $data = array(
            'filter_name'     => $filter_name, 
            'filter_model'    => $filter_model,
+           'filter_sku'      => $filter_sku,
            'filter_price'    => $filter_price,
            'filter_quantity' => $filter_quantity,
            'filter_status'   => $filter_status,
            'sort'            => $sort,
            'order'           => $order,
@@ -373,10 +383,11 @@ class ControllerCatalogProduct extends Controller {
    
            $this->data['products'][] = array(
                'product_id' => $result['product_id'],
                'name'       => $result['name'],
                'model'      => $result['model'],
+               'sku'        => $result['sku'],
                'price'      => $result['price'],
                'special'    => $special,
                'image'      => $image,
                'quantity'   => $result['quantity'],
                'status'     => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
@@ -391,12 +402,13 @@ class ControllerCatalogProduct extends Controller {
        $this->data['text_disabled'] = $this->language->get('text_disabled');      
        $this->data['text_no_results'] = $this->language->get('text_no_results');      
        $this->data['text_image_manager'] = $this->language->get('text_image_manager');        
            
        $this->data['column_image'] = $this->language->get('column_image');        
-       $this->data['column_name'] = $this->language->get('column_name');      
+       $this->data['column_name']  = $this->language->get('column_name');     
        $this->data['column_model'] = $this->language->get('column_model');        
+       $this->data['column_sku']   = $this->language->get('entry_sku');       
        $this->data['column_price'] = $this->language->get('column_price');        
        $this->data['column_quantity'] = $this->language->get('column_quantity');      
        $this->data['column_status'] = $this->language->get('column_status');      
        $this->data['column_action'] = $this->language->get('column_action');      
                
@@ -428,10 +440,13 @@ class ControllerCatalogProduct extends Controller {
        }
        
        if (isset($this->request->get['filter_model'])) {
            $url .= '&filter_model=' . $this->request->get['filter_model'];
        }
+       if (isset($this->request->get['filter_sku'])) {
+           $url .= '&filter_sku=' . $this->request->get['filter_sku'];
+       }
        
        if (isset($this->request->get['filter_price'])) {
            $url .= '&filter_price=' . $this->request->get['filter_price'];
        }
        
@@ -453,10 +468,11 @@ class ControllerCatalogProduct extends Controller {
            $url .= '&page=' . $this->request->get['page'];
        }
                    
        $this->data['sort_name'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=pd.name' . $url, 'SSL');
        $this->data['sort_model'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.model' . $url, 'SSL');
+       $this->data['sort_sku']   = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.sku' . $url, 'SSL');
        $this->data['sort_price'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.price' . $url, 'SSL');
        $this->data['sort_quantity'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.quantity' . $url, 'SSL');
        $this->data['sort_status'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.status' . $url, 'SSL');
        $this->data['sort_order'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.sort_order' . $url, 'SSL');
        
@@ -467,10 +483,13 @@ class ControllerCatalogProduct extends Controller {
        }
        
        if (isset($this->request->get['filter_model'])) {
            $url .= '&filter_model=' . $this->request->get['filter_model'];
        }
+       if (isset($this->request->get['filter_sku'])) {
+           $url .= '&filter_sku=' . $this->request->get['filter_sku'];
+       }
        
        if (isset($this->request->get['filter_price'])) {
            $url .= '&filter_price=' . $this->request->get['filter_price'];
        }
        
@@ -499,10 +518,11 @@ class ControllerCatalogProduct extends Controller {
            
        $this->data['pagination'] = $pagination->render();
    
        $this->data['filter_name'] = $filter_name;
        $this->data['filter_model'] = $filter_model;
+       $this->data['filter_sku']   = $filter_sku;
        $this->data['filter_price'] = $filter_price;
        $this->data['filter_quantity'] = $filter_quantity;
        $this->data['filter_status'] = $filter_status;
        
        $this->data['sort'] = $sort;
@@ -649,10 +669,13 @@ class ControllerCatalogProduct extends Controller {
        }
        
        if (isset($this->request->get['filter_model'])) {
            $url .= '&filter_model=' . $this->request->get['filter_model'];
        }
+       if (isset($this->request->get['filter_sku'])) {
+           $url .= '&filter_sku=' . $this->request->get['filter_sku'];
+       }
        
        if (isset($this->request->get['filter_price'])) {
            $url .= '&filter_price=' . $this->request->get['filter_price'];
        }
        
@@ -1204,11 +1227,11 @@ class ControllerCatalogProduct extends Controller {
    }
        
    public function autocomplete() {
        $json = array();
        
-       if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model']) || isset($this->request->get['filter_category_id'])) {
+       if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model']) || isset($this->request->get['filter_sku']) || isset($this->request->get['filter_category_id'])) {
            $this->load->model('catalog/product');
            
            if (isset($this->request->get['filter_name'])) {
                $filter_name = $this->request->get['filter_name'];
            } else {
@@ -1218,11 +1241,17 @@ class ControllerCatalogProduct extends Controller {
            if (isset($this->request->get['filter_model'])) {
                $filter_model = $this->request->get['filter_model'];
            } else {
                $filter_model = '';
            }
-                       
+
+           if (isset($this->request->get['filter_sku'])) {
+               $filter_sku = $this->request->get['filter_sku'];
+           } else {
+               $filter_sku = '';
+           }
+
            if (isset($this->request->get['filter_category_id'])) {
                $filter_category_id = $this->request->get['filter_category_id'];
            } else {
                $filter_category_id = '';
            }
@@ -1240,10 +1269,11 @@ class ControllerCatalogProduct extends Controller {
            }           
                        
            $data = array(
                'filter_name'         => $filter_name,
                'filter_model'        => $filter_model,
+               'filter_sku'          => $filter_sku,
                'filter_category_id'  => $filter_category_id,
                'filter_sub_category' => $filter_sub_category,
                'start'               => 0,
                'limit'               => $limit
            );
@@ -1291,10 +1321,11 @@ class ControllerCatalogProduct extends Controller {
                
                $json[] = array(
                    'product_id' => $result['product_id'],
                    'name'       => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'),    
                    'model'      => $result['model'],
+                   'sku'        => $result['sku'],
                    'option'     => $option_data,
                    'price'      => $result['price']
                );  
            }
        }
diff --git a/upload/admin/model/catalog/product.php b/upload/admin/model/catalog/product.php
index b75d072..fab30d9 100644
--- a/upload/admin/model/catalog/product.php
+++ b/upload/admin/model/catalog/product.php
@@ -350,10 +350,13 @@ class ModelCatalogProduct extends Model {
            }
 
            if (!empty($data['filter_model'])) {
                $sql .= " AND LCASE(p.model) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_model'])) . "%'";
            }
+           if (!empty($data['filter_sku'])) {
+               $sql .= " AND LCASE(p.sku) LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_sku'])) . "%'";
+           }
            
            if (!empty($data['filter_price'])) {
                $sql .= " AND p.price LIKE '" . $this->db->escape($data['filter_price']) . "%'";
            }
            
@@ -388,10 +391,11 @@ class ModelCatalogProduct extends Model {
            $sql .= " GROUP BY p.product_id";
                        
            $sort_data = array(
                'pd.name',
                'p.model',
+               'p.sku',
                'p.price',
                'p.quantity',
                'p.status',
                'p.sort_order'
            );  
@@ -659,10 +663,14 @@ class ModelCatalogProduct extends Model {
 
        if (!empty($data['filter_model'])) {
            $sql .= " AND LCASE(p.model) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_model'])) . "%'";
        }
        
+       if (!empty($data['filter_sku'])) {
+           $sql .= " AND LCASE(p.sku) LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_sku'])) . "%'";
+       }
+       
        if (!empty($data['filter_price'])) {
            $sql .= " AND p.price LIKE '" . $this->db->escape($data['filter_price']) . "%'";
        }
        
        if (isset($data['filter_quantity']) && !is_null($data['filter_quantity'])) {
diff --git a/upload/admin/view/template/catalog/product_list.tpl b/upload/admin/view/template/catalog/product_list.tpl
index 25b90b3..c183b7d 100644
--- a/upload/admin/view/template/catalog/product_list.tpl
+++ b/upload/admin/view/template/catalog/product_list.tpl
@@ -31,10 +31,15 @@
               <td class="left"><?php if ($sort == 'p.model') { ?>
                 <a href="<?php echo $sort_model; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_model; ?></a>
                 <?php } else { ?>
                 <a href="<?php echo $sort_model; ?>"><?php echo $column_model; ?></a>
                 <?php } ?></td>
+              <td class="left"><?php if ($sort == 'p.sku') { ?>
+                <a href="<?php echo $sort_sku; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_sku; ?></a>
+                <?php } else { ?>
+                <a href="<?php echo $sort_sku; ?>"><?php echo $column_sku; ?></a>
+                <?php } ?></td>
               <td class="left"><?php if ($sort == 'p.price') { ?>
                 <a href="<?php echo $sort_price; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_price; ?></a>
                 <?php } else { ?>
                 <a href="<?php echo $sort_price; ?>"><?php echo $column_price; ?></a>
                 <?php } ?></td>
@@ -55,10 +60,11 @@
             <tr class="filter">
               <td></td>
               <td></td>
               <td><input type="text" name="filter_name" value="<?php echo $filter_name; ?>" /></td>
               <td><input type="text" name="filter_model" value="<?php echo $filter_model; ?>" /></td>
+              <td><input type="text" name="filter_sku" value="<?php echo $filter_sku; ?>" /></td>
               <td align="left"><input type="text" name="filter_price" value="<?php echo $filter_price; ?>" size="8"/></td>
               <td align="right"><input type="text" name="filter_quantity" value="<?php echo $filter_quantity; ?>" style="text-align: right;" /></td>
               <td><select name="filter_status">
                   <option value="*"></option>
                   <?php if ($filter_status) { ?>
@@ -83,10 +89,11 @@
                 <input type="checkbox" name="selected[]" value="<?php echo $product['product_id']; ?>" />
                 <?php } ?></td>
               <td class="center"><img src="<?php echo $product['image']; ?>" alt="<?php echo $product['name']; ?>" style="padding: 1px; border: 1px solid #DDDDDD;" /></td>
               <td class="left"><?php echo $product['name']; ?></td>
               <td class="left"><?php echo $product['model']; ?></td>
+              <td class="left"><?php echo $product['sku']; ?></td>
               <td class="left"><?php if ($product['special']) { ?>
                 <span style="text-decoration: line-through;"><?php echo $product['price']; ?></span>
                 <span style="color: #b00;"><?php echo $product['special']; ?></span>
                 <?php } else { ?>
                 <?php echo $product['price']; ?>
@@ -130,10 +137,16 @@ function filter() {
    
    if (filter_model) {
        url += '&filter_model=' + encodeURIComponent(filter_model);
    }
    
+   var filter_sku = $('input[name=\'filter_sku\']').attr('value');
+   
+   if (filter_sku) {
+       url += '&filter_sku=' + encodeURIComponent(filter_sku);
+   }
+   
    var filter_price = $('input[name=\'filter_price\']').attr('value');
    
    if (filter_price) {
        url += '&filter_price=' + encodeURIComponent(filter_price);
    }
@@ -204,7 +217,30 @@ $('input[name=\'filter_model\']').autocomplete({
        $('input[name=\'filter_model\']').val(ui.item.label);
                        
        return false;
    }
 });
+
+$('input[name=\'filter_sku\']').autocomplete({
+   delay: 0,
+   source: function(request, response) {
+       $.ajax({
+           url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_sku=' +  encodeURIComponent(request.term),
+           dataType: 'json',
+           success: function(json) {       
+               response($.map(json, function(item) {
+                   return {
+                       label: item.sku,
+                       value: item.product_id
+                   }
+               }));
+           }
+       });
+   }, 
+   select: function(event, ui) {
+       $('input[name=\'filter_sku\']').val(ui.item.label);
+                       
+       return false;
+   }
+});
 //--></script> 
 <?php echo $footer; ?>
\ No newline at end of file

И ещё найдите в .tpl файле строку

<td class="center" colspan="8"><?php echo $text_no_results; ?></td>

и увеличьте цифру на единичку (вместо 8 напишите 9). Забыл это, в diff-е этого нет. В архиве обновил.

Изменения для версий 1.5.1.2-1.5.0.5 (и наверное ниже в ветке 1.5.x)

В этих файлах у меня были и другие правки, поэтому готовые файлы не выкладываю.

commit e55686bfea6bf91b65c235d68c24ac7840139a89
Author: Ruslan Brest <rb@labtodo.com>
Date:   Mon Oct 10 21:47:01 2011 +0300
    [+] v1.5.1.2: admin: SKU column in product list
diff --git a/public_html/admin/controller/catalog/product.php b/public_html/admin/controller/catalog/product.php
index e407995..283e41b 100644
--- a/public_html/admin/controller/catalog/product.php
+++ b/public_html/admin/controller/catalog/product.php
@@ -253,10 +253,16 @@ class ControllerCatalogProduct extends Controller {
            $filter_model = $this->request->get['filter_model'];
        } else {
            $filter_model = null;
        }
 
+       if (isset($this->request->get['filter_sku'])) {
+           $filter_sku = $this->request->get['filter_sku'];
+       } else {
+           $filter_sku = null;
+       }
+
        if (isset($this->request->get['filter_price'])) {
            $filter_price = $this->request->get['filter_price'];
        } else {
            $filter_price = null;
        }
@@ -307,10 +313,14 @@ class ControllerCatalogProduct extends Controller {
 
        if (isset($this->request->get['filter_model'])) {
            $url .= '&filter_model=' . $this->request->get['filter_model'];
        }
 
+       if (isset($this->request->get['filter_sku'])) {
+           $url .= '&filter_sku=' . $this->request->get['filter_sku'];
+       }
+
        if (isset($this->request->get['filter_price'])) {
            $url .= '&filter_price=' . $this->request->get['filter_price'];
        }
 
        //filter category start//
@@ -360,10 +370,11 @@ class ControllerCatalogProduct extends Controller {
        $this->data['products'] = array();
 
        $data = array(
            'filter_name'     => $filter_name,
            'filter_model'    => $filter_model,
+           'filter_sku'      => $filter_sku,
            'filter_price'    => $filter_price,
            //filter category start//
            'filter_category' => $filter_category,
            // End
            'filter_quantity' => $filter_quantity,
@@ -417,10 +428,11 @@ class ControllerCatalogProduct extends Controller {
 
            $this->data['products'][] = array(
                'product_id' => $result['product_id'],
                'name'       => $result['name'],
                'model'      => $result['model'],
+               'sku'        => $result['sku'],
                'price'      => $this->currency->format($result['price']),
                //filter category start//
                'category'   => $category,
                        //filter category end//
                'special'    => $special['price'],
@@ -445,10 +457,11 @@ class ControllerCatalogProduct extends Controller {
        $this->data['column_name'] = $this->language->get('column_name');
        // Add
        $this->data['column_category'] = $this->language->get('column_category');
        // End add
        $this->data['column_model'] = $this->language->get('column_model');
+       $this->data['column_sku']   = $this->language->get('entry_sku');
        $this->data['column_price'] = $this->language->get('column_price');
        $this->data['column_quantity'] = $this->language->get('column_quantity');
        $this->data['column_status'] = $this->language->get('column_status');
        $this->data['column_action'] = $this->language->get('column_action');
 
@@ -481,10 +494,14 @@ class ControllerCatalogProduct extends Controller {
 
        if (isset($this->request->get['filter_model'])) {
            $url .= '&filter_model=' . $this->request->get['filter_model'];
        }
 
+       if (isset($this->request->get['filter_sku'])) {
+           $url .= '&filter_sku=' . $this->request->get['filter_sku'];
+       }
+
        if (isset($this->request->get['filter_price'])) {
            $url .= '&filter_price=' . $this->request->get['filter_price'];
        }
 
        if (isset($this->request->get['filter_quantity'])) {
@@ -505,10 +522,11 @@ class ControllerCatalogProduct extends Controller {
            $url .= '&page=' . $this->request->get['page'];
        }
 
        $this->data['sort_name'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=pd.name' . $url, 'SSL');
        $this->data['sort_model'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.model' . $url, 'SSL');
+       $this->data['sort_sku']   = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.sku' . $url, 'SSL');
        //filter category start//
         $this->data['sort_category'] = HTTPS_SERVER . 'index.php?route=catalog/product&token=' . $this->session->data['token'] . '&sort=p2c.category' . $url;
         //filter category end//
        $this->data['sort_price'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.price' . $url, 'SSL');
        $this->data['sort_quantity'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.quantity' . $url, 'SSL');
@@ -523,10 +541,14 @@ class ControllerCatalogProduct extends Controller {
 
        if (isset($this->request->get['filter_model'])) {
            $url .= '&filter_model=' . $this->request->get['filter_model'];
        }
 
+       if (isset($this->request->get['filter_sku'])) {
+           $url .= '&filter_sku=' . $this->request->get['filter_sku'];
+       }
+
        if (isset($this->request->get['filter_price'])) {
            $url .= '&filter_price=' . $this->request->get['filter_price'];
        }
 
        // Add
@@ -560,10 +582,11 @@ class ControllerCatalogProduct extends Controller {
 
        $this->data['pagination'] = $pagination->render();
 
        $this->data['filter_name'] = $filter_name;
        $this->data['filter_model'] = $filter_model;
+       $this->data['filter_sku']   = $filter_sku;
        $this->data['filter_price'] = $filter_price;
        // Add
         $this->data['filter_category'] = $filter_category;
         // End add
        $this->data['filter_quantity'] = $filter_quantity;
diff --git a/public_html/admin/model/catalog/product.php b/public_html/admin/model/catalog/product.php
index d0c3772..2fcb162 100644
--- a/public_html/admin/model/catalog/product.php
+++ b/public_html/admin/model/catalog/product.php
@@ -361,10 +361,14 @@ class ModelCatalogProduct extends Model {
 
            if (isset($data['filter_model']) && !is_null($data['filter_model'])) {
                $sql .= " AND LCASE(p.model) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_model'], 'UTF-8')) . "%'";
            }
 
+           if (isset($data['filter_sku']) && !is_null($data['filter_sku'])) {
+               $sql .= " AND LCASE(p.sku) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_sku'], 'UTF-8')) . "%'";
+           }
+
            if (isset($data['filter_price']) && !is_null($data['filter_price'])) {
                $sql .= " AND p.price LIKE '" . $this->db->escape($data['filter_price']) . "%'";
            }
 
            // Add Category Filter
@@ -385,10 +389,11 @@ class ModelCatalogProduct extends Model {
            }
 
            $sort_data = array(
                'pd.name',
                'p.model',
+               'p.sku',
                'p.price',
                // add
                 'p2c.category_id',
                // end
                'p.quantity',
@@ -671,10 +676,14 @@ class ModelCatalogProduct extends Model {
 
        if (isset($data['filter_model']) && !is_null($data['filter_model'])) {
            $sql .= " AND LCASE(p.model) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_model'], 'UTF-8')) . "%'";
        }
 
+       if (isset($data['filter_sku']) && !is_null($data['filter_sku'])) {
+           $sql .= " AND LCASE(p.sku) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_sku'], 'UTF-8')) . "%'";
+       }
+
        if (isset($data['filter_price']) && !is_null($data['filter_price'])) {
            $sql .= " AND p.price LIKE '" . $this->db->escape($data['filter_price']) . "%'";
        }
 
        // Add
diff --git a/public_html/admin/view/template/catalog/product_list.tpl b/public_html/admin/view/template/catalog/product_list.tpl
index a57163f..19a25fa 100644
--- a/public_html/admin/view/template/catalog/product_list.tpl
+++ b/public_html/admin/view/template/catalog/product_list.tpl
@@ -31,10 +31,15 @@
               <td class="left"><?php if ($sort == 'p.model') { ?>
                 <a href="<?php echo $sort_model; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_model; ?></a>
                 <?php } else { ?>
                 <a href="<?php echo $sort_model; ?>"><?php echo $column_model; ?></a>
                 <?php } ?></td>
+              <td class="left"><?php if ($sort == 'p.sku') { ?>
+                <a href="<?php echo $sort_sku; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_sku; ?></a>
+                <?php } else { ?>
+                <a href="<?php echo $sort_sku; ?>"><?php echo $column_sku; ?></a>
+                <?php } ?></td>
               <td class="left"><?php if ($sort == 'p.price') { ?>
                 <a href="<?php echo $sort_price; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_price; ?></a>
                 <?php } else { ?>
                 <a href="<?php echo $sort_price; ?>"><?php echo $column_price; ?></a>
                 <?php } ?></td>
@@ -60,10 +65,11 @@
             <tr class="filter">
               <td></td>
               <td></td>
               <td><input type="text" name="filter_name" value="<?php echo $filter_name; ?>" /></td>
               <td><input type="text" name="filter_model" value="<?php echo $filter_model; ?>" size="10" /></td>
+              <td><input type="text" name="filter_sku"   value="<?php echo $filter_sku; ?>" size="10" /></td>
               <td align="left"><input type="text" name="filter_price" value="<?php echo $filter_price; ?>" size="8"/></td>
               <td ><select name="filter_category" style="width: 100%;" >
               <option value="*"></option>
               <?php foreach ($categories as $category) { ?>
                 <?php if ($category['category_id']==$filter_category) { ?>
@@ -98,10 +104,11 @@
                 <input type="checkbox" name="selected[]" value="<?php echo $product['product_id']; ?>" />
                 <?php } ?></td>
               <td class="center"><img src="<?php echo $product['image']; ?>" width="<?php echo $product['image_width']; ?>" height="<?php echo $product['image_height']; ?>" alt="<?php echo $product['name']; ?>" style="padding: 1px; border: 1px solid #DDDDDD;" /></td>
               <td class="left"><?php echo $product['name']; ?></td>
               <td class="left"><?php echo $product['model']; ?></td>
+              <td class="left"><?php echo $product['sku']; ?></td>
               <td class="right">
                <?php if ($product['special']) { ?>
                 <span style="text-decoration:line-through"><?php echo $product['price']; ?></span>
<span style="color:#b00;"><?php echo $product['special']; ?></span>
                 <?php } else { ?>
                <?php echo $product['price']; ?>
@@ -126,11 +133,11 @@
                 <?php } ?></td>
             </tr>
             <?php } ?>
             <?php } else { ?>
             <tr>
-              <td class="center" colspan="8"><?php echo $text_no_results; ?></td>
+              <td class="center" colspan="10"><?php echo $text_no_results; ?></td>
             </tr>
             <?php } ?>
           </tbody>
         </table>
       </form>
@@ -152,10 +159,16 @@ function filter() {
 
    if (filter_model) {
        url += '&filter_model=' + encodeURIComponent(filter_model);
    }
 
+   var filter_sku = $('input[name=\'filter_sku\']').attr('value');
+
+   if (filter_sku) {
+       url += '&filter_sku=' + encodeURIComponent(filter_sku);
+   }
+
    var filter_price = $('input[name=\'filter_price\']').attr('value');
 
    if (filter_price) {
        url += '&filter_price=' + encodeURIComponent(filter_price);
    }