Download the PHP package mage2kishan/module-mega-menu without Composer

On this page you can find all versions of the php package mage2kishan/module-mega-menu. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-mega-menu

Magento 2 Mega Menu

Panth Mega Menu replaces the default Magento top navigation with menus that are built in the admin and rendered by the module's own templates. A menu is a tree of items (category links, product links, CMS pages, custom URLs, custom HTML, CMS blocks, widget code and account links) with per-item icons, images, badges, colours, column layout, visibility rules and scheduling. The storefront renders the menu whose identifier is set in configuration (default "mainmenu") and removes Magento's catalog.topnav block once that identifier resolves to an active menu with visible items for the store view.

It is aimed at merchants who want to manage navigation without editing theme files, and at developers who need repositories, view models and templates to build on. The storefront menu uses one shared renderer, stylesheet and plain JavaScript file on Hyva and Luma; older Hyva and Luma template sets are still shipped for themes that override them.

Product page: Magento 2 Mega Menu

Features

Compatibility

Requirement Supported
Magento Open Source 2.4.4 to 2.4.8 (as published on the product page)
Adobe Commerce 2.4.4 to 2.4.8 (as published on the product page)
PHP 8.1, 8.2, 8.3, 8.4 (~8.1.0||~8.2.0||~8.3.0||~8.4.0 in composer.json)
Themes Hyva and Luma (one shared storefront renderer, pmm/render.phtml)

Composer constraints on Magento packages: magento/framework ^103.0, magento/module-backend ^102.0, magento/module-store ^101.1, magento/module-cms ^104.0, magento/module-catalog ^104.0, magento/module-config ^101.2, magento/module-ui ^101.2.

Requirements

Installation

setup:di:compile is only needed in production mode. The module ships JavaScript, CSS, fonts and images under view/adminhtml/web, view/base/web and view/frontend/web, so static content has to be deployed.

Check the result with:

setup:upgrade creates the module tables and runs the data patch Setup\Patch\Data\AddDefaultStoreRelations, which assigns store ID 0 (all store views) to any existing menu that has no store relation.

Configuration

Admin path: Stores > Configuration > "Panth Extensions" > "MegaMenu". In etc/adminhtml/system.xml the tab label is prefixed with a rocket emoji. All fields can be set at default, website and store view scope. Config paths follow the pattern panth_megamenu/<group>/<field>; the field id is shown in brackets in the tables below.

General Settings (panth_megamenu/general)

Setting Default What it does
Enable MegaMenu (enabled) Yes Master switch. When set to No the module renders nothing and the default Magento navigation stays in place. This includes menus placed in CMS content with a {{block class="Panth\MegaMenu\Block\Menu" ...}} directive.
Menu Identifier (menu_identifier) mainmenu Identifier of the menu record to render. Shown when Enable MegaMenu is Yes.
Mobile Breakpoint (px) (mobile_breakpoint) 1024 Luma storefront: widths up to this value show the menu button instead of the menu bar. The Hyva header always switches below 1024px to match the theme header. Shown when Enable MegaMenu is Yes.

Styling Settings (panth_megamenu/styling)

Setting Default What it does
Hover Effect (hover_effect) Underline Effect applied to menu items on hover. Options: None, Underline, Fade, Highlight, Slide, Glow, Grow.
Custom CSS (custom_css) empty CSS rules for the menu, without <style> tags.

The group comment states that menu colours are taken from the Hyva theme's Tailwind theme-config.json. The module ships its default pmenu-* design tokens in etc/theme-config.json.

Display Settings (panth_megamenu/display)

Setting Default What it does
Animation Type (animation_type) Fade Animation used when a dropdown opens or closes. Options: None, Fade, Slide, Grow.
Animation Duration (ms) (animation_duration) 200 Duration of the dropdown and hover animations (0-1000).
Hover Intent Delay (ms) (hover_intent_delay) 150 Delay before a dropdown opens on hover.
Show Icons (show_icons) Yes Display item icons when set.
Show Images (show_images) Yes Display item images in dropdown panels.
Maximum Menu Depth (max_depth) 5 Number of menu levels rendered. Top-level items are the first level, so 3 shows top-level items and two levels below them. Every storefront template applies the same limit.
Show Category Product Count (show_category_count) No Show the product count next to category names.
Enable Custom Blocks (enable_custom_blocks) Yes Allow CMS blocks inside dropdowns.

Mobile Settings (panth_megamenu/mobile)

Setting Default What it does
Mobile Menu Position (position) Left Slide-in side of the mobile panel: Left or Right.

The mobile drawer always has a backdrop, an accordion for sub-menus and a close button.

