Categories
CMS Development Magento

Magento2.3: How to add a new menu link in My Account page?

I want to add a new menu link in My Account page. Please see the below screenshot:

enter image description here

I want to add a new menu after to the menu link, Newsletter Subscriptions. In order to add the new menu and its fields, where I have to update the code.

Also, when a user clicks that new menu, I want to show the fields like Education, Occupation, etc., and those data should be store in database. This is my primary expectation.

Could anyone please point me out where to update the code?

Any help will be appreciated!

Code of UpgradeSchema:

<?php

namespace Vendor\CustomerNavigation\Setup;

use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

class UpgradeSchema implements UpgradeSchemaInterface
{

    /**
     * {@inheritdoc}
     */
    public function upgrade(
        SchemaSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $installer = $setup;

        $installer->startSetup();
        if (version_compare($context->getVersion(), '0.1.1', '<')) {
        $installer->getConnection()->addColumn(
            $installer->getTable('customernavigation_customernavigation'),
            'field_1',
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'length' => 255,
                'nullable' => true,
                'comment' => 'Field_1'
            ]

        );
        $installer->getConnection()->addColumn(
            $installer->getTable('customernavigation_customernavigation'),
            'field_2',
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'length' => 255,
                'nullable' => true,
                'comment' => 'Field_2'
            ]
        );
    }
        $installer->endSetup();
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *