//fixed sql bad request in Cart::lastNoneOrderedCart() and in Cart::add()

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17289 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vAugagneur committed 2012-09-11 15:04:38 +00:00
1 parent d7613e2e76
commit 5c6f98a696
1 file changed
+4 -3
+4 -3
View File
@@ -172,6 +172,8 @@ class CartCore extends ObjectModel
{ {
if (!$this->id_lang) if (!$this->id_lang)
$this->id_lang = Configuration::get('PS_LANG_DEFAULT'); $this->id_lang = Configuration::get('PS_LANG_DEFAULT');
if (!$this->id_shop)
$this->id_shop = Context::getContext()->shop->id;
$return = parent::add($autodate); $return = parent::add($autodate);
Hook::exec('actionCartSave'); Hook::exec('actionCartSave');
@@ -2842,9 +2844,8 @@ class CartCore extends ObjectModel
{ {
$sql = 'SELECT c.`id_cart` $sql = 'SELECT c.`id_cart`
FROM '._DB_PREFIX_.'cart c FROM '._DB_PREFIX_.'cart c
LEFT JOIN '._DB_PREFIX_.'orders o ON (c.`id_cart` = o.`id_cart`) WHERE c.`id_cart` NOT IN (SELECT o.`id_cart` FROM '._DB_PREFIX_.'orders o)
WHERE c.`id_customer` = '.(int)$id_customer.' AND c.`id_customer` = '.(int)$id_customer.'
AND o.`id_cart` IS NULL
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'c').' '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'c').'
ORDER BY c.`date_upd` DESC'; ORDER BY c.`date_upd` DESC';