定制 mhinspeya/module-breadcrumbmod 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mhinspeya/module-breadcrumbmod

Composer 安装命令:

composer require mhinspeya/module-breadcrumbmod

包简介

Magento 2 module that enhances product page breadcrumbs by displaying the full category path navigation instead of the default flat breadcrumb.

README 文档

README

A Magento 2 module that enhances product page breadcrumbs by displaying the full category path navigation instead of the default flat breadcrumb.

Compatibility

RequirementVersion
Magento2.4.8+
PHP8.2 – 8.4

Features

  • Replaces the default product page breadcrumb with a full category path trail
  • Automatically resolves the product's assigned category hierarchy
  • Displays Home → Category → Subcategory → … → Product Name
  • Only renders active categories that are in the root category list
  • Gracefully degrades when no category is assigned (shows Home → Product Name)

Installation

Via Composer

composer require mhinspeya/module-breadcrumbmod
bin/magento module:enable MHinspeya_BreadcrumbMod
bin/magento setup:upgrade
bin/magento cache:flush

Manual Installation

  1. Copy the module files to app/code/MHinspeya/BreadcrumbMod/
  2. Enable the module and run setup:
bin/magento module:enable MHinspeya_BreadcrumbMod
bin/magento setup:upgrade
bin/magento cache:flush

How It Works

The module uses an after-plugin on Magento\Catalog\Controller\Product\View::execute() to modify the breadcrumb block on product pages.

Flow

  1. Intercepts the product view page result after the controller executes
  2. Retrieves the current product via ProductRepositoryInterface using the request parameter
  3. Resolves the product's category path and loads the full category collection
  4. Iterates through active categories and adds each as a breadcrumb crumb
  5. Appends the product name as the final breadcrumb item

Architecture

Plugin/Product/View.php          → After-plugin on product controller
etc/frontend/di.xml              → Plugin registration (frontend scope)
etc/module.xml                   → Module declaration with Catalog & Theme dependencies
view/frontend/layout/
  catalog_product_view.xml       → Ensures breadcrumbs block uses the theme template

Module Structure

MHinspeya/BreadcrumbMod/
├── Plugin/
│   └── Product/
│       └── View.php                  # After-plugin for breadcrumb modification
├── etc/
│   ├── frontend/
│   │   └── di.xml                    # Plugin DI configuration
│   └── module.xml                    # Module declaration
├── view/
│   └── frontend/
│       └── layout/
│           └── catalog_product_view.xml  # Layout override for breadcrumbs block
├── composer.json
├── registration.php
└── README.md

Uninstallation

bin/magento module:disable MHinspeya_BreadcrumbMod
composer remove mhinspeya/module-breadcrumbmod
bin/magento setup:upgrade
bin/magento cache:flush

License

Proprietary – © MHinspeya.de by SOL.Service Online

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: OSL-3.0
  • 更新时间: 2026-06-29