Fix Magento 2 order import to include all stores, not just B2C_ prefixed orders #133
+143
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The Magento 2 extension was only importing orders with the "B2C_" prefix, skipping orders from other stores like Amazon orders created by M2E Pro plugin. This resulted in incomplete order history in Clerk.io and incorrect ranking.
Issue: FED-1397 - Importar pedidos de Magento 2 sin prefijo B2C_
Root Cause
The
AbstractAction.phpwas hardcoded to filter orders bystore_id, which restricted imports to only the current store scope. For multi-store setups with different order prefixes (B2C_, B2B_, Amazon orders, etc.), this caused orders from other stores to be excluded.Solution
Added a new configuration option "Import orders from all stores" that allows administrators to choose between:
Changes Made
New Admin Configuration
Enhanced Order Controller
shouldApplyStoreFilter()method to check configurationImproved AbstractAction Architecture
shouldApplyStoreFilter()method that child classes can overrideDocumentation
Testing
The solution:
Configuration Instructions
For the client (La Ciclomoto Imperatore Srl):
This will import orders from all stores including:
Files Modified
etc/adminhtml/system.xml- Added new configuration fieldModel/Config.php- Added configuration constantController/AbstractAction.php- Enhanced with configurable store filteringController/Order/Index.php- Override store filtering logic with loggingREADME.md- Added documentation for new feature💻 View my work • 👤 Initiated by @CasperKN • About Codegen