cancel
Showing results for 
Search instead for 
Did you mean: 

Link Category by ID

SOLVED

Link Category by ID

Hi! I would like to link categories by ID in my static blocks / pages. I know the {{store url='x'}} function, but this is not safe for updates on the URL. Is there a way to deal with it by using the ID of a category or page?

 

Thanks 

Valentin

1 REPLY

Re: Link Category by ID

Hi @valentin_huwer

 

okay - i understand the requirement you have , below is the solution !!

 

Instead of {{store} url syntax - you need to Use Widgets for the same.

 

Below is the syntax to add specific category into block with specific id.

 

{{widget type="Magento\Catalog\Block\Category\Widget\Link" anchor_text="MY Custom category" title="Custom Category" template="category/widget/link/link_block.phtml" id_path="category/12"}}

 

In a more details when you edit/add any static block click on show/hide editor button.

 

  • over there you will see option - called insert Widget
  • Select catalog category link widget  from dropdown menu
  • Then add title and name etc , below there is field called select category.
  • Then category popup will be open select whatever category you would like to insert
  • It will generate the text i posted above like {{widget ...} so on.

 

You can also Choose template - like category block template you want or category inline template you want !!

 

Then click on save button ! clear the cache and check at frontend !

 

Hope it helps !! 

if issue solved,Click Kudos & Accept as Solution