Performance Settings (panth_megamenu/performance)

Setting Default What it does
Enable Menu Cache (cache_enabled) Yes Cache the rendered menu block. When Yes, the block cache lifetime is taken from Cache Lifetime.
Cache Lifetime (seconds) (cache_lifetime) 3600 Lifetime of the cached menu block. Shown when Enable Menu Cache is Yes.

Advanced Settings (panth_megamenu/advanced)

Setting Default What it does
Custom JavaScript (custom_js) empty JavaScript added for the menu, without <script> tags.

Default behaviour after installation: the module is enabled and looks for an active menu with the identifier mainmenu. Until such a menu exists for the store view, Luma keeps its native category menu (catalog.topnav), and the Hyva header shows the category tree with the module's menu markup in place of the theme menu (topmenu_desktop, topmenu_mobile). When Enable MegaMenu is No, both storefronts show their native category menu. When the menu resolves, the plugin removes them and adds the body class panth-megamenu-active, which the Luma styles use to hide the native nav toggle.

Admin menu entries: "Panth Extensions" > "Mega Menu" > "Menu Items" (route panth_menu/menu/index) and "Panth Extensions" > "Mega Menu" > "Configuration" (opens the MegaMenu configuration section).

The module does not add category attributes to the category edit form.

Usage

Creating a menu

  1. Open "Panth Extensions" > "Mega Menu" > "Menu Items" and click "Create Menu".
  2. In "General Information" set "Menu Title", "Identifier", "Enable Menu", "CSS Class", "Sort Order", "Description" and "Custom CSS". The identifier must match the Menu Identifier configuration value for the menu to appear on the storefront. Identifiers are unique.
  3. "Menu Container Styling" holds "Container Background Color", "Container Padding", "Container Margin", "Gap Between Menu Items", "Container Max Width", "Container Border", "Container Border Radius", "Container Box Shadow" and "Menu Items Alignment" (Left, Center, Right, Space Between, Space Around).
  4. Build the tree in "Menu Items". The same tab has a "Menu Items JSON (Advanced)" field with the raw JSON.
  5. Save. The "Version History" tab lists the versions recorded for the menu.

Saving, importing, toggling, restoring or deleting a menu cleans the cache entries tagged panth_megamenu (menu block cache and full page cache entries of pages that show a menu). The "Flush Cache" action in the menu grid is still available.

The "Store View" field (General Information) decides where a menu is shown: All Store Views (store ID 0) or the selected store views. When a menu is assigned to some store views only, the other store views keep their native navigation (or another menu with the same identifier assigned to them). The identifier itself stays unique.

Item types and URLs

Item visibility

An item is rendered only when all of the following hold: it is active; its level is below Maximum Menu Depth; the current time is within its start and end date (both are read in the store timezone; a date with a time applies from or until that moment, a date without a time covers the whole day); for category items, the category is enabled and belongs to the store's root category; and its device flag is set (Show on Desktop for the menu bar; in the mobile drawer Show on Mobile applies below 768px and Show on Tablet from 768px).

Layout and columns

Parent items with children open a dropdown panel. Each second-level item is a column; Column Width can widen a column. CMS blocks and custom HTML placed on sub-items fill a column of the panel. Custom HTML is passed through the CMS page filter, so CMS directives such as {{store url=""}} and {{widget ...}} are processed; the HTML itself is not stripped, so only trusted admin users should be allowed to edit menus.

Images and icons

Images are uploaded from the builder to pub/media/panth/megamenu/; allowed extensions are jpg, jpeg, gif, png and webp, the file MIME type must be one of the matching image types, and the name is checked against Panth\Core\Security\UploadExtensionPolicy. SVG files cannot be uploaded. Icons are entered as a class from the shipped Font Awesome, LineIcons or Material Icons stylesheets, or as an emoji. Inline SVG icons that contain scripts, event handler attributes, javascript: URLs, foreignObject, embedded frames or character references are not rendered.

Storefront menu

luma/menu.phtml (Luma, also used by luma/desktop/menu.phtml), the Panth Infotech theme template Panth_MegaMenu::menu.phtml (Hyva, with the category tree as fallback when no menu resolves) and preview.phtml collect the item tree and the configuration and render it through pmm/render.phtml. The stylesheet css/pmm.css is added to every storefront page by default.xml; the script js/pmm.js is loaded once by the first menu on the page. Every menu instance gets its own ids, so several menus (header plus CMS directives) work on one page.

Desktop (Hyva from 1024px, Luma above Mobile Breakpoint):

