0

My website is on Prestashop 1.6 with multistore feature enabled. When I m in store n°1, I would like to insert a link of store N°2 without having to write the url. Smarty has the variable {$base_dir} ( URL of the store). The value of this variable change depending the context (if I m in store n°1 or store n°2). Is there any way to have a smarty variable with which I can get a url of a store in particular?

Thanks

2 Answers 2

0

You can use :

$link->getPageLink($controller, $ssl = null, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null, $relative_protocol = false).

All functions in Link class accept id_shop param. 'index' for IndexController.

2
  • getShopsUrls returns a PrestashopCollection object. I haven't found any method on this objects to return the url of a shop. Link::getPageLink($controller, $ssl = null, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null, $relative_protocol = false). Which value for $controller to have the index page of a store?
    – julienMWeb
    Sep 9, 2015 at 9:27
  • I have revise my reply. ask index to have IndexController Sep 9, 2015 at 17:16
0

I just found this :

{assign var="foo" value=Shop::getShops() }

It returns an array with the urls of all the shops.

To have the url of shop n°1 :

{$foo[1]['uri']}

To have the url of shop n°2 :

 {$foo[2]['uri']}

very easy to use!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.