//oups part 2

This commit is contained in:
vAugagneur
2012-09-04 12:39:56 +00:00
parent 0a41c84666
commit 0351df3e67
2 changed files with 9 additions and 5 deletions
+7 -5
View File
@@ -72,15 +72,17 @@ class CustomerThreadCore extends ObjectModel
return (parent::delete());
}
public static function getCustomerMessages($id_customer)
public static function getCustomerMessages($id_customer, $read = null)
{
return Db::getInstance()->executeS('
SELECT *
$sql = '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
);
WHERE id_customer = '.(int)$id_customer;
if (!is_null($read))
$sql .= ' AND cm.`read` = '.(int)$read;
return Db::getInstance()->executeS($sql);
}
public static function getIdCustomerThreadByEmailAndIdOrder($email, $id_order)