aoropeza/detrackshippingmanager 问题修复 & 功能扩展

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

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

aoropeza/detrackshippingmanager

Composer 安装命令:

composer require aoropeza/detrackshippingmanager

包简介

Integration with Detrack shipping service for delivery management and tracking.

README 文档

README

This module integrates Magento 2 with the Detrack delivery management API, enabling order-based delivery creation, tracking, and management directly from the Magento admin panel.

Business Context

The core function of this module is to synchronize Magento orders with Detrack as delivery jobs, and provide a centralized UI for managing those deliveries.

Key Features:

  1. Shipping Method: Provides a "Detrack" carrier option at checkout with configurable pricing and country restrictions.
  2. Delivery Management UI: Admin grid listing all Detrack deliveries fetched from the API with search and filtering capabilities.
  3. Order Integration: Automatically maps Magento order data (customer info, shipping address, products) to Detrack delivery fields.
  4. CRUD Operations: Create, view, edit, and delete deliveries via the Detrack API directly from Magento admin.
  5. Order Grid: A dedicated admin grid showing Magento orders eligible for Detrack shipment (filtered by status and shipping method).
  6. Configurable Settings: API credentials, URL endpoints, order statuses, run numbers, job types, and predefined box/package templates.
  7. Database Columns: Adds detrack_status, detrack_tracking_no, and detrack_sended columns to the sales_order table.

Example Scenario:

  • A customer places an order selecting the "Detrack" shipping method.
  • An admin user navigates to the Detrack Orders grid, selects the order, and creates a delivery job in Detrack.
  • The delivery details (DO number, tracking, status, assigned vehicle) are synced back and viewable/editable from the Magento admin.

Note: This module handles the integration and data synchronization with Detrack only. Pricing, delivery zones, and vehicle assignments are managed via the Detrack platform and module configuration.

Prerequisites

Detrack Account

To use this module, you need an active Detrack account.

Required Fields in Detrack

Be sure to enable the following fields in your Detrack settings so that the integration works properly:

Field Description Required
API Key Secret API v1 key. Obtained from the Detrack administration panel. Yes
Run Number Route or shift number. Used to group related deliveries for the same driver. Yes
Job Type Type of work (Delivery, Pickup, Installation, etc.). Yes
Vehicle ID of the vehicle assigned to the delivery. No
Driver Name or ID of the driver assigned to the job. Yes
Tracking Number Unique tracking number for each generated delivery. Yes
Customer Name Name of the customer receiving the delivery. Yes
Customer Phone Customer phone number for SMS notifications and updates. No
Customer Email Customer email for sending confirmations and tracking links. No
Delivery Date Scheduled delivery date. Yes
Address Full destination address for the delivery. Yes
Box / Package Type of box or package. Must be configured in the product catalog. No

Installation

Composer

To install the module via Composer:

composer require aoropeza/detrackshippingmanager
bin/magento module:enable Aoropeza_DetrackShippingManager
bin/magento setup:upgrade
bin/magento setup:di:compile

Usage

Admin Configuration

  1. Go to the Magento Admin Panel.
  2. Navigate to Stores > Configuration > Dev Oropeza > Detrack Settings.
  3. API Credentials:
    • API Key Secret: Your Detrack API key for authentication.
  4. API URL's:
    • Url Base: Base URL for the Detrack API (default: https://app.detrack.com/api/v1/).
    • Individual endpoint paths for listing, creating, editing, deleting, and viewing deliveries, as well as vehicles.
  5. Settings Fields:
    • Status Order to send: Which order statuses are eligible for Detrack delivery (default: pending,processing).
    • Run No.: Route/run number configuration for grouping related deliveries.
    • Job Type: Type of job (e.g., DELIVERY, DROP OFF, PICK UP).
    • Box Settings: Predefined package/box templates with dimensions and weight.

Shipping Method Configuration

  1. Navigate to Stores > Configuration > Sales > Shipping Methods > Detrack.
  2. Enabled: Activate/Deactivate the carrier.
  3. Method Name / Title: Display names for the shipping method.
  4. Price: Flat shipping rate.
  5. Ship to Applicable Countries: All or specific countries.
  6. Displayed Error Message: Custom error shown when the method is unavailable.

Frontend/Admin Flow

  1. Customer selects "Detrack" as the shipping method during checkout.
  2. Admin views eligible orders in the Detrack Orders grid.
  3. Admin creates a delivery job, which sends order data to the Detrack API.
  4. Delivery details are viewable and editable in the Delivery Management grid.
  5. The sales_order table is updated with detrack_status, detrack_tracking_no, and detrack_sended flag.

Magento REST API Reference

This module exposes Magento REST endpoints that wrap the Detrack API operations. All requests require admin authentication via a bearer token.

Base URL

/rest/V1/detrack

Authentication

Before calling any endpoint, obtain an admin token:

TOKEN=$(curl -s -X POST "http://yourstore.com/rest/V1/integration/admin/token" \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"your_password"}')

Include the token in all subsequent requests:

-H "Authorization: Bearer $TOKEN"

Endpoints

1. List All Deliveries

GET /rest/V1/detrack/deliveries?date={YYYY-MM-DD}

Fetches all deliveries for a given date (defaults to today if omitted).

Example Request
curl -X GET "http://yourstore.com/rest/V1/detrack/deliveries?date=2026-04-30" \
  -H "Authorization: Bearer $TOKEN"
Response Example
[
  {
    "do": "DO-20260430-001",
    "order_no": "100000001",
    "name": "John",
    "last_name": "Doe",
    "address": "123 Main St, City, State, 12345, United States",
    "phone": "+1234567890",
    "status": "pending",
    "tracking_status": "unassigned",
    "assign_to": "",
    "date": "2026-04-30",
    "start_date": "2026-04-30 08:00:00",
    "tracking_no": "TRK123456"
  }
]

2. View Delivery

POST /rest/V1/detrack/deliveries/view

Retrieves details for a specific delivery by DO number.

Request Payload
{
  "doNumber": "DO-20260430-001",
  "date": "2026-04-30"
}
Example Request
curl -X POST "http://yourstore.com/rest/V1/detrack/deliveries/view" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "doNumber": "DO-20260430-001",
    "date": "2026-04-30"
  }'
