Jump to content

how to show in multi store - only default site


Ron morales

Recommended Posts

 

Easy...

{if Configuration::get('PS_SHOP_DEFAULT') == 1}
  {* Code here when default shop is 1 *}
{/if}
{if Configuration::get('PS_SHOP_DEFAULT') == 1}
  
  <a  class="distribuidores" href="#" >{l s='Acceso distribuidores' mod='blockcontact'}</a>
{else}
  <a  class="distribuidores" href="#" >{l s='Acceso Clientes' mod='blockcontact'}</a>

{/if}

i insert code for when default shop, and not default shop but not work, what have I done wrong?

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

You are working in Smarty, you need have enabled the option to "Force compilation" or "Clear cache"

 

Also, my example is representative, I used the ID 1, of course, you need put the Id of your default shop.

Link to comment
Share on other sites

You are working in Smarty, you need have enabled the option to "Force compilation" or "Clear cache"

 

Also, my example is representative, I used the ID 1, of course, you need put the Id of your default shop.

Cotoko no me había dado cuenta que eras tú, si que me funciona, pero el tema es que quiero que aparezca un boton cuando esté en una tienda, y cuando esté en la otra otro, pero con el {else} no me funciona, lo tengo dentro del tpl de blockcontact

Link to comment
Share on other sites

{if $cart->id_shop==1}
  <a  class="distribuidores" href="#" >{l s='Acceso distribuidores' mod='blockcontact'}</a>
{/if}
{if $cart->id_shop==2}
  <a  class="distribuidores" href="3" >{l s='Acceso Clientes' mod='blockcontact'}</a>
{/if}

Work now this form

Link to comment
Share on other sites

Hola Ron, el codigo que te di en un principio es valido para que compares si es la tienda defecto o no, ahora cambiaste un poco a determinar en que id de tienda te encuentras, no se en que archivo te encuentras, pero dado el modulo supongo que es

/themes/default-bootstrap/modules/blockcontact/nav.tpl
El codigo que podrias utilizar es este

{if Context::getContext()->shop->id == 1}
	<a class="distribuidores" href="#" >{l s='Acceso distribuidores' mod='blockcontact'}</a>
{else if Context::getContext()->shop->id == 2}
	<a class="distribuidores" href="3" >{l s='Acceso Clientes' mod='blockcontact'}</a>
{/if}
Saludos!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...