// 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:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -46,7 +46,7 @@ class AdminAccountingManagementControllerCore extends AdminController
|
||||
$this->initToolbar();
|
||||
|
||||
$zones = Zone::getZones();
|
||||
$id_shop = $this->context->shop->getID();
|
||||
$id_shop = $this->context->shop->id;
|
||||
|
||||
// Set default zone value to the shop and sort it
|
||||
foreach ($zones as $zone)
|
||||
@@ -105,7 +105,7 @@ class AdminAccountingManagementControllerCore extends AdminController
|
||||
*/
|
||||
protected function updateAccountNumber()
|
||||
{
|
||||
$id_shop = $this->context->shop->getID();
|
||||
$id_shop = $this->context->shop->id;
|
||||
|
||||
// Update the current default shop account number
|
||||
Configuration::updateValue(
|
||||
|
||||
@@ -153,7 +153,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (a.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')';
|
||||
// we add restriction for shop
|
||||
if (Shop::CONTEXT_SHOP == Context::getContext()->shop() && $is_multishop)
|
||||
$this->_where = ' AND cs.`id_shop` = '.(int)Context::getContext()->shop->getID(true);
|
||||
$this->_where = ' AND cs.`id_shop` = '.(int)Context::getContext()->shop->id;
|
||||
|
||||
$categories_tree = $this->_category->getParentsCategories();
|
||||
if (empty($categories_tree)
|
||||
@@ -181,7 +181,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
parent::getList($id_lang, 'cs.position', $order_way, $start, $limit, Context::getContext()->shop->getID(true));
|
||||
parent::getList($id_lang, 'cs.position', $order_way, $start, $limit, Context::getContext()->shop->id);
|
||||
// Check each row to see if there are combinations and get the correct action in consequence
|
||||
|
||||
$nb_items = count($this->_list);
|
||||
@@ -271,7 +271,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
{
|
||||
$this->initToolbar();
|
||||
$obj = $this->loadObject(true);
|
||||
$id_shop = Context::getContext()->shop->getID(true);
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
$selected_cat = array((isset($obj->id_parent) && $obj->isParentCategoryAvailable($id_shop))? $obj->id_parent : Tools::getValue('id_parent', Category::getRootCategory()->id));
|
||||
$unidentified = new Group(Configuration::get('PS_UNIDENTIFIED_GROUP'));
|
||||
$guest = new Group(Configuration::get('PS_GUEST_GROUP'));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -513,7 +513,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
|
||||
public function beforeAdd($customer)
|
||||
{
|
||||
$customer->id_shop = $this->context->shop->getID(true);
|
||||
$customer->id_shop = $this->context->shop->id;
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
|
||||
@@ -229,11 +229,11 @@ class AdminGroupShopControllerCore extends AdminController
|
||||
'desc' => $this->l('Use this option to associate data (products, modules, etc.) the same way as the selected shop')
|
||||
);
|
||||
|
||||
$default_group_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
$this->tpl_form_vars = array(
|
||||
'disabled' => $disabled,
|
||||
'checked' => (Tools::getValue('addgroup_shop') !== false) ? true : false,
|
||||
'defaultGroup' => $default_group_shop->getGroupID(),
|
||||
'defaultGroup' => $default_shop->id_group_shop,
|
||||
);
|
||||
if (isset($this->fields_import_form))
|
||||
$this->tpl_form_vars = array_merge($this->tpl_form_vars, array('form_import' => $this->fields_import_form));
|
||||
|
||||
@@ -1139,7 +1139,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$specific_price = new SpecificPrice();
|
||||
$specific_price->id_product = (int)$product->id;
|
||||
// @todo multishop specific price import
|
||||
$specific_price->id_shop = $this->context->shop->getID(true);
|
||||
$specific_price->id_shop = $this->context->shop->id;
|
||||
$specific_price->id_currency = 0;
|
||||
$specific_price->id_country = 0;
|
||||
$specific_price->id_group = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -216,7 +216,7 @@ class AdminMetaControllerCore extends AdminController
|
||||
|
||||
public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, Context::getContext()->shop->getID(true));
|
||||
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, Context::getContext()->shop->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -633,7 +633,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
// If we install a module, force temporary global context for multishop
|
||||
if (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && $method != 'getContent')
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && $method != 'getContent')
|
||||
{
|
||||
Context::getContext()->tmpOldShop = clone(Context::getContext()->shop);
|
||||
Context::getContext()->shop = new Shop();
|
||||
@@ -677,9 +677,9 @@ class AdminModulesControllerCore extends AdminController
|
||||
$toolbar .= '<tr>
|
||||
<th colspan="4">
|
||||
<input type="checkbox" name="activateModule" value="1" '.(($module->active) ? 'checked="checked"' : '').' '.$activateOnclick.' /> '.$this->l('Activate module for').' ';
|
||||
if ($this->context->shop->getContextType() == Shop::CONTEXT_SHOP)
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
$toolbar .= 'shop <b>'.$this->context->shop->name.'</b>';
|
||||
elseif ($this->context->shop->getContextType() == Shop::CONTEXT_GROUP)
|
||||
elseif (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$toolbar .= 'all shops of group shop <b>'.$this->context->shop->getGroup()->name.'</b>';
|
||||
else
|
||||
$toolbar .= 'all shops';
|
||||
@@ -701,7 +701,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
$return = ($method == 'install' ? 12 : 13);
|
||||
elseif ($echo === false)
|
||||
$module_errors[] = array('name' => $name, 'message' => $module->getErrors());
|
||||
if (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && isset(Context::getContext()->tmpOldShop))
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && isset(Context::getContext()->tmpOldShop))
|
||||
{
|
||||
Context::getContext()->shop = clone(Context::getContext()->tmpOldShop);
|
||||
unset(Context::getContext()->tmpOldShop);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -278,14 +278,14 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
'modules' => $module_instances,
|
||||
'url_show_invisible' => self::$currentIndex.'&token='.$this->token.'&show_modules='.(int)Tools::getValue('show_modules').'&hook_position=',
|
||||
'hook_position' => Tools::getValue('hook_position'),
|
||||
'live_edit' => Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP,
|
||||
'live_edit' => Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP,
|
||||
'url_live_edit' => $this->context->link->getPageLink('index', false, null,
|
||||
'live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_)
|
||||
.(Shop::isFeatureActive()?'&id_shop='.Context::getContext()->shop->getID() : '')),
|
||||
.(Shop::isFeatureActive()?'&id_shop='.Context::getContext()->shop->id : '')),
|
||||
'display_key' => $this->display_key,
|
||||
'hooks' => $hooks,
|
||||
'url_submit' => self::$currentIndex.'&token='.$this->token,
|
||||
'can_move' => (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true,
|
||||
'can_move' => (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) ? false : true,
|
||||
));
|
||||
|
||||
return $this->createTemplate('list_modules.tpl')->fetch();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -321,7 +321,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$customer_thread = new CustomerThread();
|
||||
$customer_thread->id_contact = 0;
|
||||
$customer_thread->id_customer = (int)$order->id_customer;
|
||||
$customer_thread->id_shop = (int)$this->context->shop->getId(true);
|
||||
$customer_thread->id_shop = (int)$this->context->shop->id;
|
||||
$customer_thread->id_order = (int)$order->id;
|
||||
$customer_thread->id_lang = (int)$this->context->language->id;
|
||||
$customer_thread->email = $customer->email;
|
||||
@@ -1151,7 +1151,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$productObj = new Product((int)$product['id_product'], false, (int)$this->context->language->id);
|
||||
$combinations = array();
|
||||
$attributes = $productObj->getAttributesGroups((int)$this->context->language->id);
|
||||
$product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct((int)$product['id_product'], 0, (int)$this->context->shop->getID());
|
||||
$product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct((int)$product['id_product'], 0, (int)$this->context->shop->id);
|
||||
// Tax rate for this customer
|
||||
if (Tools::isSubmit('id_address'))
|
||||
$product['tax_rate'] = $productObj->getTaxesRate(new Address(Tools::getValue('id_address')));
|
||||
@@ -1174,7 +1174,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$combinations[$attribute['id_product_attribute']]['formatted_price'] = Tools::displayPrice(Tools::convertPrice($price_tax_incl, $currency), $currency);
|
||||
}
|
||||
if (!isset($combinations[$attribute['id_product_attribute']]['qty_in_stock']))
|
||||
$combinations[$attribute['id_product_attribute']]['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct((int)$product['id_product'], $attribute['id_product_attribute'], (int)$this->context->shop->getID());
|
||||
$combinations[$attribute['id_product_attribute']]['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct((int)$product['id_product'], $attribute['id_product_attribute'], (int)$this->context->shop->id);
|
||||
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)$product['advanced_stock_management'] == 1)
|
||||
$product['warehouse_list'][$attribute['id_product_attribute']] = Warehouse::getProductWarehouseList($product['id_product'], $attribute['id_product_attribute']);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -31,7 +31,7 @@ class AdminPaymentControllerCore extends AdminController
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$shop_id = Context::getContext()->shop->getID(true);
|
||||
$shop_id = Context::getContext()->shop->id;
|
||||
|
||||
/* Get all modules then select only payment ones */
|
||||
$modules = Module::getModulesOnDisk(true);
|
||||
@@ -108,11 +108,11 @@ class AdminPaymentControllerCore extends AdminController
|
||||
|
||||
protected function saveRestrictions($type)
|
||||
{
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_'.bqSQL($type).'` WHERE id_shop = '.Context::getContext()->shop->getID(true));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_'.bqSQL($type).'` WHERE id_shop = '.Context::getContext()->shop->id);
|
||||
foreach ($this->payment_modules as $module)
|
||||
if ($module->active && isset($_POST[$module->name.'_'.$type.'']))
|
||||
foreach ($_POST[$module->name.'_'.$type.''] as $selected)
|
||||
$values[] = '('.(int)$module->id.', '.Context::getContext()->shop->getID(true).', '.(int)$selected.')';
|
||||
$values[] = '('.(int)$module->id.', '.Context::getContext()->shop->id.', '.(int)$selected.')';
|
||||
|
||||
if (count($values))
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'module_'.$type.' (`id_module`, `id_shop`, `id_'.$type.'`) VALUES '.implode(',', $values));
|
||||
@@ -130,7 +130,7 @@ class AdminPaymentControllerCore extends AdminController
|
||||
$this->toolbar_title = $this->l('Paiement');
|
||||
unset($this->toolbar_btn['back']);
|
||||
|
||||
$shop_context = (!Shop::isFeatureActive() || $this->context->shop->getContextType() == Shop::CONTEXT_SHOP);
|
||||
$shop_context = (!Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP);
|
||||
if (!$shop_context)
|
||||
{
|
||||
$this->tpl_view_vars = array('shop_context' => $shop_context);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
*
|
||||
@@ -1521,7 +1521,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
// Save and preview
|
||||
if (Tools::isSubmit('submitAddProductAndPreview'))
|
||||
{
|
||||
$preview_url = $this->context->link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', $this->context->language->id), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id), null, null, Context::getContext()->shop->getID());
|
||||
$preview_url = $this->context->link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', $this->context->language->id), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id), null, null, Context::getContext()->shop->id);
|
||||
if (!$object->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
@@ -1909,7 +1909,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if ($id_category = (int)Tools::getValue('id_category'))
|
||||
self::$currentIndex .= '&id_category='.(int)$id_category;
|
||||
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : null, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : null, 0, null, $this->context->shop->getID(true));
|
||||
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : null, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : null, 0, null, $this->context->shop->id);
|
||||
|
||||
$id_category = (int)Tools::getValue('id_category', 1);
|
||||
$this->tpl_list_vars['is_category_filter'] = Tools::getValue('id_category') ? true : false;
|
||||
@@ -2172,7 +2172,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$preview_url = $this->context->link->getProductLink(
|
||||
$product,
|
||||
$this->getFieldValue($product, 'link_rewrite', $this->context->language->id),
|
||||
Category::getLinkRewrite($product->id_category_default, $this->context->language->id), null, null, Context::getContext()->shop->getID());
|
||||
Category::getLinkRewrite($product->id_category_default, $this->context->language->id), null, null, Context::getContext()->shop->id);
|
||||
if (!$product->active)
|
||||
{
|
||||
$preview_url = $this->context->link->getProductLink($product, $this->getFieldValue($product, 'link_rewrite', $this->default_form_language), Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id));
|
||||
@@ -2195,7 +2195,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (Validate::isLoadedObject(($product = new Product((int)Tools::getValue('id_product')))))
|
||||
{
|
||||
$id_shop = $this->context->shop->getID();
|
||||
$id_shop = $this->context->shop->id;
|
||||
|
||||
// If zone still exist, then update the database with the new value
|
||||
if (count($zones = Zone::getZones()))
|
||||
@@ -2466,7 +2466,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
$zones = Zone::getZones();
|
||||
$id_shop = $this->context->shop->getID();
|
||||
$id_shop = $this->context->shop->id;
|
||||
|
||||
// Set default zone value to the shop and sort it
|
||||
foreach ($zones as $zone)
|
||||
@@ -3468,7 +3468,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
// if quantities are shared between shops of the group, it's not possible to manage them for a given shop
|
||||
if ($group_shop->share_stock && $group_shop->getTotalShops() > 1)
|
||||
if ($group_shop->share_stock)
|
||||
$show_quantities = false;
|
||||
}
|
||||
|
||||
@@ -3830,7 +3830,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($this->tab_display_module).'\'');
|
||||
$this->tpl_form_vars['custom_form'] = Hook::exec('displayAdminProductsExtra', array(), (int)$id_module);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -467,7 +467,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
*/
|
||||
public function updateOptionPsLogo()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
if (isset($_FILES['PS_LOGO']['tmp_name']) && $_FILES['PS_LOGO']['tmp_name'])
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO'], 300000))
|
||||
@@ -494,7 +494,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
*/
|
||||
public function updateOptionPsLogoMail()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
if (isset($_FILES['PS_LOGO_MAIL']['tmp_name']) && $_FILES['PS_LOGO_MAIL']['tmp_name'])
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO_MAIL'], 300000))
|
||||
@@ -520,7 +520,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
*/
|
||||
public function updateOptionPsLogoInvoice()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
if (isset($_FILES['PS_LOGO_INVOICE']['tmp_name']) && $_FILES['PS_LOGO_INVOICE']['tmp_name'])
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO_INVOICE'], 300000))
|
||||
@@ -546,7 +546,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
*/
|
||||
public function updateOptionPsStoresIcon()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
if (isset($_FILES['PS_STORES_ICON']['tmp_name']) && $_FILES['PS_STORES_ICON']['tmp_name'])
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_STORES_ICON'], 300000))
|
||||
@@ -572,7 +572,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
*/
|
||||
public function updateOptionPsFavicon()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT'))
|
||||
$this->uploadIco('PS_FAVICON', _PS_IMG_DIR_.'favicon.ico');
|
||||
if ($this->uploadIco('PS_FAVICON', _PS_IMG_DIR_.'favicon-'.(int)$id_shop.'.ico'))
|
||||
|
||||
Reference in New Issue
Block a user