From f2bcc2f19c95431f355d188e3d38caa12be2e0d7 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 8 Sep 2020 09:27:22 +0800 Subject: [PATCH] * Fix bug #3456. --- module/design/control.php | 47 ++++++++++++++++++++++++++++----------- module/design/model.php | 2 +- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/module/design/control.php b/module/design/control.php index b0521dad35..55bb5bfa0f 100644 --- a/module/design/control.php +++ b/module/design/control.php @@ -11,23 +11,44 @@ */ class design extends control { - /** - * Browse designs. - * - * @param int $productID - * @param string $type all|bySearch|HLDS|DDS|DBDS|ADS - * @param string $param - * @param string $orderBy - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID - * @access public - * @return void - */ + public $products = array(); + + /** + * Construct function, load module auto. + * + * @param string $moduleName + * @param string $methodName + * @access public + * @return void + */ + public function __construct($moduleName = '', $methodName = '') + { + parent::__construct($moduleName, $methodName); + $products = array(); + $this->loadModel('product'); + $this->view->products = $this->products = $this->product->getPairs('nocode', $this->session->program); + + if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=design"))); + } + + /** + * Browse designs. + * + * @param int $productID + * @param string $type all|bySearch|HLDS|DDS|DBDS|ADS + * @param string $param + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID + * @access public + * @return void + */ public function browse($productID = 0, $type = 'all', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save session for design list and process product id. */ $this->session->set('designList', $this->app->getURI(true)); + $productID = $this->product->saveState($productID, $this->products); $this->design->setProductMenu($productID); /* Build the search form. */ diff --git a/module/design/model.php b/module/design/model.php index 53a26773f7..1b609000d6 100644 --- a/module/design/model.php +++ b/module/design/model.php @@ -73,7 +73,7 @@ class designModel extends model if(!trim($name)) continue; $design = new stdclass(); - $design->story = $data->story[$i]; + $design->story = isset($data->story[$i]) ? $data->story[$i] : ''; $design->type = $data->type[$i]; $design->name = $name; $design->product = $productID;