// 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:
rMalie
2012-02-23 15:39:44 +00:00
parent ec8f05c3ca
commit b24dcffc9c
71 changed files with 377 additions and 425 deletions
@@ -67,7 +67,7 @@ class BlockAdvertising extends Module
$this->displayName = $this->l('Block advertising');
$this->description = $this->l('Adds a block to display an advertisement.');
if ($this->context->shop->getContextType() == Shop::CONTEXT_SHOP)
if (Shop::getContext() == Shop::CONTEXT_SHOP)
{
if (defined('_PS_ADMIN_DIR_') || file_exists(_PS_MODULE_DIR_.$this->name.'/'.$this->adv_imgname.'-'.(int)$this->context->shop->id.'.'.Configuration::get('BLOCKADVERT_IMG_EXT')))
{
+4 -4
View File
@@ -156,7 +156,7 @@ class BlockCategories extends Module
public function hookLeftColumn($params)
{
$id_current_shop = $this->context->shop->getID();
$id_current_shop = $this->context->shop->id;
$id_customer = (int)($params['cookie']->id_customer);
// Get all groups for this customer and concatenate them as a string: "1,2,3..."
@@ -176,7 +176,7 @@ class BlockCategories extends Module
FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->addSqlRestrictionOnLang('cl').')
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = '.(int)Context::getContext()->shop->getID(true).')
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = '.(int)Context::getContext()->shop->id.')
WHERE (c.`active` = 1 OR c.`id_category` = 1)
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
AND cg.`id_group` IN ('.pSQL($groups).')
@@ -191,7 +191,7 @@ class BlockCategories extends Module
WHERE (c.`active` = 1 OR c.`id_category` = 1)
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
AND cg.`id_group` IN ('.pSQL($groups).')
AND cs.`id_shop` = '.(int)Context::getContext()->shop->getID(true).'
AND cs.`id_shop` = '.(int)Context::getContext()->shop->id.'
GROUP BY id_category
ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'c.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC')))
@@ -241,7 +241,7 @@ class BlockCategories extends Module
public function hookFooter($params)
{
$id_current_shop = $this->context->shop->getID();
$id_current_shop = $this->context->shop->id;
$id_customer = (int)($params['cookie']->id_customer);
// Get all groups for this customer and concatenate them as a string: "1,2,3..."
+5 -5
View File
@@ -258,7 +258,7 @@ class BlockCMSModel extends ObjectModel
public static function getCMSTitlesFooter()
{
$context = Context::getContext();
$footerCms = Configuration::get('FOOTER_CMS', null, $context->shop->getGroupID(), $context->shop->getID());
$footerCms = Configuration::get('FOOTER_CMS');
if (empty($footerCms))
return array();
@@ -339,7 +339,7 @@ class BlockCMSModel extends ObjectModel
WHERE bc.`location` = '.(int)($location).'
AND ccl.`id_lang` = '.(int)$context->language->id.'
AND bcl.`id_lang` = '.(int)$context->language->id.'
AND bcs.id_shop = '.($id_shop ? (int)$id_shop : (int)$context->shop->getID()).'
AND bcs.id_shop = '.($id_shop ? (int)$id_shop : (int)$context->shop->id).'
ORDER BY `position`';
return Db::getInstance()->executeS($sql);
@@ -347,7 +347,7 @@ class BlockCMSModel extends ObjectModel
public static function getCMSPages($id_cms_category, $id_shop = false)
{
$id_shop = ($id_shop !== false) ? $id_shop : Context::getContext()->shop->getID();
$id_shop = ($id_shop !== false) ? $id_shop : Context::getContext()->shop->id;
$sql = 'SELECT c.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms` c
@@ -467,7 +467,7 @@ class BlockCMSModel extends ObjectModel
WHERE ccl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bcl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bc.`location` = '.(int)$location.'
AND bcs.id_shop = '.($id_shop ? (int)$id_shop : (int)$context->shop->getID()).'
AND bcs.id_shop = '.($id_shop ? (int)$id_shop : (int)$context->shop->id).'
ORDER BY bc.`position`';
return Db::getInstance()->executeS($sql);
@@ -493,7 +493,7 @@ class BlockCMSModel extends ObjectModel
public static function getAllCMSStructure($id_shop = false)
{
$categories = BlockCMSModel::getCMSCategories();
$id_shop = ($id_shop !== false) ? $id_shop : Context::getContext()->shop->getID();
$id_shop = ($id_shop !== false) ? $id_shop : Context::getContext()->shop->id;
foreach ($categories as $key => $value)
$categories[$key]['cms_pages'] = BlockCMSModel::getCMSPages($value['id_cms_category'], $id_shop);
+15 -18
View File
@@ -55,9 +55,9 @@ class BlockCms extends Module
if (!parent::install() ||
!$this->registerHooks() ||
!BlockCMSModel::createTables() ||
!Configuration::updateValue('FOOTER_CMS', '', false, $this->context->shop->getGroupID(), $this->context->shop->getID()) ||
!Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1, false, $this->context->shop->getGroupID(), $this->context->shop->getID()) ||
!Configuration::updateValue('FOOTER_POWEREDBY', 1, false, $this->context->shop->getGroupID(), $this->context->shop->getID()))
!Configuration::updateValue('FOOTER_CMS', '') ||
!Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1) ||
!Configuration::updateValue('FOOTER_POWEREDBY', 1))
return false;
// Install fixtures for blockcms
@@ -244,19 +244,19 @@ class BlockCms extends Module
);
$this->context->controller->getLanguages();
$tmp = Configuration::get('FOOTER_CMS', null, $this->context->shop->getGroupID(), $this->context->shop->getID());
$tmp = Configuration::get('FOOTER_CMS');
$footer_boxes = explode('|', $tmp);
if ($footer_boxes && is_array($footer_boxes))
foreach ($footer_boxes as $key => $value)
$this->fields_value[$value] = true;
$this->fields_value['cms_footer_on'] = Configuration::get('FOOTER_BLOCK_ACTIVATION', null, $this->context->shop->getGroupID(), $this->context->shop->getID());
$this->fields_value['cms_footer_powered_by_on'] = Configuration::get('FOOTER_POWEREDBY', null, $this->context->shop->getGroupID(), $this->context->shop->getID());
$this->fields_value['cms_footer_on'] = Configuration::get('FOOTER_BLOCK_ACTIVATION');
$this->fields_value['cms_footer_powered_by_on'] = Configuration::get('FOOTER_POWEREDBY');
foreach ($this->context->controller->_languages as $language)
{
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.$language['id_lang'], null, $this->context->shop->getGroupID(), $this->context->shop->getID());
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.$language['id_lang']);
$this->fields_value['footer_text'][$language['id_lang']] = $footer_text;
}
@@ -556,7 +556,7 @@ class BlockCms extends Module
foreach ($this->context->controller->_languages as $language)
BlockCMSModel::insertCMSBlockLang($id_cms_block, $language['id_lang']);
BlockCMSModel::insertCMSBlockShop($id_cms_block, $this->context->shop->getGroupID(), $this->context->shop->getID());
BlockCMSModel::insertCMSBlockShop($id_cms_block, Shop::getContextGroupShopID(), Shop::getContextShopID());
}
$this->_errors[] = $this->l('New block cannot be created !');
@@ -622,9 +622,9 @@ class BlockCms extends Module
$footer_boxes = Tools::getValue('footerBox') ? implode('|', Tools::getValue('footerBox')) : '';
$block_activation = (Tools::getValue('cms_footer_on') == 1) ? 1 : 0;
Configuration::updateValue('FOOTER_CMS', rtrim($footer_boxes, '|'), false, $this->context->shop->getGroupID(), $this->context->shop->getID());
Configuration::updateValue('FOOTER_POWEREDBY', $powered_by, false, $this->context->shop->getGroupID(), $this->context->shop->getID());
Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', $block_activation, false, $this->context->shop->getGroupID(), $this->context->shop->getID());
Configuration::updateValue('FOOTER_CMS', rtrim($footer_boxes, '|'));
Configuration::updateValue('FOOTER_POWEREDBY', $powered_by);
Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', $block_activation);
$this->_html .= $this->displayConfirmation($this->l('Footer\'s informations updated'));
}
@@ -688,17 +688,14 @@ class BlockCms extends Module
public function hookFooter()
{
$context = Context::getContext();
$shop_id = $context->shop->getID();
$shop_group_id = $context->shop->getGroupID();
$block_activation = Configuration::get('FOOTER_BLOCK_ACTIVATION', null, $shop_group_id, $shop_id);
$block_activation = Configuration::get('FOOTER_BLOCK_ACTIVATION');
if ($block_activation)
{
$cms_titles = BlockCMSModel::getCMSTitlesFooter();
$display_footer = Configuration::get('PS_STORES_DISPLAY_FOOTER', null, $shop_group_id, $shop_id);
$display_poweredby = Configuration::get('FOOTER_POWEREDBY', null, $shop_group_id, $shop_id);
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.(int)$context->language->id);
$display_footer = Configuration::get('PS_STORES_DISPLAY_FOOTER');
$display_poweredby = Configuration::get('FOOTER_POWEREDBY');
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id);
$this->smarty->assign(
array(
+1 -1
View File
@@ -57,7 +57,7 @@ class BlockLanguages extends Module
*/
public function hookTop($params)
{
$languages = Language::getLanguages(true, $this->context->shop->getID());
$languages = Language::getLanguages(true, $this->context->shop->id);
if (!count($languages))
return;
$link = new Link();
+6 -6
View File
@@ -1327,7 +1327,7 @@ class BlockLayered extends Module
}
}
else
$shop_list = array(Context::getContext()->shop->getID(true));
$shop_list = array(Context::getContext()->shop->id);
}
else
$shop_list = array(0);
@@ -2221,7 +2221,7 @@ class BlockLayered extends Module
if (version_compare(_PS_VERSION_,'1.5','>'))
{
$queryFiltersWhere .= ' AND sa.quantity '.(!$selectedFilters['quantity'][0] ? '<=' : '>').' 0 ';
$queryFiltersFrom .= 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.id_product = p.id_product AND sa.id_shop = '.(int)Context::getContext()->shop->getID(true).') ';
$queryFiltersFrom .= 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.id_product = p.id_product AND sa.id_shop = '.(int)Context::getContext()->shop->id.') ';
}
else
$queryFiltersWhere .= ' AND p.quantity '.(!$selectedFilters['quantity'][0] ? '<=' : '>').' 0 ';
@@ -2376,7 +2376,7 @@ class BlockLayered extends Module
$parent = new Category((int)$id_parent);
if (version_compare(_PS_VERSION_,'1.5','>'))
$id_shop = (int) Context::getContext()->shop->getId(true);
$id_shop = (int) Context::getContext()->shop->id;
else
$id_shop = 0;
@@ -2426,7 +2426,7 @@ class BlockLayered extends Module
AND c.active = 1) ';
if (version_compare(_PS_VERSION_,'1.5','>'))
$sqlQuery['join'] .= 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sa
ON (sa.id_product = p.id_product AND sa.id_shop = '.(int)$this->context->shop->getID(true).') ';
ON (sa.id_product = p.id_product AND sa.id_shop = '.(int)$this->context->shop->id.') ';
$sqlQuery['where'] = 'WHERE p.`active` = 1 ';
$sqlQuery['group'] = ' GROUP BY p.id_product ';
break;
@@ -3176,7 +3176,7 @@ class BlockLayered extends Module
if (version_compare(_PS_VERSION_,'1.5','>'))
{
$queryFilters = ' AND sav.quantity '.(!$filterValue[0] ? '<=' : '>').' 0 ';
$queryFiltersJoin = 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.id_product = p.id_product AND sav.id_shop = '.(int)Context::getContext()->shop->getID(true).') ';
$queryFiltersJoin = 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.id_product = p.id_product AND sav.id_shop = '.(int)Context::getContext()->shop->id.') ';
}
else
$queryFilters = ' AND p.quantity '.(!$filterValue[0] ? '<=' : '>').' 0 ';
@@ -3543,7 +3543,7 @@ class BlockLayered extends Module
if (version_compare(_PS_VERSION_,'1.5','>') && !empty($id_layered_filter))
{
if (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_ALL)
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL)
{
$helper = new HelperForm();
$helper->id = (int)$id_layered_filter;
+7 -7
View File
@@ -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()).'\',
+1 -1
View File
@@ -86,7 +86,7 @@ class BlockStore extends Module
return $this->displayError($this->l('an error occurred on uploading file'));
else
{
if (Configuration::hasContext('BLOCKSTORE_IMG', null, $this->context->shop->getContextType()) && Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name'])
if (Configuration::hasContext('BLOCKSTORE_IMG', null, Shop::getContext()) && Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name'])
@unlink(dirname(__FILE__).'/'.Configuration::get('BLOCKSTORE_IMG'));
Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']);
return $this->displayConfirmation($this->l('Settings are updated'));
+2 -2
View File
@@ -127,7 +127,7 @@ class blocktopmenu extends Module
$this->_html .= '
<fieldset>
<div class="multishop_info">
'.$this->l('The modifications will be applied to').' '.(Context::shop() == Shop::CONTEXT_SHOP ? $this->l('shop:').' '.$this->context->shop->name : $this->l('all shops')).'.
'.$this->l('The modifications will be applied to').' '.(Shop::getContext() == Shop::CONTEXT_SHOP ? $this->l('shop:').' '.$this->context->shop->name : $this->l('all shops')).'.
</div>
<legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" id="form">
@@ -334,7 +334,7 @@ class blocktopmenu extends Module
foreach ($items as $item)
{
$id = (int)substr($item, 3, strlen($item));
$disabled = ((Context::shop() == Shop::CONTEXT_SHOP && $type == 'global') ? ' disabled="disabled"': '');
$disabled = ((Shop::getContext() == Shop::CONTEXT_SHOP && $type == 'global') ? ' disabled="disabled"': '');
switch(substr($item, 0, 3))
{
case'CAT':
+2 -2
View File
@@ -87,7 +87,7 @@ class FavoriteProduct extends ObjectModel
FROM `'._DB_PREFIX_.'favorite_product`
WHERE `id_customer` = '.(int)$id_customer.'
AND `id_product` = '.(int)$id_product.'
AND `id_shop` = '.(int)$shop->getID(true)
AND `id_shop` = '.(int)$shop->id
);
if ($id_favorite_product)
@@ -105,6 +105,6 @@ class FavoriteProduct extends ObjectModel
FROM `'._DB_PREFIX_.'favorite_product`
WHERE `id_customer` = '.(int)$id_customer.'
AND `id_product` = '.(int)$id_product.'
AND `id_shop` = '.(int)$shop->getID(true));
AND `id_shop` = '.(int)$shop->id);
}
}
@@ -80,7 +80,7 @@ class FavoriteproductsActionsModuleFrontController extends ModuleFrontController
$favorite_product = new FavoriteProduct();
$favorite_product->id_product = $product->id;
$favorite_product->id_customer = (int)Context::getContext()->cookie->id_customer;
$favorite_product->id_shop = (int)Context::getContext()->shop->getID(true);
$favorite_product->id_shop = (int)Context::getContext()->shop->id;
if ($favorite_product->add())
die('0');
die(1);
@@ -56,7 +56,7 @@ if (Tools::getValue('action') && Tools::getValue('id_product') && Context::getCo
$favorite_product = new FavoriteProduct();
$favorite_product->id_product = $product->id;
$favorite_product->id_customer = (int)Context::getContext()->cookie->id_customer;
$favorite_product->id_shop = (int)Context::getContext()->shop->getID();
$favorite_product->id_shop = (int)Context::getContext()->shop->id;
if ($favorite_product->add())
die('0');
}
+2 -2
View File
@@ -63,7 +63,7 @@ class HomeSlide extends ObjectModel
public function add($autodate = true, $null_values = false)
{
$context = Context::getContext();
$id_shop = $context->shop->getID();
$id_shop = $context->shop->id;
$res = parent::add($autodate, $null_values);
$res &= Db::getInstance()->execute('
@@ -100,7 +100,7 @@ class HomeSlide extends ObjectModel
{
$id_slide = $this->id;
$context = Context::getContext();
$id_shop = $context->shop->getID();
$id_shop = $context->shop->id;
$max = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT MAX(hss.`position`) as position
+2 -2
View File
@@ -686,7 +686,7 @@ class HomeSlider extends Module
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT MAX(hss.`position`) AS `next_position`
FROM `'._DB_PREFIX_.'homeslider_slides` hss, `'._DB_PREFIX_.'homeslider` hs
WHERE hss.`id_homeslider_slides` = hs.`id_homeslider_slides` AND hs.`id_shop` = '.(int)$this->context->shop->getId()
WHERE hss.`id_homeslider_slides` = hs.`id_homeslider_slides` AND hs.`id_shop` = '.(int)$this->context->shop->id
);
return (++$row['next_position']);
@@ -695,7 +695,7 @@ class HomeSlider extends Module
public function getSlides($active = null)
{
$this->context = Context::getContext();
$id_shop = $this->context->shop->getID();
$id_shop = $this->context->shop->id;
$id_lang = $this->context->language->id;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
+1 -1
View File
@@ -174,7 +174,7 @@ class Pagesnotfound extends Module
if (empty($http_referer) || Validate::isAbsoluteUrl($http_referer))
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'pagenotfound` (`request_uri`, `http_referer`, `date_add`, `id_shop`, `id_group_shop`)
VALUES (\''.pSQL($request_uri).'\', \''.pSQL($http_referer).'\', NOW(), '.$this->context->shop->getID().', '.$this->context->shop->getGroupID().')
VALUES (\''.pSQL($request_uri).'\', \''.pSQL($http_referer).'\', NOW(), '.(int)$this->context->shop->id.', '.(int)$this->context->shop->id_group_shop.')
');
}
}
+1 -1
View File
@@ -89,7 +89,7 @@ class SEKeywords extends ModuleGraph
if ($keywords = $this->getKeywords($_SERVER['HTTP_REFERER']))
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'sekeyword` (`keyword`, `date_add`, `id_shop`, `id_group_shop`)
VALUES (\''.pSQL(Tools::strtolower(trim($keywords))).'\', NOW(), '.$this->context->shop->getID().', '.$this->context->shop->getGroupID().')');
VALUES (\''.pSQL(Tools::strtolower(trim($keywords))).'\', NOW(), '.(int)$this->context->shop->id.', '.(int)$this->context->shop->id_group_shop.')');
}
public function hookAdminStatsModules()
@@ -123,7 +123,7 @@ class StatsBestCategories extends ModuleGrid
// If a shop is selected, get all children categories for the shop
$categories = array();
if ($this->context->shop->getContextType() != Shop::CONTEXT_ALL)
if (Shop::getContext() != Shop::CONTEXT_ALL)
{
$sql = 'SELECT c.nleft, c.nright
FROM '._DB_PREFIX_.'category c
-3
View File
@@ -96,9 +96,6 @@ class StatsCheckUp extends Module
$employee = Context::getContext()->employee;
$prop30 = ((strtotime($employee->stats_date_to.' 23:59:59') - strtotime($employee->stats_date_from.' 00:00:00')) / 60 / 60 / 24) / 30;
$shopID = $this->context->shop->getID();
$shopGroupID = $this->context->shop->getGroupID();
// Get languages
$sql = 'SELECT l.*
FROM '._DB_PREFIX_.'lang l'
+1 -1
View File
@@ -87,7 +87,7 @@ class StatsSearch extends ModuleGraph
public function hookSearch($params)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'statssearch` (`id_shop`, `id_group_shop`, `keywords`, `results`, `date_add`)
VALUES ('.$this->context->shop->getID(true).', '.$this->context->shop->getGroupID().', \''.pSQL($params['expr']).'\', '.(int)$params['total'].', NOW())';
VALUES ('.(int)$this->context->shop->id.', '.(int)$this->context->shop->id_group_shop.', \''.pSQL($params['expr']).'\', '.(int)$params['total'].', NOW())';
Db::getInstance()->execute($sql);
}
@@ -440,7 +440,7 @@ class ThemeInstallator extends Module
$hookedModule = array();
$position = array();
$msg = '';
$shopID = $this->context->shop->getID();
$shopID = $this->context->shop->id;
foreach ($this->xml->modules->hooks->hook as $row)
{
+4 -4
View File
@@ -128,12 +128,12 @@ class Watermark extends Module
Configuration::updateValue('WATERMARK_X_ALIGN', Tools::getValue('xalign'));
Configuration::updateValue('WATERMARK_TRANSPARENCY', Tools::getValue('transparency'));
if (Context::getContext()->shop->getContextType() == Shop::CONTEXT_SHOP)
if (Shop::getContext() == Shop::CONTEXT_SHOP)
$str_shop = '-'.(int)$this->context->shop->id;
else
$str_shop = '';
//submited watermark
if (isset($_FILES['PS_WATERMARK']) AND !empty($_FILES['PS_WATERMARK']['tmp_name']))
if (isset($_FILES['PS_WATERMARK']) && !empty($_FILES['PS_WATERMARK']['tmp_name']))
{
/* Check watermark validity */
if ($error = ImageManager::validateUpload($_FILES['PS_WATERMARK']))
@@ -154,7 +154,7 @@ class Watermark extends Module
{
$imageTypes = ImageType::getImagesTypes('products');
$str_shop = '-'.(int)$this->context->shop->id;
if (Context::getContext()->shop->getContextType() != Shop::CONTEXT_SHOP || !Tools::file_exists_cache(dirname(__FILE__).'/watermark'.$str_shop.'.gif'))
if (Shop::getContext() != Shop::CONTEXT_SHOP || !Tools::file_exists_cache(dirname(__FILE__).'/watermark'.$str_shop.'.gif'))
$str_shop = '';
$this->_html .=
@@ -239,7 +239,7 @@ class Watermark extends Module
$file = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'-watermark.jpg';
$str_shop = '-'.(int)$this->context->shop->id;
if (Context::getContext()->shop->getContextType() != Shop::CONTEXT_SHOP || !Tools::file_exists_cache(dirname(__FILE__).'/watermark'.$str_shop.'.gif'))
if (Shop::getContext() != Shop::CONTEXT_SHOP || !Tools::file_exists_cache(dirname(__FILE__).'/watermark'.$str_shop.'.gif'))
$str_shop = '';
//first make a watermark image