[-] MO : BugFix : #PSCFV-2830 : Product Comments module does not publish guest comment, returns exception.
This commit is contained in:
@@ -68,7 +68,7 @@ class ProductCommentsDefaultModuleFrontController extends ModuleFrontController
|
|||||||
$result = true;
|
$result = true;
|
||||||
$id_guest = 0;
|
$id_guest = 0;
|
||||||
$id_customer = $this->context->customer->id;
|
$id_customer = $this->context->customer->id;
|
||||||
if ($id_customer)
|
if (!$id_customer)
|
||||||
$id_guest = $this->context->cookie->id_guest;
|
$id_guest = $this->context->cookie->id_guest;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
@@ -99,10 +99,10 @@ class ProductCommentsDefaultModuleFrontController extends ModuleFrontController
|
|||||||
$comment = new ProductComment();
|
$comment = new ProductComment();
|
||||||
$comment->content = strip_tags(Tools::getValue('content'));
|
$comment->content = strip_tags(Tools::getValue('content'));
|
||||||
$comment->id_product = (int)Tools::getValue('id_product');
|
$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->id_guest = $id_guest;
|
||||||
$comment->customer_name = Tools::getValue('customer_name');
|
$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->customer_name = pSQL($this->context->customer->firstname.' '.$this->context->customer->lastname);
|
||||||
$comment->title = Tools::getValue('title');
|
$comment->title = Tools::getValue('title');
|
||||||
$comment->grade = 0;
|
$comment->grade = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user