From 421b307c7d6231d2cd15614cefd3bce7718641d4 Mon Sep 17 00:00:00 2001 From: rMalie Date: Tue, 28 Feb 2012 15:35:15 +0000 Subject: [PATCH] // Fix stores with multishop + hide blockstore if no store --- controllers/front/StoresController.php | 11 +++++------ modules/blocksearch/config.xml | 2 +- modules/blockstore/blockstore.php | 8 +++++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/controllers/front/StoresController.php b/controllers/front/StoresController.php index fc74217f0..88a8971fe 100644 --- a/controllers/front/StoresController.php +++ b/controllers/front/StoresController.php @@ -54,7 +54,6 @@ class StoresControllerCore extends FrontController 'lastname' ); - $out = ''; $out_datas = array(); $address_datas = AddressFormat::getOrderedAddressFields($store['id_country'], false, true); @@ -92,7 +91,7 @@ class StoresControllerCore extends FrontController $stores = Db::getInstance()->executeS(' SELECT s.*, cl.name country, st.iso_code state FROM '._DB_PREFIX_.'store s - '.Shop::addSqlAssociation('shop', 's').' + '.Shop::addSqlAssociation('store', 's').' LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country) LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state) WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id); @@ -118,7 +117,7 @@ class StoresControllerCore extends FrontController $stores = Db::getInstance()->executeS(' SELECT s.*, cl.name country, st.iso_code state FROM '._DB_PREFIX_.'store s - '.Shop::addSqlAssociation('shop', 's').' + '.Shop::addSqlAssociation('store', 's').' LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country) LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state) WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id); @@ -141,7 +140,7 @@ class StoresControllerCore extends FrontController ) distance, cl.id_country id_country FROM '._DB_PREFIX_.'store s - '.Shop::addSqlAssociation('shop', 's').' + '.Shop::addSqlAssociation('store', 's').' LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country) LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state) WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.' @@ -240,9 +239,9 @@ class StoresControllerCore extends FrontController public function initContent() { if (Configuration::get('PS_STORES_SIMPLIFIED')) - $stores = $this->assignStoresSimplified(); + $this->assignStoresSimplified(); else - $stores = $this->assignStores(); + $this->assignStores(); $this->context->smarty->assign(array( 'mediumSize' => Image::getSize('medium'), diff --git a/modules/blocksearch/config.xml b/modules/blocksearch/config.xml index f0b42ddea..16b8cff4e 100755 --- a/modules/blocksearch/config.xml +++ b/modules/blocksearch/config.xml @@ -2,7 +2,7 @@ blocksearch - + diff --git a/modules/blockstore/blockstore.php b/modules/blockstore/blockstore.php index 364e2493d..16dad3e49 100644 --- a/modules/blockstore/blockstore.php +++ b/modules/blockstore/blockstore.php @@ -64,7 +64,13 @@ class BlockStore extends Module function hookRightColumn($params) { $this->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); - return $this->display(__FILE__, 'blockstore.tpl'); + $sql = 'SELECT COUNT(*) + FROM '._DB_PREFIX_.'store s' + .Shop::addSqlAssociation('store', 's'); + $total = Db::getInstance()->getValue($sql); + + if ($total > 0) + return $this->display(__FILE__, 'blockstore.tpl'); } function hookHeader($params)