Skip to content

Code Map

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

Code map

This map covers the tracked repository at fec65e2b67e18da3d9d3bf4c007d3c7fd5228537: 754 files, 668 PHP files, and 19 XML files. Feature directories are code organization inside one registered Magento module.

Source areas

"Production PHP" excludes paths under Test. "Test/fixture files" includes supporting code and serialized data, not just executable test cases.

Area All files Production PHP Test/fixture files Responsibility
Core 228 122 106 Connection, SOAP services, queue coordination, CLI, monitor UI, logging, caching, date handling, Admin helpers, and test infrastructure. Guide.
Queue 15 12 3 Custom queue/monitor persistence, retries, rejection, postprocessing, and stuck-message recovery. Guide.
Product 81 54 27 Item search, field/type/price mapping, batch importing, options/links, indexing helpers, and product utilities. Guide.
ProductImages 24 7 17 File references, SOAP downloads, image comparison, gallery reconciliation, and import fields. Guide.
Customer 53 17 36 Customer export, order-driven matching, address mapping, and customer-group metadata. Guide.
CustomerImport 20 14 6 Person-customer import, addresses, default assignments, and imported-account password messages. Guide.
Order 63 34 29 Order observer/export, line/custom/payment mapping, linked-order status and quantity updates. Guide.
Invoice 31 9 22 Store invoice to CashSale export and CashSale to store invoice import. Guide.
Refund 20 8 12 CreditMemo and CashRefund import, source-order lookup, item mapping, and credit-memo state. Guide.
Shipment 41 21 20 ItemFulfillment import, single/multi-source mappers, tracking, cleanup, and email rules. Guide.
Inventory 56 32 24 Saved-search stock, single/multi repositories, MSI source/location mapping, reservations, and cron plugins. Guide.
Tax 32 15 17 Tax-line versus NetSuite-calculated tax strategies for exported sales. Guide.
Discount 50 16 34 Body/line discount strategies, promotion metadata, and cash-sale discount import. Guide.
Setup 4 4 0 Product/customer/address identity, last-stock-update, and imported-password EAV patches. Guide.

The remaining files are package metadata, licensing, registration, configuration, and presentation assets:

Surface Purpose
composer.json Package constraints, autoload namespace, and replacement metadata.
registration.php, module.xml Register MageOS_NetSuiteConnector and module sequence.
etc 16 configuration files: DI, events, schema, defaults, Admin settings/menu/routes, ACL, extension attributes, cron, and email templates.
view 14 assets: Admin layouts, monitor/config UI, templates, JavaScript, and warning emails.
phpcs.xml.dist Coding-standard configuration, not an executed test result.
README.md, LICENSE.txt Package overview and licensing text.

Database and persisted state

Declarative schema creates four connector tables:

  • mageos_netsuite_message: custom queue messages, status, attempts, payload, and priority.
  • mageos_netsuite_monitor: processing history, original/overridden payload, output, and queue association.
  • mageos_netsuite_bundle_product_link: bundle relationship import support.
  • mageos_netsuite_customer_group: customer-group NetSuite metadata.

The schema adds netsuite_internal_id and netsuite_last_import_date to sales orders, invoices, credit memos, and shipments. It adds netsuite_internal_id to inventory sources. EAV patches add product/customer/address identity, product stock-refresh timestamp, and imported-customer password state. Read the patches before migrating existing attributes or changing their types.

Last-run flags and product search state are described in Monitoring. These are synchronization state and must be included in a migration or recovery plan.

Literal dispatched events

This inventory is extracted from production PHP dispatch() calls with literal event names. It does not enumerate dynamic event names from Magento or third-party modules. Source links point to the exact dispatch; inspect its payload and call timing before adding an observer.

Event Dispatch sites
catalog_product_import_bunch_save_after Product/Model/Product/Import/Product.php
catalog_product_import_bunch_save_before Product/Model/Product/Import/Product.php
clean_cache_by_tags Product/Model/ImportQueue/Processor/CatalogProduct.php
netsuite_address_create_before Customer/Model/Mapper/Address.php; Customer/Model/Mapper/Customer.php; Order/Model/Mapper/OrderExport/Addresses.php
netsuite_cash_sale_import_after Invoice/Model/Process/Import/Cashsale.php
netsuite_cash_sale_import_before Invoice/Model/Process/Import/Cashsale.php
netsuite_cashrefund_import_after Refund/Model/Process/Import/CashRefund.php
netsuite_cashrefund_import_before Refund/Model/Process/Import/CashRefund.php
netsuite_creditmemo_import_after Refund/Model/Process/Import/CreditMemo.php
netsuite_creditmemo_import_before Refund/Model/Process/Import/CreditMemo.php
netsuite_customer_import_after CustomerImport/Model/Process/Import/Customer.php
netsuite_customer_import_before CustomerImport/Model/Process/Import/Customer.php
netsuite_customer_send_before Customer/Model/Mapper/Customer.php; Customer/Model/Process/Export/CustomerSave.php
netsuite_import_item_process_before Core/Model/Process.php
netsuite_import_product_format_from_inventory_item_after Product/Model/Mapper/Product.php
netsuite_import_product_format_from_inventory_item_before Product/Model/Mapper/Product.php
netsuite_import_request_before Core/Model/Command/Utils/ProcessRecord/DefaultRequestBuilder.php; Core/Model/Process/Import/AbstractImportProcessor.php; CustomerImport/Model/Command/RequestBuilder/CustomerImport.php; CustomerImport/Model/Process/Import/Customer.php; Product/Model/Process/Import/Item.php; Refund/Model/Process/Import/CashRefund.php; Refund/Model/Process/Import/CreditMemo.php
netsuite_inventory_item_is_importable Product/Model/Mapper/Product.php
netsuite_location_import_after Inventory/Multi/Model/Process/Import/Location.php
netsuite_location_import_before Inventory/Multi/Model/Process/Import/Location.php
netsuite_new_cashsale_send_before Invoice/Model/Process/Export/InvoiceSave.php
netsuite_new_order_add_discount_before Discount/Model/Provider/Line/OrderDiscount.php
netsuite_new_order_add_tax_item_before Tax/Model/Order/Export/TaxManager/TaxItemLine.php
netsuite_new_order_item_send_before Order/Model/Mapper/OrderExport/OrderItem.php
netsuite_new_order_send_before Order/Model/Process/Export/OrderPlace.php
netsuite_order_import_after Order/Model/Process/Import/Order.php
netsuite_order_import_save_before Order/Model/Process/Import/Order.php
netsuite_stock_item_save_before Inventory/Single/Model/NetSuiteInventoryRepository/StockDataTransformation.php

Admin and integration registrations

etc/di.xml is the canonical list of processor aliases, console commands, strategies, preferences, and plugins. etc/events.xml registers customer/order/invoice observers and disables Magento's shipment source deduction. etc/adminhtml/di.xml and Admin assets provide monitor and configuration presentation.

See Extending for extension boundaries and Testing for execution evidence and missing runtime validation.

Clone this wiki locally