From eafa901c65e91fee3ea7ca79b7fcff27c8b4dd80 Mon Sep 17 00:00:00 2001 From: vChabot Date: Thu, 14 Jun 2012 13:32:53 +0000 Subject: [PATCH] [-] MO : BugFix : #PSCFV-2830 : Product Comments module does not publish guest comment, returns exception. --- modules/productcomments/controllers/front/default.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/productcomments/controllers/front/default.php b/modules/productcomments/controllers/front/default.php index 064426ada..f542d020a 100644 --- a/modules/productcomments/controllers/front/default.php +++ b/modules/productcomments/controllers/front/default.php @@ -68,7 +68,7 @@ class ProductCommentsDefaultModuleFrontController extends ModuleFrontController $result = true; $id_guest = 0; $id_customer = $this->context->customer->id; - if ($id_customer) + if (!$id_customer) $id_guest = $this->context->cookie->id_guest; $errors = array(); @@ -99,10 +99,10 @@ class ProductCommentsDefaultModuleFrontController extends ModuleFrontController $comment = new ProductComment(); $comment->content = strip_tags(Tools::getValue('content')); $comment->id_product = (int)Tools::getValue('id_product'); - $comment->id_customer = $id_customer; + $comment->id_customer = (int)$id_customer; $comment->id_guest = $id_guest; $comment->customer_name = Tools::getValue('customer_name'); - if (!$comment->id_customer) + if (!$comment->customer_name) $comment->customer_name = pSQL($this->context->customer->firstname.' '.$this->context->customer->lastname); $comment->title = Tools::getValue('title'); $comment->grade = 0;