Jump to content

Unir muestra simplificada de página de localización de la tienda con mapa de google


Recommended Posts

Pues eso, que quería que en la sección nuestras tiendas me apareciera el mapa de google aún teniendo activada la opción de muestra simplificada de localización de la tienda.

TEngo la versión 1.4.9.

 

el código de stores.tpl dentro de mi carpeta de theme es:

 

{*

* 2007-2012 PrestaShop

*

* NOTICE OF LICENSE

*

* This source file is subject to the Academic Free License (AFL 3.0)

* that is bundled with this package in the file LICENSE.txt.

* It is also available through the world-wide-web at this URL:

* http://opensource.or...ses/afl-3.0.php

* If you did not receive a copy of the license and are unable to

* obtain it through the world-wide-web, please send an email

* to [email protected] so we can send you a copy immediately.

*

* DISCLAIMER

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

* @author PrestaShop SA <[email protected]>

* @copyright 2007-2012 PrestaShop SA

* @version Release: $Revision: 14008 $

* @license http://opensource.or...ses/afl-3.0.php Academic Free License (AFL 3.0)

* International Registered Trademark & Property of PrestaShop SA

*}

 

{capture name=path}{l s='Our stores'}{/capture}

{include file="$tpl_dir./breadcrumb.tpl"}

 

<script src="http://maps.google.com/maps/api/js?sensor=true">// DEBUG </script>

 

<h1>{l s='Our stores'}</h1>

 

{if $simplifiedStoresDiplay}

{if $stores|@count}

<p>{l s='Here are the details of our stores, feel free to contact us:'}</p>

{foreach from=$stores item=store}

<div class="store-small">

{if $store.has_picture}<p><img src="{$img_store_dir}{$store.id_store}.jpg" alt="" width=640px height=480px /></p>{/if}

<p>

<b>{$store.name|escape:'htmlall':'UTF-8'}</b><br />

{$store.address1|escape:'htmlall':'UTF-8'}<br />

{if $store.address2}{$store.address2|escape:'htmlall':'UTF-8'}{/if}<br />

{$store.postcode} {$store.city|escape:'htmlall':'UTF-8'}{if $store.state}, {$store.state}{/if}<br />

{$store.country|escape:'htmlall':'UTF-8'}<br />

{if $store.phone}{l s='Phone:' js=0} {$store.phone}{/if}

</p>

</div>

{/foreach}

{/if}

{else}

<script type="text/javascript">

// <![CDATA[

var map;

var markers = [];

var infoWindow;

var locationSelect;

 

var defaultLat = '{$defaultLat}';

var defaultLong = '{$defaultLong}';

 

var translation_1 = '{l s='No store found, try to select a wider radius' js=1}';

var translation_2 = '{l s='store found - see details:' js=1}';

var translation_3 = '{l s='stores found - see all results:' js=1}';

var translation_4 = '{l s='Phone:' js=1}';

var translation_5 = '{l s='Get Directions' js=1}';

var translation_6 = '{l s='Not found' js=1}';

 

var hasStoreIcon = '{$hasStoreIcon}';

var distance_unit = '{$distance_unit}';

var img_store_dir = '{$img_store_dir}';

var img_ps_dir = '{$img_ps_dir}';

var searchUrl = '{$searchUrl}';

//]]>

</script>

 

<p>{l s='Enter a location (eg.: a zip/postal code, an address, a city or a country) in order to find the nearest stores.'}</p>

<p>{l s='Your location:'} <input type="text" name="location" id="addressInput" value="{l s='Address, zip/postal code, city, state or country'}" onclick="this.value='';" /></p>

<p style="margin-top: 15px;">

{l s='Radius:'}

<select name="radius" id="radiusSelect">

<option value="15">15</option>

<option value="25">25</option>

<option value="50">50</option>

<option value="100">100</option>

</select> {$distance_unit}

<input type="button" class="button" onclick="searchLocations();" value="{l s='Search'}" style="display: inline;" />

<img src="{$img_ps_dir}loader.gif" class="middle" alt="" id="stores_loader" />

</p>

<div><select id="locationSelect"></select></div>

<div id="map"></div>

<table cellpadding="0" cellspacing="0" id="stores-table">

<tr>

<th>{l s='#'}</th>

<th>{l s='Store'}</th>

<th>{l s='Address'}</th>

<th>{l s='Distance'}</th>

