2

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.

Jonathan Calb
  • 731
  • 1
  • 10
  • 28
  • `derco_core` is not a standard helper alias. Do you have an extension installed? Also there is no `getStoreUrl` in any core helpers. – Marius Aug 23 '13 at 16:25
  • This already works in a phtml file. Its just a example of what i need to do in the static block. What i need is a command like the {{store url=""}} but that gets the base url of a specific store view. – Jonathan Calb Aug 23 '13 at 17:49

1 Answers1

4

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.

Marius
  • 15,148
  • 9
  • 56
  • 76