From 1278a064b625ad40a7d2c3dbdb4d6ca86cb4fa71 Mon Sep 17 00:00:00 2001 From: rGaillard Date: Tue, 22 Nov 2011 22:30:12 +0000 Subject: [PATCH] // blockstores is now multishop git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10481 b9a71923-0436-4b27-9f14-aed3839534dd --- modules/blockstore/blockstore.php | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/modules/blockstore/blockstore.php b/modules/blockstore/blockstore.php index 074b54ba8..8ecbcf92d 100644 --- a/modules/blockstore/blockstore.php +++ b/modules/blockstore/blockstore.php @@ -63,6 +63,8 @@ class BlockStore extends Module function hookRightColumn($params) { + + $this->context->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); return $this->display(__FILE__, 'blockstore.tpl'); } @@ -85,10 +87,9 @@ class BlockStore extends Module if (!move_uploaded_file($_FILES['store_img']['tmp_name'], dirname(__FILE__).'/'.$_FILES['store_img']['name'])) return $this->displayError($this->l('an error occurred on uploading file')); else - { - if (Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name']) - if ($this->context->shop->getContextType() != Shop::CONTEXT_SHOP || Configuration::hasContext('BLOCKSTORE_IMG', null, Shop::CONTEXT_SHOP)) - @unlink(dirname(__FILE__).'/'.Configuration::get('BLOCKSTORE_IMG')); + { + if (Configuration::hasContext('BLOCKSTORE_IMG', null, $this->context->shop->getContextType()) && 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')); } @@ -100,21 +101,12 @@ class BlockStore extends Module public function getContent() { - $img = false; - if ($this->context->shop->getContextType() == Shop::CONTEXT_SHOP && file_exists(dirname(__FILE__).'/'.Configuration::get('BLOCKSTORE_IMG'))) - $img = Configuration::get('BLOCKSTORE_IMG'); - if (!$img || ($this->context->shop->getContextType() != Shop::CONTEXT_SHOP && file_exists(dirname(__FILE__).'/'.Configuration::getGlobalValue('BLOCKSTORE_IMG')))); - $img = Configuration::getGlobalValue('BLOCKSTORE_IMG'); - - $img_src = ($img ? Tools::getProtocol().Tools::getMediaServer($this->name)._MODULE_DIR_.$this->name.'/'.$img : false); - - $output = $this->postProcess().'
'.$this->l('Store block configuration').''; - if ($img_src) - $output .= '
'.$this->l('Store image').'
'; + if (Configuration::get('BLOCKSTORE_IMG')) + $output .= '
'.$this->l('Store image').'
'; $output .= '