</tr>

</table>

{/if}

 

 

lo que ya tengo hecho es cambiar el tamaño de la imagen de la tienda y el enlace para que me muestre la foto en grande del archivo imagenes de tienda.

Se me había ocurrido copiar todo lo que hay entre el {else} y el {/if} del final y meterlo dentro del {if $simplifiedStoresDiplay} como aquí:

 

{*

* 2007-2012 PrestaShop

*

* NOTICE OF LICENSE

*

* This source file is subject to the Academic Free License (AFL 3.0)

* that is bundled with this package in the file LICENSE.txt.

* It is also available through the world-wide-web at this URL:

* http://opensource.org/licenses/afl-3.0.php

* If you did not receive a copy of the license and are unable to

* obtain it through the world-wide-web, please send an email

* to [email protected] so we can send you a copy immediately.

*

* DISCLAIMER

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

* @author PrestaShop SA <[email protected]>

* @copyright 2007-2012 PrestaShop SA

* @version Release: $Revision: 14008 $

* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)

* International Registered Trademark & Property of PrestaShop SA

*}

 

{capture name=path}{l s='Our stores'}{/capture}

{include file="$tpl_dir./breadcrumb.tpl"}

 

<script src="http://maps.google.com/maps/api/js?sensor=true">// DEBUG </script>

 

<h1>{l s='Our stores'}</h1>

 

{if $simplifiedStoresDiplay}

{if $stores|@count}

<p>{l s='Here are the details of our stores, feel free to contact us:'}</p>

{foreach from=$stores item=store}

<div class="store-small">

{if $store.has_picture}<p><img src="{$img_store_dir}{$store.id_store}.jpg" alt="" width=640px height=480px /></p>{/if}

<p>

<b>{$store.name|escape:'htmlall':'UTF-8'}</b><br />

{$store.address1|escape:'htmlall':'UTF-8'}<br />

{if $store.address2}{$store.address2|escape:'htmlall':'UTF-8'}{/if}<br />

{$store.postcode} {$store.city|escape:'htmlall':'UTF-8'}{if $store.state}, {$store.state}{/if}<br />

{$store.country|escape:'htmlall':'UTF-8'}<br />

{if $store.phone}{l s='Phone:' js=0} {$store.phone}{/if}

</p>

 

<script type="text/javascript">

// <![CDATA[

var map;

var markers = [];

var infoWindow;

var locationSelect;

 

var defaultLat = '{$defaultLat}';

var defaultLong = '{$defaultLong}';

 

var translation_1 = '{l s='No store found, try to select a wider radius' js=1}';

var translation_2 = '{l s='store found - see details:' js=1}';

var translation_3 = '{l s='stores found - see all results:' js=1}';

var translation_4 = '{l s='Phone:' js=1}';

var translation_5 = '{l s='Get Directions' js=1}';

var translation_6 = '{l s='Not found' js=1}';

 

var hasStoreIcon = '{$hasStoreIcon}';

var distance_unit = '{$distance_unit}';

var img_store_dir = '{$img_store_dir}';

var img_ps_dir = '{$img_ps_dir}';

var searchUrl = '{$searchUrl}';

//]]>

</script>

 

<p>{l s='Enter a location (eg.: a zip/postal code, an address, a city or a country) in order to find the nearest stores.'}</p>

<p>{l s='Your location:'} <input type="text" name="location" id="addressInput" value="{l s='Address, zip/postal code, city, state or country'}" onclick="this.value='';" /></p>

<p style="margin-top: 15px;">

{l s='Radius:'}

<select name="radius" id="radiusSelect">

<option value="15">15</option>

<option value="25">25</option>

<option value="50">50</option>

<option value="100">100</option>

</select> {$distance_unit}

<input type="button" class="button" onclick="searchLocations();" value="{l s='Search'}" style="display: inline;" />

<img src="{$img_ps_dir}loader.gif" class="middle" alt="" id="stores_loader" />

</p>

<div><select id="locationSelect"></select></div>

<div id="map"></div>

<table cellpadding="0" cellspacing="0" id="stores-table">

<tr>

<th>{l s='#'}</th>

<th>{l s='Store'}</th>

<th>{l s='Address'}</th>

<th>{l s='Distance'}</th>

</tr>

</table>

 

</div>

{/foreach}

{/if}

{else}

<script type="text/javascript">

