1

Following the magento1.x method for adding cms pages to the menu doesn't seem to work for magento2.x

At present I activate the autogenerated url for my homepage/home category which works - changing the url from homepage.html to catalog/category/view/id/19

I then create a custom url rewrite to change catalog/category/view/id/19 to home which fails

Is this a bug, or has the method changed for adding cms pages to the main menu?

1 Answer 1

1

Following

https://github.com/Mestrona/Mestrona_CategoryRedirect

It's going to add new field in Admin Category Page

https://github.com/Mestrona/Mestrona_CategoryRedirect/blob/master/view/adminhtml/ui_component/category_form.xml

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="general">
        <field name="redirect_url">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="sortOrder" xsi:type="number">50</item>
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="label" xsi:type="string" translate="true">Redirect to another URL</item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

Core File as below

https://github.com/Mestrona/Mestrona_CategoryRedirect/blob/master/etc/catalog_attributes.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd">
    <group name="catalog_category">
        <attribute name="redirect_url"/>
    </group>
</config>

It works for Me :)

2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – 7ochem
    Commented Oct 7, 2016 at 6:57
  • Noted. Will update
    – Jackson
    Commented Oct 7, 2016 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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