Response Example
{
  "do": "DO-20260430-001",
  "order_no": "100000001",
  "name": "John",
  "last_name": "Doe",
  "address": "123 Main St, City, State, 12345, United States",
  "phone": "+1234567890",
  "status": "pending",
  "tracking_status": "unassigned",
  "assign_to": "Vehicle-01",
  "date": "2026-04-30",
  "instructions": "Leave at front door",
  "notify_email": "john@example.com",
  "run_no": "1",
  "tracking_no": "TRK123456",
  "job_type": "delivery"
}

3. Create Delivery

POST /rest/V1/detrack/deliveries/create

Creates a new delivery job in Detrack from order data.

Request Payload
{
  "deliveryData": {
    "do": "DO-20260430-002",
    "date": "2026-04-30",
    "order_no": "100000002",
    "name": "Jane",
    "last_name": "Smith",
    "address": "456 Oak Ave, City, State, 67890, United States",
    "phone": "+0987654321",
    "notify_email": "jane@example.com",
    "tracking_no": "TRK654321",
    "instructions": "Call before delivery",
    "run_no": "2",
    "job_type": "delivery"
  }
}
Example Request
curl -X POST "http://yourstore.com/rest/V1/detrack/deliveries/create" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "deliveryData": {
      "do": "DO-20260430-002",
      "date": "2026-04-30",
      "order_no": "100000002",
      "name": "Jane",
      "last_name": "Smith",
      "address": "456 Oak Ave, City, State, 67890, United States",
      "phone": "+0987654321",
      "notify_email": "jane@example.com",
      "tracking_no": "TRK654321",
      "instructions": "Call before delivery",
      "run_no": "2",
      "job_type": "delivery"
    }
  }'
Response Example
{
  "do": "DO-20260430-002",
  "order_no": "100000002",
  "status": "ok",
  "tracking_no": "TRK654321"
}

4. Update Delivery

POST /rest/V1/detrack/deliveries/update

Updates an existing delivery's fields in Detrack.

Request Payload
{
  "doNumber": "DO-20260430-001",
  "fields": {
    "status": "in_transit",
    "assign_to": "Vehicle-01",
    "instructions": "Updated: Ring doorbell"
  }
}
Example Request
curl -X POST "http://yourstore.com/rest/V1/detrack/deliveries/update" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "doNumber": "DO-20260430-001",
    "fields": {
      "status": "in_transit",
      "assign_to": "Vehicle-01",
      "instructions": "Updated: Ring doorbell"
    }
  }'
Response Example
{
  "do": "DO-20260430-001",
  "status": "ok",
  "assign_to": "Vehicle-01"
}

5. Delete Delivery

POST /rest/V1/detrack/deliveries/delete

Deletes a delivery job from Detrack by DO number.

Request Payload
{
  "doNumber": "DO-20260430-001"
}
Example Request
curl -X POST "http://yourstore.com/rest/V1/detrack/deliveries/delete" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"doNumber": "DO-20260430-001"}'
Response Example
true

6. Get Vehicles

GET /rest/V1/detrack/vehicles

Fetches all available vehicles/drivers from Detrack for assignment.

Example Request
curl -X GET "http://yourstore.com/rest/V1/detrack/vehicles" \
  -H "Authorization: Bearer $TOKEN"
Response Example
[
  {
    "vehicle_id": "V001",
    "name": "Van 1",
    "status": "active",
    "driver": "Driver A"
  },
  {
    "vehicle_id": "V002",
    "name": "Truck 2",
    "status": "active",
    "driver": "Driver B"
  }
]

Detrack API Configuration

The module communicates with the Detrack REST API (v1) internally. Endpoints are configured at:

Stores > Configuration > Dev Oropeza > Detrack Settings

Setting Config Path Default Value
API Key detrack/api/key (required)
Base URL detrack/api_url/base https://app.detrack.com/api/v1/
List Deliveries detrack/api_url/list deliveries/view/all.json
Create Delivery detrack/api_url/add deliveries/create.json
Update Delivery detrack/api_url/edit deliveries/update.json
Delete Delivery detrack/api_url/delete deliveries/delete.json
View Delivery detrack/api_url/view deliveries/view.json
Vehicles detrack/api_url/vehicles vehicles/view/all.json

aoropeza/detrackshippingmanager 适用场景与选型建议

aoropeza/detrackshippingmanager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「shipping」 「delivery」 「tracking」 「magento2」 「detrack」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 aoropeza/detrackshippingmanager 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-04-30