1

I'm trying to create a custom variable in Magento2 that I could use within a CMS block on a category page, that would result in displaying the name of that category.

For example, within a block at the top of a category called "Upgrade Kits" category page, I could say

More information about {{customVar code=currentcategory}}

and on the front-end, the visitor would see

More information about Upgrade Kits

I'm new to custom variables, and I created a custom variable called "currentcategory", I've tried a few things in the "Variable HTML Value" field, based on suggestions I've seen in other threads, such as

<script>
Mage::registry("current_category");
</script>

but I'm not a coder (obviously), and I'm just taking swings at it, but so far everything I've tried has resulted in nothing showing up where the variable is inserted. Any suggestions would be hugely appreciated

0

Browse other questions tagged or ask your own question.