// Improve multishop API
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13566 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -164,7 +164,7 @@ class Blocknewsletter extends Module
|
||||
$sql = 'SELECT `email`
|
||||
FROM '._DB_PREFIX_.'newsletter
|
||||
WHERE `email` = \''.pSQL($customerEmail).'\'
|
||||
AND id_shop = '.$this->context->shop->getID(true);
|
||||
AND id_shop = '.$this->context->shop->id;
|
||||
|
||||
if (Db::getInstance()->getRow($sql))
|
||||
return self::GUEST_REGISTERED;
|
||||
@@ -172,7 +172,7 @@ class Blocknewsletter extends Module
|
||||
$sql = 'SELECT `newsletter`
|
||||
FROM '._DB_PREFIX_.'customer
|
||||
WHERE `email` = \''.pSQL($customerEmail).'\'
|
||||
AND id_shop = '.$this->context->shop->getID(true);
|
||||
AND id_shop = '.$this->context->shop->id;
|
||||
|
||||
if (!$registered = Db::getInstance()->getRow($sql))
|
||||
return self::GUEST_NOT_REGISTERED;
|
||||
@@ -199,13 +199,13 @@ class Blocknewsletter extends Module
|
||||
return $this->error = $this->l('E-mail address not registered');
|
||||
else if ($register_status == self::GUEST_REGISTERED)
|
||||
{
|
||||
if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'newsletter WHERE `email` = \''.pSQL($_POST['email']).'\' AND id_shop = '.$this->context->shop->getID(true)))
|
||||
if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'newsletter WHERE `email` = \''.pSQL($_POST['email']).'\' AND id_shop = '.$this->context->shop->id))
|
||||
return $this->error = $this->l('Error during unsubscription');
|
||||
return $this->valid = $this->l('Unsubscription successful');
|
||||
}
|
||||
else if ($register_status == self::CUSTOMER_REGISTERED)
|
||||
{
|
||||
if (!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'customer SET `newsletter` = 0 WHERE `email` = \''.pSQL($_POST['email']).'\' AND id_shop = '.$this->context->shop->getID(true)))
|
||||
if (!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'customer SET `newsletter` = 0 WHERE `email` = \''.pSQL($_POST['email']).'\' AND id_shop = '.$this->context->shop->id))
|
||||
return $this->error = $this->l('Error during unsubscription');
|
||||
return $this->valid = $this->l('Unsubscription successful');
|
||||
}
|
||||
@@ -298,7 +298,7 @@ class Blocknewsletter extends Module
|
||||
$sql = 'UPDATE '._DB_PREFIX_.'customer
|
||||
SET `newsletter` = 1, newsletter_date_add = NOW(), `ip_registration_newsletter` = \''.pSQL(Tools::getRemoteAddr()).'\'
|
||||
WHERE `email` = \''.pSQL($email).'\'
|
||||
AND id_shop = '.$this->context->shop->getID(true);
|
||||
AND id_shop = '.$this->context->shop->id;
|
||||
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
@@ -314,8 +314,8 @@ class Blocknewsletter extends Module
|
||||
{
|
||||
$sql = 'INSERT INTO '._DB_PREFIX_.'newsletter (id_shop, id_group_shop, email, newsletter_date_add, ip_registration_newsletter, http_referer, active)
|
||||
VALUES
|
||||
('.$this->context->shop->getID().',
|
||||
'.$this->context->shop->getGroupID().',
|
||||
('.$this->context->shop->id.',
|
||||
'.$this->context->shop->id_group_shop.',
|
||||
\''.pSQL($email).'\',
|
||||
NOW(),
|
||||
\''.pSQL(Tools::getRemoteAddr()).'\',
|
||||
|
||||
Reference in New Issue
Block a user