From 6602ef5cc4f63cb9536fc2f3a1b79e2361b71426 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 28 May 2024 11:56:01 +0530 Subject: [PATCH] Added: The customer messages sent from the contact page will now also be segregated according to the contact selected by the customer --- classes/CustomerThread.php | 5 +++-- controllers/front/ContactController.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php index b6ec27283..70db8c507 100644 --- a/classes/CustomerThread.php +++ b/classes/CustomerThread.php @@ -140,14 +140,15 @@ class CustomerThreadCore extends ObjectModel return Db::getInstance()->executeS($sql); } - public static function getIdCustomerThreadByEmailAndIdOrder($email, $id_order) + public static function getIdCustomerThreadByEmailAndIdOrder($email, $id_order, $id_contact = false) { return Db::getInstance()->getValue(' SELECT cm.id_customer_thread FROM '._DB_PREFIX_.'customer_thread cm WHERE cm.email = \''.pSQL($email).'\' AND cm.id_shop = '.(int)Context::getContext()->shop->id.' - AND cm.id_order = '.(int)$id_order + AND cm.id_order = '.(int)$id_order.' '. + (($id_contact) ? ' AND cm.id_contact='.(int) $id_contact : ' ') ); } diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index ba68dd08c..8827ebdbf 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -77,7 +77,7 @@ class ContactControllerCore extends FrontController SELECT cm.id_customer_thread FROM '._DB_PREFIX_.'customer_thread cm WHERE cm.id_customer_thread = '.(int)$id_customer_thread.' AND cm.id_shop = '.(int)$this->context->shop->id.' AND token = \''.pSQL(Tools::getValue('token')).'\'') ) || ( - $id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, $id_order) + $id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, $id_order, $id_contact) ))) { $fields = Db::getInstance()->executeS(' SELECT cm.id_customer_thread, cm.id_contact, cm.id_customer, cm.id_order, cm.id_product, cm.email