On Luma, a header menu sits between the logo and the search box and mini cart from 768px up; below 768px the menu button takes the place of the Luma menu toggle at the left of the logo. Font Awesome icons used by menu items are loaded from the module on Luma.

Mobile (below the same breakpoints): the menu button opens an off-canvas drawer (left or right, following Mobile Menu Position) with a backdrop, both at z-index 70. The drawer is moved to the end of <body>, focus goes to the close button and returns to the menu button on close, Tab stays inside the drawer, Escape and the backdrop close it, and the page does not scroll while it is open. While the drawer is open the <html> element has the class panth-overlay-open, which floating buttons use to hide. Sub-menus open as an accordion with 48px rows, 16px text and a chevron button per item; custom HTML and CMS blocks are shown as a tinted tile.

Per-item text, hover text, hover background, background, font family, size, weight, text transform, padding, margin, width, height, border, border radius, box shadow, text shadow and opacity values are applied when they are plain CSS values; values containing ;, braces, quotes, url( or expression( are ignored.

Preview

The "Preview" button opens an admin popup with Desktop (1280px, scaled to fit), Tablet (768px) and Mobile (375px) widths and a Refresh button. The popup posts the current, unsaved menu to the frontend route panth_menu/preview/index inside an isolated frame; links in the frame open in a new tab. The route only renders for requests that carry a valid preview_token: a signed token (HMAC-SHA256 over an expiry time with the deployment crypt/key) that the admin menu edit pages embed when they are loaded and that is valid for one hour (Model\PreviewAccess::TOKEN_LIFETIME). Reload the edit page to get a new token. A one-time token from panth_menu/menu/previewToken together with menu_id is also accepted. Requests without a valid token get the 404 page. POST requests (unsaved items_json) fail CSRF validation unless they carry a valid token, and unsaved items are only read from the POST body. The preview page uses the empty page layout, removes the regular menu blocks, renders the requested menu (saved items for menu_id, or the unsaved items from the POST body) with the same storefront markup, stylesheet and script inside preview-container.phtml, so Desktop shows the dropdowns and Tablet and Mobile show the drawer exactly as the storefront does. The page uses its own root template (preview/root.phtml) that outputs the storefront head assets and only the preview container, the menu custom CSS block and the Hyva Alpine.js script, so the store header, footer and other page blocks are not shown. It works on Hyva and Luma and is sent with no-cache headers.

The menu builder page loads a Tailwind stylesheet and the Inter font shipped with the module (view/adminhtml/web/css/tailwind.min.css, view/adminhtml/web/fonts/inter.woff2) instead of the Tailwind CDN and Google Fonts. Item titles, URLs, CSS classes, colours, icons and picker entries are HTML-escaped before the builder inserts them into the page. The Delete, Toggle, Duplicate, Flush Cache and Create Demo Blocks admin actions accept POST requests only; Toggle, Duplicate and Create Demo Blocks require the admin form key.

Import, export and demo data

Layout and templates

Caching

Block\Menu::getCacheKeyInfo() keys the block cache by store, menu identifier, theme and customer ID, and getIdentities() always returns panth_megamenu and, once a menu is loaded, panth_megamenu_<menu_id>. Model\Menu uses the cache tags panth_megamenu_menu and panth_megamenu and returns them (plus the ID variants) from getIdentities(), so saving or deleting a menu cleans the block cache and the full page cache entries of pages that show a menu. Helper\Data::cleanMenuCache() cleans entries by those tags and Helper\Data::flushMenuCache() cleans the full_page and block_html cache types.

Developer Notes

Uninstallation

After removal the six panth_megamenu_* tables, the configuration rows under panth_megamenu/ in core_config_data, uploaded images in pub/media/panth/megamenu/ and any demo CMS blocks remain and have to be dropped or deleted manually. No product or category attributes were added. Panth_Core stays installed if other packages depend on it.

Support

Documentation

USER_GUIDE.md covers installation, checking that the module is active, the configuration screens, the menu builder, item types, column layouts, CMS block injection, mobile drawer behaviour, per-store menus, troubleshooting and a short CLI reference.

License

Commercial software license. See LICENSE.txt in this repository.

Changelog

See CHANGELOG.md.

Links


All versions of module-mega-menu with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0||~8.2.0||~8.3.0||~8.4.0
mage2kishan/module-core Version ^1.0.17
magento/framework Version ^103.0
magento/module-backend Version ^102.0
magento/module-store Version ^101.1
magento/module-cms Version ^104.0
magento/module-catalog Version ^104.0
magento/module-config Version ^101.2
magento/module-ui Version ^101.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mage2kishan/module-mega-menu contains the following files

Loading the files please wait ...