Skip to content

Extending the Connector

Matt MacDougall edited this page Sep 9, 2026 · 1 revision

Extending the connector

Build project-specific behavior in a separate Magento module. Reference the current MageOS\NetSuiteConnector classes and inspect the consolidated DI configuration, event declarations, and module dependencies.

The older Rocket Web guide remains useful for the concepts of mapping, processing, and observer-based customization. Its module names, constructor examples, and some event names are historical. Use the current source as the contract.

Main extension boundaries

Need Current boundary
Decide whether a record flow is enabled Feature permission/config providers and import processor isActive().
Fetch, validate, or map a NetSuite record Core service repository/management and feature mappers.
Add an import record type An import processor registered in the Core import processor array, with search/record identity and mapping behavior.
Add an export action An export processor registered by action, plus an event observer or explicit producer to enqueue it.
Add a product import stage Product field mapper or import-row entity processor, depending on whether it maps a field or persists a separate import entity.
Alter order tax, discount, or shipping Existing mapper plugins and strategy interfaces.
React to a queue result Core\Api\PostProcessHandlerInterface and its aggregator registrations. Consider retry and repeated-delivery effects.
Change inventory strategy Inventory repository and transformation resolvers; test MSI reservations and fulfillment alongside stock writes.
Expose an operator command Symfony console command and an explicit registration in etc/di.xml.

The import queue manager supports multiple batch entities, including catalog products, advanced pricing, and bundle links. Extending one mapper does not automatically persist an additional entity type.

Product eligibility and mappings

The netsuite_inventory_item_is_importable event carries mutable eligibility state. The base product processor does not itself enforce a particular account-specific "export to Magento" checkbox. A project module can implement that policy through the current event contract.

Simple and custom field mappings support standard record values, custom values, lists, and checkbox handling. If adding new field behavior, preserve Magento attribute backend types, select-option behavior, store/website assignment, and import validation. See the constant-mapping defect before depending on the existing constant UI option.

Custom fields intended for configurable products and images are NetSuite data contracts. This repository does not include the historical SaveDataForMagento2.js SuiteScript attachment. Supply and verify any required account-side script as a separate project artifact.

Events and registrations

The Code map lists literal events dispatched by the current production PHP files, with source links. Read the dispatch payload and timing before subscribing. Do not assume the older netsuite_product_fields_merge event exists merely because it appears in a historical example.

Some installation-wide preferences and plugins affect Magento product importing, indexing, and inventory APIs. Review their behavior on ordinary Magento operations as well as connector commands. A plugin is not necessarily disabled by the global integration setting.

Compatibility names

Several model names are retained as wrappers around newer service implementations. For example, Inventory\Model\Process\Export\CompensateReservation extends Inventory\Service\PostProcess\CompensateReservation, while DI registers the service name. Plugins or preferences targeting only the old wrapper will not intercept the registered handler.

Inspect the actual resolved class before porting customizations from a previous release. Do not change retained NetSuite field IDs, entity identity attributes, queue names, or event names solely to match the new package branding.

Validation

Use isolated mapping tests for custom field logic and Magento integration tests for persistence and queue effects. Then verify a representative sandbox round trip, including retries and duplicate delivery. Avoid writing a new mapper that succeeds locally while bypassing the record-link, inventory, or accounting contracts of the complete flow.

Sources: import processor contract, export processor contract, import coordination, import row list, queue postprocessor, inventory resolvers, current compensation handler.

Clone this wiki locally