1

I have a CMS landing page and it will contain links to my store categories - I currently have the following setup:

<a href="#" class="this-class">Some text here...</a>
<a href="#" class="this-class">Some text here...</a>
<a href="#" class="this-class">Some text here...</a>

I realise I can add a link in the usual way (e.g. mydomain.com/mycategory) but I want to add in such a way that should the category be updated in the future the link won't break.

Is this done via the "store url" method? I've seen that there's a widget that can do this but I need to keep the tags and classes shown above. So, I'm looking for a solution that will simply replace the "#".

1

This can not be done directly with CMS page, for example:

If you want to call category URL to link you can do statically like this

<a href="{{store direct_url='category-url.html'}}" class="this-class">Some text here...</a>

But if in future if your category URL is changed it will not work for you.

For that you will need to set it dynamically. And you will need to add block with template path and call it in CMS page like

{{block type="catalog/navigation" name="catalog.category.list" template="catalog/navigation/category.phtml"}}

And in category.phtml file you can get the store category collection and use that:

<?php
    $helper = Mage::helper('catalog/category');
    $categories = $helper->getStoreCategories();
?>
|improve this answer|||||
1

You do not need to worry about that, in the future if you change the category's name or its URL an URL Rewrite rule will be created and if the URL of that category changes Magento will automatically redirect to right one. Just make sure you have the checkbox checked (view appended image).enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.