Added: The customer messages sent from the contact page will now also be segregated according to the contact selected by the customer

This commit is contained in:
vishalsingh.qlo325
2024-05-28 11:56:01 +05:30
parent 19c4e45320
commit 6602ef5cc4
2 changed files with 4 additions and 3 deletions

View File

@@ -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 : ' ')
);
}

View File

@@ -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