Magento – How to Get Store URL in CMS Page

admincmsurl

I want to get the store URL in cms page when I tried this

{{store url='abc/efg/xxx/yyyy'}}

It does not return the given URL. Its give output like this

http://domain.com

but I need to get like this

http://domain.com/abc/efg/xxx/yyyy

Help to fix this.
I don't know how to concatenate in CMS page

Best Answer

If the url is determined by a controller and an action you can use this:

{{store url="module/controller/action"}}

If the url is to a cms page you this:

{{store _direct="url-key-here"}}

if you want some query params also like /some-ulr?a=2&b=5 use one of the methods above and add a _query parameter.

{{store url="module/controller/action" _query="a=2&b=5"}}
{{store _direct="url-key-here" _query="a=2&b=5"}}

[EDIT]
You can get the same urls in a template file like this:

$this->getUrl('module/controller/action'); //for controller pages
$this->getUrl('', array('_direct'=>'some-url-key')); //for cms pages
$this->getUrl('module/controller/action', array('_query'=>'a=2&b=5')); //for query params
$this->getUrl('', array('_direct'=>'some-url-key', '_query'=>'a=2&b=5')); //for query params
Related Topic