M2E Pro works based on core Magento functionality. The Module identifies all of the product updates made through the Magento interface and synchronizes them on the Channels.
It is also possible to update Magento Product data (quantity, price, status, etc.) without using core Magento functionality. But M2E Pro will not detect the changes in case they are made via:
There are two programmatic methods to keep M2E Pro notified about Magento Product data changes:
To find the models in your Magento File system, follow this path:
The Object method allows you to track changes in all attributes used in Magento Product settings. It triggers automated adding/removal of Products from M2E Pro Listings (Auto Add/Remove Rules), as well as List, Relist, Stop, and all available options of Revise Rules in Synchronization Policy.
This method starts picking up changes from the moment you register Magento Products (i.e. add them for observation).
Code snippet for creating an M2E Pro Object model
The code snippet below shows how an M2E Pro Object Model is created
$model = Mage::getModel('M2ePro/PublicServices_Product_ObjectChange'); // you pass a product ID for observing $model->observeProduct(561); // you have 'catalog/product' object for observing $product = Mage::getModel('catalog/product') ->setStoreId(2) ->load(562); $model->observeProduct($product); // make changes to these products via direct sql $model->applyChanges();
How to use the Object method
Follow these steps in order to properly implement an M2E Pro Object model and make it inform the extension about all Magento Product data changes. Before you start, examine the code snippet above.
Step 1. Create an M2E Pro Object model.
Step 2. Register the Magento Products that you want to observe changes in. There are two ways to do it – either use the $model->observeProduct method and pass Product ID through it or use $product = Mage::getModel('catalog/product').
Step 3. Once the Products have been registered, you can manipulate data for these products using SQL injections or by any other means.
Step 4. Initiate the applyChanges() method for all the registered products. While this method is running, M2E Pro will automatically observe all the product changes that have originated outside of Magento Core Models.
Using the Structural method, you can inform M2E Pro about changes made to particular Attributes of your Magento Products, such as Price, Quantity, and Status.
This method requires only notifications confirming changes in certain Magento Product data.
Code snippet for creating an M2E Pro Structural model
The code snippet below shows how an M2E Pro Structural Model is created in regard to Price, Quantity, and Status changes.
$model = Mage::getModel('M2ePro/PublicServices_Product_SqlChange'); // notify M2E Pro about changes in price, qty or status of the product with ID 17 $model->markProductChanged(17); // make price change to the product with ID 18 and then notify M2E Pro $model->markPriceChanged(18); // make QTY change to the product with ID 19 and then notify M2E Pro $model->markQtyChanged(19); // make status change to the product with ID 20 and then notify M2E Pro $model->markStatusChanged(20); $model->applyChanges();
How to use the Structural method
Follow these steps in order to properly implement an M2E Pro Structural model and make it notify the extension about the particular Magento Product data changes. Before you start, examine the code snippet above.
Step 1. Create an M2E Pro Structural model. You can choose to detect changes in either of two ways:
Step 2. Make changes in Magento Product Attributes (for example, using direct SQL requests).
Step 3. Initiate the applyChanges() method of the Structural model for all products. While this method is running, M2E Pro will automatically observe all the product changes that have originated outside of Magento Core Models.
Object method vs Structural method
This comparison may help you figure out which method will work best depending on your needs, the number of Magento Products, and the kind of changes you make, available system resources, etc.
Was this article helpful?
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
We appreciate your effort and will try to fix the article