// <![CDATA[

var map;

var markers = [];

var infoWindow;

var locationSelect;

 

var defaultLat = '{$defaultLat}';

var defaultLong = '{$defaultLong}';

 

var translation_1 = '{l s='No store found, try to select a wider radius' js=1}';

var translation_2 = '{l s='store found - see details:' js=1}';

var translation_3 = '{l s='stores found - see all results:' js=1}';

var translation_4 = '{l s='Phone:' js=1}';

var translation_5 = '{l s='Get Directions' js=1}';

var translation_6 = '{l s='Not found' js=1}';

 

var hasStoreIcon = '{$hasStoreIcon}';

var distance_unit = '{$distance_unit}';

var img_store_dir = '{$img_store_dir}';

var img_ps_dir = '{$img_ps_dir}';

var searchUrl = '{$searchUrl}';

//]]>

</script>

 

<p>{l s='Enter a location (eg.: a zip/postal code, an address, a city or a country) in order to find the nearest stores.'}</p>

<p>{l s='Your location:'} <input type="text" name="location" id="addressInput" value="{l s='Address, zip/postal code, city, state or country'}" onclick="this.value='';" /></p>

<p style="margin-top: 15px;">

{l s='Radius:'}

<select name="radius" id="radiusSelect">

<option value="15">15</option>

<option value="25">25</option>

<option value="50">50</option>

<option value="100">100</option>

</select> {$distance_unit}

<input type="button" class="button" onclick="searchLocations();" value="{l s='Search'}" style="display: inline;" />

<img src="{$img_ps_dir}loader.gif" class="middle" alt="" id="stores_loader" />

</p>

<div><select id="locationSelect"></select></div>

<div id="map"></div>

<table cellpadding="0" cellspacing="0" id="stores-table">

<tr>

<th>{l s='#'}</th>

<th>{l s='Store'}</th>

<th>{l s='Address'}</th>

<th>{l s='Distance'}</th>

</tr>

</table>

{/if}

 

 

y me muestra el selector de distancia del mapa pero el mapa no se ve.

El enlace a mi chapucilla es el siguiente: http://monnalisa-shop.com/tiendas

A ver si a alguien se le ocurre algo.

