[+] FO : Messages in order detail are now stored in the Customer Service (SAV)
This commit is contained in:
@@ -55,5 +55,19 @@ class CustomerMessageCore extends ObjectModel
|
||||
$fields['date_add'] = pSQL($this->date_add);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public static function getMessagesByOrderId($id_order)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT cm.*, c.`firstname` AS cfirstname, c.`lastname` AS clastname, e.`firstname` AS efirstname, e.`lastname` AS elastname, (COUNT(cm.id_customer_message) = 0 AND ct.id_customer != 0) AS is_new_for_me
|
||||
FROM `'._DB_PREFIX_.'customer_message` cm
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_thread` ct ON ct.`id_customer_thread` = cm.`id_customer_thread`
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON ct.`id_customer` = c.`id_customer`
|
||||
LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = cm.`id_employee`
|
||||
WHERE ct.id_order = '.(int)$id_order.'
|
||||
GROUP BY cm.id_customer_message
|
||||
ORDER BY cm.date_add DESC');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,13 @@ class CustomerThreadCore extends ObjectModel
|
||||
SELECT * FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON ct.id_customer_thread = cm.id_customer_thread
|
||||
WHERE id_customer = '.(int)($id_customer));
|
||||
}
|
||||
}
|
||||
|
||||
public static function getIdCustomerThreadByEmailAndIdOrder($email, $id_order)
|
||||
{
|
||||
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->getId(true).' AND cm.id_order = '.(int)$id_order.'');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user