// Fix stores with multishop + hide blockstore if no store
This commit is contained in:
@@ -54,7 +54,6 @@ class StoresControllerCore extends FrontController
|
|||||||
'lastname'
|
'lastname'
|
||||||
);
|
);
|
||||||
|
|
||||||
$out = '';
|
|
||||||
$out_datas = array();
|
$out_datas = array();
|
||||||
|
|
||||||
$address_datas = AddressFormat::getOrderedAddressFields($store['id_country'], false, true);
|
$address_datas = AddressFormat::getOrderedAddressFields($store['id_country'], false, true);
|
||||||
@@ -92,7 +91,7 @@ class StoresControllerCore extends FrontController
|
|||||||
$stores = Db::getInstance()->executeS('
|
$stores = Db::getInstance()->executeS('
|
||||||
SELECT s.*, cl.name country, st.iso_code state
|
SELECT s.*, cl.name country, st.iso_code state
|
||||||
FROM '._DB_PREFIX_.'store s
|
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_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
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);
|
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('
|
$stores = Db::getInstance()->executeS('
|
||||||
SELECT s.*, cl.name country, st.iso_code state
|
SELECT s.*, cl.name country, st.iso_code state
|
||||||
FROM '._DB_PREFIX_.'store s
|
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_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
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);
|
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id);
|
||||||
@@ -141,7 +140,7 @@ class StoresControllerCore extends FrontController
|
|||||||
) distance,
|
) distance,
|
||||||
cl.id_country id_country
|
cl.id_country id_country
|
||||||
FROM '._DB_PREFIX_.'store s
|
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_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
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.'
|
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||||
@@ -240,9 +239,9 @@ class StoresControllerCore extends FrontController
|
|||||||
public function initContent()
|
public function initContent()
|
||||||
{
|
{
|
||||||
if (Configuration::get('PS_STORES_SIMPLIFIED'))
|
if (Configuration::get('PS_STORES_SIMPLIFIED'))
|
||||||
$stores = $this->assignStoresSimplified();
|
$this->assignStoresSimplified();
|
||||||
else
|
else
|
||||||
$stores = $this->assignStores();
|
$this->assignStores();
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'mediumSize' => Image::getSize('medium'),
|
'mediumSize' => Image::getSize('medium'),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<module>
|
<module>
|
||||||
<name>blocksearch</name>
|
<name>blocksearch</name>
|
||||||
<displayName><![CDATA[Quick Search block]]></displayName>
|
<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>
|
<description><![CDATA[Adds a block with a quick search field.]]></description>
|
||||||
<author><![CDATA[PrestaShop]]></author>
|
<author><![CDATA[PrestaShop]]></author>
|
||||||
<tab><![CDATA[search_filter]]></tab>
|
<tab><![CDATA[search_filter]]></tab>
|
||||||
|
|||||||
@@ -64,7 +64,13 @@ class BlockStore extends Module
|
|||||||
function hookRightColumn($params)
|
function hookRightColumn($params)
|
||||||
{
|
{
|
||||||
$this->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG'));
|
$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)
|
function hookHeader($params)
|
||||||
|
|||||||
Reference in New Issue
Block a user