Edited by tvillalbac (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Buenas yo al final lo he conseguido, tienes que modificar unas cosillas en /controllers/front/StoresController.php.

 

el metodo assignStores() tiene que quedar asi:

 

 

/**

* Assign template vars for classical stores

*/

protected function assignStores()

{

$storesI = Db::getInstance()->executeS('

SELECT s.*, cl.name country, st.iso_code state

FROM '._DB_PREFIX_.'store 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);

 

foreach ($storesI as &$store)

{

$store['has_picture'] = file_exists(_PS_STORE_IMG_DIR_.(int)($store['id_store']).'.jpg');

if ($working_hours = $this->renderStoreWorkingHours($store))

$store['working_hours'] = $working_hours;

}

 

 

$this->context->smarty->assign('hasStoreIcon', file_exists(_PS_IMG_DIR_.Configuration::get('PS_STORES_ICON')));

 

$distanceUnit = Configuration::get('PS_DISTANCE_UNIT');

if (!in_array($distanceUnit, array('km', 'mi')))

$distanceUnit = 'km';

 

$this->context->smarty->assign(array(

'distance_unit' => $distanceUnit,

'simplifiedStoresDiplay' => false,

'storesI' => $storesI,

'stores' => $this->getStores()

));

}

 

 

 

Y el en /themes/default/stores.php tiene que poner todo esto:

 

 

{*

* 2007-2012 PrestaShop

*

* NOTICE OF LICENSE

*

* This source file is subject to the Academic Free License (AFL 3.0)

* that is bundled with this package in the file LICENSE.txt.

* It is also available through the world-wide-web at this URL:

* http://opensource.or...ses/afl-3.0.php

* If you did not receive a copy of the license and are unable to

* obtain it through the world-wide-web, please send an email

* to [email protected] so we can send you a copy immediately.

*

* DISCLAIMER

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

* @author PrestaShop SA <[email protected]>

* @copyright 2007-2012 PrestaShop SA

* @license http://opensource.or...ses/afl-3.0.php Academic Free License (AFL 3.0)

* International Registered Trademark & Property of PrestaShop SA

*}

 

{capture name=path}{l s='Our stores'}{/capture}

{include file="$tpl_dir./breadcrumb.tpl"}

 

 

 

<h1>{l s='Our stores'}</h1>

 

 

{if $simplifiedStoresDiplay}

 

{else}

{if $storesI|@count}

<p>{l s='Here are our store locations, please feel free to contact us:'}</p>

{foreach $storesI as $store}

<div>

 

<table width=100%>

<tr><td>

<b>{$store.name|escape:'htmlall':'UTF-8'}</b><br><br/>

<p>

{$store.address1|escape:'htmlall':'UTF-8'}<br>

{$store.postcode} {$store.city|escape:'htmlall':'UTF-8'}{if $store.state}, {$store.state}{/if}<br />

{if $store.address2}{$store.address2|escape:'htmlall':'UTF-8'}{/if}<br />

{$store.country|escape:'htmlall':'UTF-8'}<br/>

{if $store.phone}{l s='Phone:' js=0} {$store.phone}{/if} <br>

{if $store.fax}{l s='Fax:' js=0} {$store.fax}{/if}

{if isset($store.working_hours)}{$store.working_hours}{/if}

</p>

 

</td><td width=20px>

</td><td align=center>

{if $store.has_picture}<img src="{$img_store_dir}{$store.id_store}-tiendas.jpg" alt="" width="{$tiendas.width}" height="{$tiendas.height}" />{/if}

</td><tr>

</table>

<br></br>

</div>

{/foreach}

{/if}

 

 

 

<script type="text/javascript">

// <![CDATA[

var map;

var markers = [];

var infoWindow;

var locationSelect;

 

var defaultLat = '{$defaultLat}';

var defaultLong = '{$defaultLong}';

 

var translation_1 = '{l s='No stores found, try selecting a wider radius' js=1}';

var translation_2 = '{l s='store found - see details:' js=1}';

var translation_3 = '{l s='stores found - see all results:' js=1}';

var translation_4 = '{l s='Phone:' js=1}';

var translation_5 = '{l s='Get Directions' js=1}';

var translation_6 = '{l s='Not found' js=1}';

 

var hasStoreIcon = '{$hasStoreIcon}';

var distance_unit = '{$distance_unit}';

var img_store_dir = '{$img_store_dir}';

var img_ps_dir = '{$img_ps_dir}';

var searchUrl = '{$searchUrl}';

var logo_store = '{$logo_store}';

//]]>

</script>

 

 

<p>{l s='Enter a location (e.g. zip/postal code, address, city or country) in order to find the nearest stores.'}</p>

<p>

<label for="addressInput">{l s='Your location:'}</label>

<input type="text" name="location" id="addressInput" value="{l s='Address, zip/postal code, city, state or country'}" onclick="this.value='';" />

</p>

<p>

<label for="radiusSelect">{l s='Radius:'}</label>

<select name="radius" id="radiusSelect">

<option value="15">15</option>

<option value="25">25</option>

<option value="50">50</option>

<option value="100">100</option>

<option value="250">250</option>

<option value="500">500</option>

</select> {$distance_unit}

<img src="{$img_ps_dir}loader.gif" class="middle" alt="" id="stores_loader" />

</p>

<p class="clearfix">

<input type="button" class="button" onclick="searchLocations();" value="{l s='Search'}" style="display: inline;" />

</p>

<div><select id="locationSelect"><option></option></select></div>

<div id="map"></div>

<table cellpadding="0" cellspacing="0" border="0" id="stores-table" class="table_block">

<tr>

<th>{l s='#'}</th>

<th>{l s='Store'}</th>

<th>{l s='Address'}</th>

<th>{l s='Distance'}</th>

</tr>

</table>

 

 

 

{/if}

 

 

 

 

y en el back office en contacto tiendas tienes que tener desactivada la opción de modo sencillo Muestra simplificada de la página de localización de la tienda

Edited by [email protected] (see edit history)
  • Like 1
Link to comment
Share on other sites

weno la verdad es k mi archivo /themes/store.php esta un poco modificado, pero tal como lo tienes tu pero todo dentro del else y modificando los $stores del if ({if $storesI|@count}) y del foreach ({foreach $storesI as $store}) por $storesI ya deberia funcionarte.

 

Espero que te sirva de ayuda

 

PD: mi version de prestashop 1.5.3, pero supongo que debe ser parecido

Edited by [email protected] (see edit history)
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...