// Context part 16 (shops)

This commit is contained in:
rMalie committed 2011-07-20 12:08:15 +00:00
1 parent 02a738dce1
commit 73d6f4267b
27 files changed
+394 -351

No files matched your search

+5 -5
View File
@@ -140,13 +140,13 @@ class Blocknewsletter extends Module
{
$sql = 'SELECT `email` FROM '._DB_PREFIX_.'newsletter
WHERE `email` = \''.pSQL($customerEmail).'\'
AND id_shop = '.$this->context->shop->getID();
AND id_shop = '.$this->context->shop->getID(true);
if (Db::getInstance()->getRow($sql))
return 1;
$sql = 'SELECT `newsletter` FROM '._DB_PREFIX_.'customer
WHERE `email` = \''.pSQL($customerEmail).'\'
AND id_shop = '.$this->context->shop->getID();
AND id_shop = '.$this->context->shop->getID(true);
if (!$registered = Db::getInstance()->getRow($sql))
return -1;
@@ -172,14 +172,14 @@ class Blocknewsletter extends Module
/* If the user ins't a customer */
elseif ($registerStatus == 1)
{
if (!Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'newsletter WHERE `email` = \''.pSQL($_POST['email']).'\' AND id_shop = '.$this->context->shop->getID()))
if (!Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'newsletter WHERE `email` = \''.pSQL($_POST['email']).'\' AND id_shop = '.$this->context->shop->getID(true)))
return $this->error = $this->l('Error during unsubscription');
return $this->valid = $this->l('Unsubscription successful');
}
/* If the user is a customer */
elseif ($registerStatus == 2)
{
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer SET `newsletter` = 0 WHERE `email` = \''.pSQL($_POST['email']).'\' AND id_shop = '.$this->context->shop->getID()))
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer SET `newsletter` = 0 WHERE `email` = \''.pSQL($_POST['email']).'\' AND id_shop = '.$this->context->shop->getID(true)))
return $this->error = $this->l('Error during unsubscription');
return $this->valid = $this->l('Unsubscription successful');
}
@@ -210,7 +210,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($_POST['email']).'\'
AND id_shop = '.$this->context->shop->getID();
AND id_shop = '.$this->context->shop->getID(true);
if (!Db::getInstance()->Execute($sql))
return $this->error = $this->l('Error during subscription');
$this->sendVoucher(pSQL($_POST['email']));