diff --git a/module/branch/control.php b/module/branch/control.php index 4c5d1ce618..1256f801d6 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -27,13 +27,17 @@ class branch extends control { $this->loadModel('product')->setMenu($productID); + $branchList = $this->branch->getList($productID, $browseType, $orderBy, $pager = null); + /* Load pager. */ + $recTotal = count($branchList); $this->app->loadClass('pager', $static = true); if($this->app->getViewType() == 'mhtml') $recPerPage = 10; $pager = new pager($recTotal, $recPerPage, $pageID); + $branchList = array_chunk($branchList, $pager->recPerPage); $this->view->title = $this->lang->branch->manage; - $this->view->branchList = $this->branch->getList($productID, $browseType, $orderBy, $pager); + $this->view->branchList = empty($branchList) ? $branchList : $branchList[$pageID - 1]; $this->view->productID = $productID; $this->view->browseType = $browseType; $this->view->orderBy = $orderBy; diff --git a/module/branch/model.php b/module/branch/model.php index 568bb4c475..32e4e36d1a 100644 --- a/module/branch/model.php +++ b/module/branch/model.php @@ -69,7 +69,6 @@ class branchModel extends model $mainBranch->desc = $this->lang->branch->mainBranch; $mainBranch->order = 0; - if($pager) $pager->recTotal = $pager->recTotal + 1; return array($mainBranch) + $branchList; } diff --git a/module/branch/view/edit.html.php b/module/branch/view/edit.html.php index 751cf45344..ce23a1d75d 100644 --- a/module/branch/view/edit.html.php +++ b/module/branch/view/edit.html.php @@ -13,7 +13,7 @@