0

I need to add Megamenu via an install/upgrade script. I've added my megamenu. I've figured out which tables get updated when I add Megamenu.

The table which gets updated is

mgs_megamenu
mgs_megamenu_store

How can I achieve it programmatically like for cms block I referred this link for cms block

How to add a CMS block programmatically in Magento 2?

The queries which I prepared for megamenu, requires lots of insert and select

query1

INSERT INTO `mgs_megamenu` 
(`title`,`menu_type`,`category_id`,`position`,`columns`,
`dropdown_position`,`use_thumbnail`,`static_content`,
`left_col`,`right_col`,`status`,`parent_id`,`store`) VALUES 
('WHAT''S NEW',2,0,0,6,1,2,'<div class="mega-menu-content">
</div>',1,1,1,1,0);  

query2

SET @mgs_megamenu_id = (SELECT max(megamenu_id) FROM mgs_megamenu);

query3

INSERT INTO `mgs_megamenu_store` (`megamenu_id`,`store_id`) VALUES (@mgs_megamenu_id ,0);

Modal class of MGS is MGS\Mpanel\Model\Category;

  • Please share the Model class of that module – Amit Bera Jan 30 '19 at 11:13
  • Its a big file, so i have given the path – summu Jan 30 '19 at 11:20

Your Answer

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

Browse other questions tagged or ask your own question.