定制 butterfly-team/magento-order-event-dispatcher 二次开发

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

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

butterfly-team/magento-order-event-dispatcher

Composer 安装命令:

composer require butterfly-team/magento-order-event-dispatcher

包简介

This Magento 2 module allows you to trigger order-related events for an existing order via a URL. This is useful when you manually create orders in the Magento database and want to trigger events for processing workflows such as inventory updates, email notifications, and more.

README 文档

README

This Magento 2 module allows you to trigger order-related events for an existing order via a URL. This is useful when you manually create orders in the Magento database and want to trigger events for processing workflows such as inventory updates, email notifications, and more.

Features

  • Trigger Magento 2 order events for an existing order ID via a URL.
  • Supports events: sales_order_place_after, checkout_submit_all_after, sales_order_save_after.
  • Secured with a secret key to ensure only authorized requests can trigger the events.

Install/update using Composer

Composer is a dependency management tool for PHP. It allows you to declare the libraries your project depends on, and it will manage the installation or update of these libraries.

Prerequisites

Make sure Composer is properly installed in your environment. Learn more at https://getcomposer.org.

Install/Update

  1. In your Magento root directory, run the following command to add the module via Composer:
    composer require butterfly-team/magento-order-event-dispatcher
  2. Then, update your Magento setup:
    bin/magento setup:upgrade
    bin/magento setup:di:compile
    bin/magento cache:flush

Uninstalling the Module

To remove the module installed via Composer, use these commands:

  1. In your Magento root directory:
    composer remove butterfly-team/magento-order-event-dispatcher

Securing the Endpoint with a Secret Key

To secure the endpoint, configure a secret key in Magento’s core_config_data table:

  1. Add the secret key in the Magento admin:

    • Go to Stores > Configuration > Advanced > Developer.
    • Set a value under the configuration path: butterfly/order_event_dispatcher/secret_key.

    Alternatively, add the key directly to the database:

    INSERT INTO core_config_data (scope, scope_id, path, value)
    VALUES ('default', 0, 'butterfly/order_event_dispatcher/secret_key', 'your_secret_key_here');
  2. Replace your_secret_key_here with a secure, unique key.

Usage

To trigger order events for an existing order, use the following URL structure in your browser or API client:

http://your-magento-site.com/order_event_dispatcher/index/dispatch?order_id=<ORDER_ID>&secret=your_secret_key_here

Replace <ORDER_ID> with the actual order ID in the Magento database and your_secret_key_here with your configured secret key. The module will respond with a JSON message indicating the success or failure of the event dispatch.

Example

For an order with ID 1, access:

http://your-magento-site.com/order_event_dispatcher/index/dispatch?order_id=1&secret=your_secret_key_here

Events Triggered

  • sales_order_place_after: Dispatched after an order is placed.
  • checkout_submit_all_after: Dispatched after checkout submission.
  • sales_order_save_after: Dispatched after an order is saved.

You can customize which events are triggered in the Dispatch.php controller file.

Troubleshooting

  • Ensure the module is enabled:
    php bin/magento module:status Butterfly_OrderEventDispatcher
  • Check Magento logs (var/log/system.log and var/log/exception.log) for any errors.

License

This module is open-source and free to use. Feel free to modify it to suit your needs.

butterfly-team/magento-order-event-dispatcher 适用场景与选型建议

butterfly-team/magento-order-event-dispatcher 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 256 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 butterfly-team/magento-order-event-dispatcher 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 butterfly-team/magento-order-event-dispatcher 我们能提供哪些服务?
定制开发 / 二次开发

基于 butterfly-team/magento-order-event-dispatcher 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2024-10-25