diff --git a/module/product/config.php b/module/product/config.php index 01a88fea57..11381d8923 100644 --- a/module/product/config.php +++ b/module/product/config.php @@ -1,5 +1,6 @@ product->productCounts = 50; +$config->product->orderBy = 'code'; global $lang, $app; $app->loadLang('story'); diff --git a/module/product/model.php b/module/product/model.php index 30d86e018b..d758bf78d3 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -167,12 +167,13 @@ class productModel extends model */ public function getPairs($mode = '') { - $mode .= $this->cookie->productMode; + $orderBy = !empty($this->config->product->orderBy) ? $this->config->product->orderBy : 'code'; + $mode .= $this->cookie->productMode; $products = $this->dao->select('*') ->from(TABLE_PRODUCT) ->where('deleted')->eq(0) ->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() - ->orderBy('code') + ->orderBy($orderBy) ->fetchAll(); $pairs = array(); foreach($products as $product)