开发者

magento Baseurl from helper function

开发者 https://www.devze.com 2023-01-17 14:40 出处:网络
I want to get custom URL from magento helper in this way: <action method=\"addLink\" translate=\"label title\"

I want to get custom URL from magento helper in this way:

<action 
  method="addLink" 
  translate="label title" 
  module="customer">
  <label>About Us</label>
  <url 
    helper="customer/getAboutUsUrl">
    about
  </url>
  <title>About Us</title>
  <prepare/>
  <urlParams/>
  <position>1</position>
</action>

So what I did is define a function getAboutUsUrl() under local directory within Customer Helper Directory. But it does not return the base开发者_JS百科 url as I expected.

What do I have to do to get the baseurl with about us link?

Thanks


You should use cms/page/getPageUrl helper method and pass CMS-page identifier as its parameter like in the following example:

<action 
  method="addLink" 
  translate="label title" 
  module="customer">
  <label>About Us</label>
  <url helper="cms/page/getPageUrl"><pageId>about</pageId></url>
  <title>About Us</title>
  <prepare/>
  <position>1</position>
</action>
0

精彩评论

暂无评论...
验证码 换一张
取 消