Magento Expert Forum - Improve your Magento experience

Results 1 to 12 of 12

How to add static block in magento?

  1. #1
    Super Moderator linh's Avatar
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Post How to add static block in magento?

    we can include any static block in phtml files. I order to achieve this first you have to create the static block using magento admin panel and then include this static block into the magento. There are different ways we can add static blocks. yet another attempt to explain with quick and easy examples.

    1: how to include static block in phtml file?

    Let us suppose, you have created static block with identifier “promo_block” in magento admin.
    Now, you can call the static block from any phtml file with the help of following code:

    echo $this->getLayout()->createBlock('cms/block')->setBlockId('promo_block')->toHTML();
    2: How to include static block on product view page?

    We will refer the same static block “promo_block”. Now open “catalog.xml” file from current theme folder (i.e.design/frontend/themeName/layout/catalog.xml) and search for string “”.

    You can add following code just before closing tag of product view page. we are adding “promo_block” static block into right reference. However you can add this block into any area like “content”, “left”, etc

    HTML Code:
    <reference name="right">  
            <block type="cms/block" name="promo_block" as="promo_block">  
               <action method="setBlockId"><block_id>promo_block</block_id></action>  
            </block>  
    </reference>    

    View more threads in the same category:


  2. #2
    Moderator shunavi's Avatar
    Join Date
    Mar 2013
    Posts
    124
    Thanks
    9
    Thanked 26 Times in 17 Posts

    Default

    Thanks Linh, very good help.

  3. #3
    Junior Member curtis's Avatar
    Join Date
    Jun 2013
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    It 's quite nice and easy to practice. Thank guy

  4. #4
    Junior Member
    Join Date
    Jul 2013
    Posts
    13
    Thanks
    8
    Thanked 0 Times in 0 Posts

  5. #5
    New member
    Join Date
    May 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for sharing this useful information .

  6. #6
    Junior Member Kathy Daunt's Avatar
    Join Date
    May 2013
    Posts
    66
    Thanks
    10
    Thanked 4 Times in 4 Posts

    Default

    Nice technical thread.
    Add static block: {{block block_id=”your_block_id”}}


    for more information please read this post: http://apptha.com/blog/magento-static-blocks/

  7. #7
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    635
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    Log into your Magento store's admin.
    Navigate to CMS>Static Blocks.
    Click Add New Block in the top right corner.
    Give your block a recognizable Block Title such as Social Media Links or “Fall Sale Banner”
    Give your block an Identifier which will be used to call the block.

  8. #8
    New member
    Join Date
    Jul 2019
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    To add a static block in Magento is very easy from the Magento admin panel. Let see some steps to add a new CMS Block in Magento 2.
    -On the Admin panel, click Content. In the Elements section, select Blocks.
    -Click on the Add New Block button in the upper-right corner and continue.
    -In the Block Title field, enter the name title of new block
    -In the Identifier field, choose a unique Identifier to the block. Remember that using all lowercase characters and using underscores instead of spaces.
    -In the Store View field, select the Store View(s) where the block will be available
    In the Status field, set to Enable to make the block visible in the store
    In the Content field, complete the content of the block
    When complete, click Save Block.

    For more information read our blogs.

  9. #9
    Junior Member
    Join Date
    Nov 2020
    Location
    united kingdom
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Log into your Magento store's admin.
    Navigate to CMS>Static Blocks.
    Click Add New Block in the top right corner.
    Give your block a recognizable Block Title such as Social Media Links or “Fall Sale Banner”
    Give your block an Identifier which will be used to call the block.

  10. #10
    Junior Member
    Join Date
    Sep 2018
    Location
    Oman, Muscat
    Posts
    2,084
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    A square is a particular unit of substance that can be situated most anyplace on the page. Content squares are now and again alluded to as static squares, or CMS You can make custom squares of substance without composing any code,

  11. #11

  12. #12
    Junior Member
    Join Date
    Jun 2016
    Location
    Bhavnagar, Gujarat, India
    Posts
    1,125
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Adding Blog is an easy process.

    You can refer this blog: https://magecomp.com/blog/add-static...age-magento-2/

    Hope this helps you.

    Thank you.

Similar Threads

  1. How To Create, Edit, and Display Static Blocks Using Widgets
    By rocker in forum Webmaster & Administrator
    Replies: 3
    Last Post: 07-04-2021, 06:41 AM
  2. How to insert your block into any place in Magento
    By david in forum Programming & Development
    Replies: 2
    Last Post: 12-02-2019, 10:45 AM
  3. How To Add A Static Block To A Category Page
    By rocker in forum Webmaster & Administrator
    Replies: 2
    Last Post: 17-08-2017, 09:17 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •