0

I need to debug the process that sync data from Magento to Ebay/Amazon in order to do some customization in the code.

In particular the aim is to change the way shipping tax are calculated in the imported order anyway the main point here is how to debug/trace the entire process and found code entry point.

There is already a similar question but doesn't contains the info that I need, any way it has some info you may be interested to understand better the scenario in case you are facing a similar challenge : How to test/debug Ess_M2ePro Amazon integration?

So question is how can I trace the process using Xdebug on my local environment ?

1 Answer 1

1

It is possible to trigger the sync on a local environment but you need to be careful otherwise your local data can affect the data on Ebay. (for ex. product listing)

In order to reduce problems it is a good idea to have a local DB as much as possible updated with the LIVE site one and to exclude unwanted sync from the cron job.

There are multiple steps here involved:

  1. Disable unwanted sync action ( for example here I'm focused only on Ebay Orders)
  2. Create a test file that start the process.
  3. [UPDATE] Create a licence for your local

-- Introduction --
All the sync process ( in particular the order one ) is done by the cron job contained in Ess_M2ePro_Model_Cron::processSynchronization() ... so we can jump to this one Ess_M2ePro_Model_Synchronization_Cron::process()

-- STEP 1 -- -> Ess_M2ePro_Model_Synchronization_Cron::process() I need only to check the order import process so to reduce possible issues I'm removing some task from the $synchDispatcher.

$synchDispatcher->setTasks(array(
//            Ess_M2ePro_Model_Synchronization_Tasks::DEFAULTS,
//            Ess_M2ePro_Model_Synchronization_Tasks::TEMPLATES,
            Ess_M2ePro_Model_Synchronization_Tasks::ORDERS,
//            Ess_M2ePro_Model_Synchronization_Tasks::FEEDBACKS,
//            Ess_M2ePro_Model_Synchronization_Tasks::OTHER_LISTINGS
        ));

-- STEP 2 --
Create a test.php file in your root directory that call the above class::method

<?php
require_once './app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(1);
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
Mage::setIsDeveloperMode(true);
?>

Method 1 -> step 1 required

<?php
$tempSynch = new Ess_M2ePro_Model_Synchronization_Cron();
$tempSynch->process();
?>

Method 2 -> step 1 not required

Here we trigger only the receive order for Ebay

$lockItem = Mage::getModel('M2ePro/Synchronization_LockItem');
Mage::helper('M2ePro/Data_Global')->setValue('synchLockItem',$lockItem);
$logs = Mage::getModel('M2ePro/Synchronization_Log');
Mage::helper('M2ePro/Data_Global')->setValue('synchLogs',$logs);
$profiler = Mage::getModel('M2ePro/Synchronization_Profiler',$profilerParams);
Mage::helper('M2ePro/Data_Global')->setValue('synchProfiler',$profiler);

$tempSynch = new Ess_M2ePro_Model_Ebay_Synchronization_Tasks_Orders_Receive();
$tempSynch->process();

-- STEP 3 -- --> Create new license for your local test magento installation

At this point you are ready to go and start:
Just put you breakpoints and run the test.php page.

3
  • if this is working when feel free to accept the answer, but I am wondering why not simply post another answer to the question noted in your question? May 20, 2014 at 13:16
  • because that answer it is not specified for Xdebug and it has already and accepted answer ... in case it is required I will move the answer there
    – Fra
    May 20, 2014 at 14:20
  • 1
    it is not required i was just curious. May 20, 2014 at 14:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.