1

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

1

3 Answers 3

18

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
2
  • how can i get that url in phtml file.use this code $this->getUrl() Feb 5, 2014 at 7:34
  • @MeenakshiSundaramR. See my edit. It looks better in the answer opposed to a comment.
    – Marius
    Feb 5, 2014 at 7:41
2

@Meenakshi,

I had used this

<p><a href="{{store url='abc/efg/xxx/yyyy'}}">test</a></p>

In cms, and Its working fine for me.

I think you are not getting exact full URL because of hide/show editor issue. First hide the editor then after put above code in CMS, then It will display as you want.

0

careful with single quote and double quote, must use double quote

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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