Magento

How to use Shortcodes in Magento CMS HTML

Short codes are a simple set of functions for creating macro codes for use in CMS pages or blocks. Magento has its own short codes, which you can use in Magento CMS pages, Product pages, Category pages or blocks. Magento short code syntax is fairly simple to understand as the real short code is placed inside double curly braces.

<a href="{{store url=""}}">Home Page</a>

 

In this, the {{store url=""}} is replaced by the actual store URL. Apart from that, there are other Magento short codes which I have listed below:

1. DIRECT_URL

Direct URL parameter appends the store’s base URL to your path, which you can use to create category or subcategory pages, i.e.

<a href="{{store direct_url="category/subcategory.html"}}">Latest Products</a>

 

2. URL

By using Magento’s built in routes, the URL short code generates your Magento store’s URL, which can be appended to create any URL, i.e.

<a href="{{store url="about"}}">About Us</a>

 

which will result in something like this:

http://www.yourstore.com/about/

3. _QUERY AND 4. _QUERY_[NAME]

Used for generating URLs with query parameters, there are two ways in using the _query parameter, you can add an arbitrary query string to the URL, i.e.

<a href="{{store direct_url="category/subcategory.html" _query="a=param_a&amp;b=param_b"}}">Latest Products</a>

 

Or, you can use the second parameter syntax, where you define the query parameter name with the parameter itself, i.e.

 

<a href="{{store direct_url="category/subcategory.html" _query_a="param_a" _query_b="param_b"}}">;Latest Products</a>

 

This will result in this:

http://www.yourstore.com/category/subcategory.html?a=param_a&b=param_b

Advertisement

Hans-Eirik Hanifl

Hans-Eirik Hanifl is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

Related Articles

Leave a Reply

Advertisement
Back to top button
Sign up to the E-Commerce Gorilla newsletter for updates & special promotions.
Join Our Newsletter
SUBSCRIBE
We value your privacy and protect your information like our own. Unsubscribe at anytime.