// Refactoring of shop class with new context Part 2
This commit is contained in:
@@ -132,7 +132,7 @@ class AuthControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('Invalid date of birth');
|
||||
if (!sizeof($this->errors))
|
||||
{
|
||||
if (Customer::customerExists(Tools::getValue('email'), false, true, (int)$this->id_current_group_shop, (int)$this->id_current_shop))
|
||||
if (Customer::customerExists(Tools::getValue('email')))
|
||||
$this->errors[] = Tools::displayError('An account is already registered with this e-mail, please fill in the password or request a new one.');
|
||||
if (Tools::isSubmit('newsletter'))
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ class CmsControllerCore extends FrontController
|
||||
parent::preProcess();
|
||||
|
||||
/* assignCase (1 = CMS page, 2 = CMS category) */
|
||||
if (Validate::isLoadedObject($this->cms) AND ($this->cms->isAssociatedToShop((int)$this->id_current_shop) AND $this->cms->active OR (Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS'.$this->cms->id) AND file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php'))))
|
||||
if (Validate::isLoadedObject($this->cms) AND ($this->cms->isAssociatedToShop() AND $this->cms->active OR (Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS'.$this->cms->id) AND file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php'))))
|
||||
$this->assignCase = 1;
|
||||
elseif (Validate::isLoadedObject($this->cms_category))
|
||||
$this->assignCase = 2;
|
||||
|
||||
@@ -105,7 +105,7 @@ class CartControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('Product not found');
|
||||
else
|
||||
{
|
||||
$producToAdd = new Product((int)($idProduct), true, (int)self::$cookie->id_lang, (int)$this->id_current_shop);
|
||||
$producToAdd = new Product((int)($idProduct), true, (int)self::$cookie->id_lang);
|
||||
if ((!$producToAdd->id OR !$producToAdd->active) AND !$delete)
|
||||
if (Tools::getValue('ajax') == 'true')
|
||||
die('{"hasError" : true, "errors" : ["'.Tools::displayError('Product is no longer available.', false).'"]}');
|
||||
|
||||
@@ -51,7 +51,7 @@ class CategoryControllerCore extends FrontController
|
||||
public function preProcess()
|
||||
{
|
||||
if ($id_category = (int)Tools::getValue('id_category'))
|
||||
$this->category = new Category($id_category, self::$cookie->id_lang, (int)$this->id_current_shop);
|
||||
$this->category = new Category($id_category, self::$cookie->id_lang);
|
||||
if (!Validate::isLoadedObject($this->category))
|
||||
{
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
|
||||
@@ -58,14 +58,14 @@ class CompareControllerCore extends FrontController
|
||||
|
||||
foreach ($ids AS $k => &$id)
|
||||
{
|
||||
$curProduct = new Product((int)$id, true, (int)self::$cookie->id_lang,(int)$this->id_current_shop);
|
||||
if (!$curProduct->active OR !$curProduct->isAssociatedToShop((int)$this->id_current_shop))
|
||||
$curProduct = new Product((int)$id, true, (int)self::$cookie->id_lang);
|
||||
if (!$curProduct->active OR !$curProduct->isAssociatedToShop())
|
||||
{
|
||||
unset($ids[$k]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$curProduct->active OR !$curProduct->isAssociatedToShop((int)$this->id_current_shop))
|
||||
if (!$curProduct->active OR !$curProduct->isAssociatedToShop())
|
||||
{
|
||||
unset($ids[$k]);
|
||||
continue;
|
||||
|
||||
@@ -103,7 +103,7 @@ class ContactControllerCore extends FrontController
|
||||
else
|
||||
{
|
||||
$customer = new Customer();
|
||||
$customer->getByEmail($from, NULL, (int)$this->id_current_group_shop, (int)$this->id_current_shop);
|
||||
$customer->getByEmail($from);
|
||||
}
|
||||
|
||||
$contact = new Contact($id_contact, self::$cookie->id_lang);
|
||||
|
||||
@@ -40,7 +40,7 @@ class ManufacturerControllerCore extends FrontController
|
||||
if ($id_manufacturer = Tools::getValue('id_manufacturer'))
|
||||
{
|
||||
$this->manufacturer = new Manufacturer((int)$id_manufacturer, self::$cookie->id_lang);
|
||||
if (Validate::isLoadedObject($this->manufacturer) AND $this->manufacturer->active AND $this->manufacturer->isAssociatedToGroupShop((int)$this->id_current_shop))
|
||||
if (Validate::isLoadedObject($this->manufacturer) AND $this->manufacturer->active AND $this->manufacturer->isAssociatedToGroupShop())
|
||||
{
|
||||
$nbProducts = $this->manufacturer->getProducts($id_manufacturer, NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
|
||||
$this->pagination((int)$nbProducts);
|
||||
|
||||
@@ -102,7 +102,7 @@ class ProductControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('Product not found');
|
||||
else
|
||||
{
|
||||
if (!Validate::isLoadedObject($this->product) OR !$this->product->isAssociatedToShop((int)$this->id_current_shop)
|
||||
if (!Validate::isLoadedObject($this->product) OR !$this->product->isAssociatedToShop()
|
||||
OR (!$this->product->active AND (Tools::getValue('adtoken') != Tools::encrypt('PreviewProduct'.$this->product->id))
|
||||
|| !file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php')))
|
||||
{
|
||||
@@ -160,16 +160,16 @@ class ProductControllerCore extends FrontController
|
||||
if (isset($regs[2]) AND is_numeric($regs[2]))
|
||||
{
|
||||
if (Product::idIsOnCategoryId((int)($this->product->id), array('0' => array('id_category' => (int)($regs[2])))))
|
||||
$category = new Category((int)($regs[2]), (int)self::$cookie->id_lang, (int)$this->id_current_shop);
|
||||
$category = new Category((int)($regs[2]), (int)self::$cookie->id_lang);
|
||||
}
|
||||
elseif (isset($regs[5]) AND is_numeric($regs[5]))
|
||||
{
|
||||
if (Product::idIsOnCategoryId((int)($this->product->id), array('0' => array('id_category' => (int)($regs[5])))))
|
||||
$category = new Category((int)($regs[5]), (int)self::$cookie->id_lang, (int)$this->id_current_shop);
|
||||
$category = new Category((int)($regs[5]), (int)self::$cookie->id_lang);
|
||||
}
|
||||
}
|
||||
if (!$category)
|
||||
$category = new Category($this->product->id_category_default, (int)self::$cookie->id_lang, (int)$this->id_current_shop);
|
||||
$category = new Category($this->product->id_category_default, (int)self::$cookie->id_lang);
|
||||
|
||||
if (isset($category) AND Validate::isLoadedObject($category))
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ class SupplierControllerCore extends FrontController
|
||||
if ($id_supplier = Tools::getValue('id_supplier'))
|
||||
{
|
||||
$this->supplier = new Supplier((int)$id_supplier, self::$cookie->id_lang);
|
||||
if (Validate::isLoadedObject($this->supplier) AND $this->supplier->active AND $this->supplier->isAssociatedToGroupShop((int)$this->id_current_shop))
|
||||
if (Validate::isLoadedObject($this->supplier) AND $this->supplier->active AND $this->supplier->isAssociatedToGroupShop())
|
||||
{
|
||||
$nbProducts = $this->supplier->getProducts($id_supplier, NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
|
||||
$this->pagination((int)$nbProducts);
|
||||
|
||||
Reference in New Issue
Block a user