开发者

Magento Store - Get Base URL in Static Block

开发者_如何学Python

I have a static block in Magento with this content:

<li><a href="#/contacts">Contact Us</a></li>

I would like to replace the # with the site's base url. I want it to retrieve this dynamically.


Try adding this to your static block:

<a href="{{store url=""}}">Link to Base URL</a>

That should create a link to your store's base URL.


you can use this {{store direct_url="contacts"}}

For example:

<a href="{{store direct_url="contacts"}}">contact us</a>


For those that are still looking for a solution, the following should do the trick for you...

For the unsecured base URL:

{{config path='web/unsecure/base_url'}}

Or for the secured base URL:

{{config path='web/secure/base_url'}}


Try this

<a href="{{store url="contacts"}}">Contact Us</a>


You can add store URL in static block:

<a href="{{store direct_url='identifier'}}">Your link</a>


A bit more clear and practical scenario (for all level of users) would be: Suppose, we have added a static-block in footer-area/elsewhere. In that static-block we have words like this: Contact Us And we want to add a cms-page link of that words(Contact Us).

Nice and simple way with elaborated steps:

Step-1: Create a page through CMS>Pages. In 'Page Information' Tab section we set URL Key* page-contact-us Necessary Text can be written through the content tab area.

Step-2: After opening up our Static-block through CMS>Static Blocks, we have to write the code like this way:

<a href="{{store url="page-contact-us"}}">Contact Us</a>

That's all, the Base URL of that Static-block is now activated and can be retrieved dynamically.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