// improve multishop code with id_shop = 0 when share_customer or share_order is true
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11169 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+4
-2
@@ -171,7 +171,8 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
if (!$this->id_lang)
|
||||
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
if (Context::getContext()->shop->getGroup()->share_order == true)
|
||||
$this->id_shop = null;
|
||||
$return = parent::add($autodate);
|
||||
Hook::exec('cart');
|
||||
|
||||
@@ -185,7 +186,8 @@ class CartCore extends ObjectModel
|
||||
|
||||
if (isset(self::$_totalWeight[$this->id]))
|
||||
unset(self::$_totalWeight[$this->id]);
|
||||
|
||||
if (Context::getContext()->shop->getGroup()->share_order == true)
|
||||
$this->id_shop = null;
|
||||
$this->_products = null;
|
||||
$return = parent::update();
|
||||
Hook::exec('cart');
|
||||
|
||||
@@ -187,7 +187,10 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
public function add($autodate = true, $null_values = true)
|
||||
{
|
||||
$this->id_shop = ($this->id_shop) ? $this->id_shop : Context::getContext()->shop->getID();
|
||||
if (Context::getContext()->shop->getGroup()->share_customer == true)
|
||||
$this->id_shop = null;
|
||||
else
|
||||
$this->id_shop = ($this->id_shop) ? $this->id_shop : Context::getContext()->shop->getID();
|
||||
$this->id_group_shop = ($this->id_group_shop) ? $this->id_group_shop : Context::getContext()->shop->getGroupID();
|
||||
$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
|
||||
$this->secure_key = md5(uniqid(rand(), true));
|
||||
|
||||
@@ -298,6 +298,21 @@ class OrderCore extends ObjectModel
|
||||
$this->_taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
if (Context::getContext()->shop->getGroup()->share_order == true)
|
||||
$this->id_shop = null;
|
||||
return parent::add($autodate);
|
||||
}
|
||||
|
||||
public function update($null_values = false)
|
||||
{
|
||||
if (Context::getContext()->shop->getGroup()->share_order == true)
|
||||
$this->id_shop = null;
|
||||
$return = parent::update();
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function getTaxCalculationMethod()
|
||||
{
|
||||
return (int)($this->_taxCalculationMethod);
|
||||
|
||||
@@ -758,12 +758,13 @@ class ShopCore extends ObjectModel
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($shop_id || $shop_group_id)
|
||||
if ($shop_group_id && ($share == Shop::SHARE_CUSTOMER || $share == Shop::SHARE_ORDER))
|
||||
$restriction = ' AND '.$alias.'id_group_shop = '.$shop_group_id.' AND '.$alias.'id_shop = 0';
|
||||
else if ($shop_id || $shop_group_id)
|
||||
$restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', $this->getListOfID($share)).') ';
|
||||
//else if ($share == Shop::SHARE_STOCK)
|
||||
// $restriction = ' AND '.$alias.'id_shop = '.$this->getID(true);
|
||||
}
|
||||
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user