From be832748762ad165f4517db537bb2fc454ad301d Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 2 Dec 2021 08:43:44 +0800 Subject: [PATCH 1/2] * Fix the problem of recording product cookies. --- module/product/model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/product/model.php b/module/product/model.php index cdd297a104..0631a31a45 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -156,9 +156,10 @@ class productModel extends model $this->session->set('product', (int)$productID, $this->app->tab); if($productID && strpos(",{$this->app->user->view->products},", ",{$productID},") === false) $this->accessDenied(); - setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); } + setcookie('preProductID', (int)$productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); + if($this->cookie->preProductID != $this->session->product) { setcookie('preBranch', 0, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); From 00ac35c9db02f2d0fc1a466baf4aed6b2bb8a2aa Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 2 Dec 2021 08:46:01 +0800 Subject: [PATCH 2/2] * Delete extra blank lines. --- module/product/model.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/product/model.php b/module/product/model.php index 0631a31a45..a5dc64c566 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -155,7 +155,6 @@ class productModel extends model if(empty($product)) $productID = key($products); $this->session->set('product', (int)$productID, $this->app->tab); if($productID && strpos(",{$this->app->user->view->products},", ",{$productID},") === false) $this->accessDenied(); - } setcookie('preProductID', (int)$productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);