Jonathan Calb
Jonathan Calb

Reputation: 761

How to get the base url of a specific store view in a static block?

I know that in a .phtml file you do it like this for example:

<?php echo $this->helper('derco_core')->getStoreUrl('dcmotosesp')?>

I want to do the same thing inside a static block. Thanks in advance.

Upvotes: 2

Views: 3054

Answers (1)

Marius
Marius

Reputation: 15216

There is no 'clean' way of getting an url for a specific store using shortcodes ({{store url}}).
...because the store shortcode handler end like this (see Mage_Core_Model_Email_Template_Filter::storeDirective()):

return Mage::app()->getStore(Mage::getDesign()->getStore())->getUrl($path, $params);

This means that the store cannot be passed as a parameter.

The following might work but it's a bit ugly. The idea is to send the parameter ___store through $_GET telling Magento to switch to a specific store.

<a href="{{store url="some/url/here" _query="___store=store_code_here"}}">TEST LINK</a>

(replace 'store_code_here' with your specific store code).

An other option would be to extend the method mentioned above and allow it to receive a store_code parameter.

Upvotes: 5

Related Questions