mhinspeya/module-contact 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mhinspeya/module-contact

Composer 安装命令:

composer require mhinspeya/module-contact

包简介

Custom contact form handler with field-level validation and custom redirect path.

README 文档

README

Custom Magento 2 contact form handler that replaces the core Magento_Contact POST controller with field-level validation and a custom redirect path.

Compatibility

MagentoPHP
2.4.4 – 2.4.88.2 · 8.3 · 8.4

Features

Custom Contact Form Handler

Replaces Magento\Contact\Controller\Index\Post via DI preference to provide:

  • Field-level validation with specific error messages for each field (comment, email, honeypot)
  • Custom redirect path — redirects to kontakt/index instead of the default contact/index
  • Structured exception handling — separates LocalizedException (user-facing) from generic exceptions (logged as critical)
  • Full logging — all failures are logged via Psr\Log\LoggerInterface with exception context

Validation Rules

FieldRuleError Message
commentMust not be empty"Please enter a comment."
emailMust be a valid email"Please enter a valid email address."
hideitMust be empty (honeypot)Generic error (anti-spam)

Email Configuration

Uses standard Magento contact email config paths:

Config PathPurpose
contact/email/recipient_emailRecipient address
contact/email/sender_email_identitySender identity
contact/email/email_templateEmail template ID

Installation

Composer (recommended)

composer require mhinspeya/module-contact
bin/magento module:enable MHinspeya_Contact
bin/magento setup:upgrade
bin/magento cache:flush

Manual

  1. Copy the module files to app/code/MHinspeya/Contact/
  2. Run:
    bin/magento module:enable MHinspeya_Contact
    bin/magento setup:upgrade
    bin/magento cache:flush
    

Module Structure

MHinspeya/Contact/
├── composer.json
├── registration.php
├── etc/
│   ├── module.xml   — Module declaration (depends on Magento_Contact)
│   └── di.xml       — Preference: replaces core Post controller
├── i18n/
│   └── de_DE.csv    — German translations
└── Controller/
    └── Index/
        └── Post.php — Custom contact form POST handler

Architecture

  • Implements: Magento\Framework\App\Action\HttpPostActionInterface (modern Magento controller pattern)
  • Replaces: Magento\Contact\Controller\Index\Post via <preference> in di.xml
  • Dependencies: All injected via constructor DI — no ObjectManager usage

Translations

Keyde_DE
Thanks for contacting us...Vielen Dank für Ihre Nachricht...
We can't process your request...Wir können Ihre Anfrage derzeit nicht bearbeiten...
Please enter a comment.Bitte geben Sie einen Kommentar ein.
Please enter a valid email address.Bitte geben Sie eine gültige E-Mail-Adresse ein.

License

Proprietary — © MHinspeya

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固