// Fix stores with multishop + hide blockstore if no store

This commit is contained in:
rMalie
2012-02-28 15:35:15 +00:00
parent 294821df62
commit 421b307c7d
3 changed files with 13 additions and 8 deletions
+5 -6
View File
@@ -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'),
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blocksearch</name>
<displayName><![CDATA[Quick Search block]]></displayName>
<version><![CDATA[1]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Adds a block with a quick search field.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[search_filter]]></tab>
+7 -1
View File
@@ -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)