In Magento 2, you can assign a CMS block to a category. Usually it appears above the products. By modifying the file catalog_category_view.xml, you can move the block below the product list. Copy the file vendor/magento/module-catalog/view/frontend/layout/catalog_category_view.xml into your child theme…
Using jQuery and domReady in a static block or CMS page (Magento 2)
Using jQuery in a Magento 2 static block or CMS page can be tricky, a special syntax is required. Use the following code to add jQuery when all the content was loaded: Of course, you can skip listening to domReady…
Using jQuery with domReady in a CMS page or static block (Magento 2)
Want to use jQuery in a static block or CMS page? No problem! Open the page or block in Magento 2 admin and insert the following code:
|
1 2 3 4 5 6 7 8 |
<script> require([ 'jquery' ,'domReady!' ], function ($) { console.log('whatever'); }); </script> |
If you do not want to wait for the domReady event, simply…
Referencing a static block from a CMS page (Magento 2)
Want to reference a static block on a Magento 2 CMS page? Just insert the following snippet into the content editor to render the static block identified by block_identifier anzeigen zu lassen.
|
1 |
{{block class="Magento\\Cms\\Block\\Block" block_id="block_identifier"}} |
Adding a static block to a CMS page (Magento 1)
Use the below code to add a Magento block to your CMS page.
|
1 |
{{block type="cms/block" block_id="block_id"}} |
Changing the title tag of the home page or any CMS page (Magento 1)
Magento automatically adds the defined suffix to the title tag on every page. If you want to change that for lets say the home page, open the CMS page “home” and add the following XML to the layout section:
|
1 2 3 |
<reference name="head"> <action method="setData"><key>title</key><value>... Title Tag ...</value></action> </reference> |
Adding config data to a CMS page (Magento 1)
To add the data from the admin to a CMS page, use the following code:
|
1 2 |
{{config path="general/imprint/vat_id"}} ... |
This code adds the vat id, you can easily add other info by looking up the correct path from the core_config table.
Using skin, media, … URLs in blocks or CMS pages (Magento 1)
The following 4 examples show how to get the skin, media, base and store URLs in a MAgento block or CMS page: skin: {{skin url=’images/sampleimage.jpg’}} media: {{media url=’/sampleimage.jpg’}} base: {{base url=’yourstore/mypage.html’}} store: {{store url=’mypage.html’}}