Sign in to follow this  
David_S

PHP Fatal error: Uncaught Error: Call to a member function getTracksCollection() on null

Recommended Posts

Hi,

Magento 2.3.5-p2
M2epro 1.9.1

while trying to create shipping from external source using Magento API in I get an PHP fatal error in M2epro:

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getTracksCollection() on null in /httpdocs/app/code/Ess/M2ePro/Observer/Shipment/Item.php:32\nStack trace:\n#0 /httpdocs/app/code/Ess/M2ePro/Observer/AbstractModel.php(68): Ess\\M2ePro\\Observer\\Shipment\\Item->process()\n#1/httpdocs/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): Ess\\M2ePro\\Observer\\AbstractModel->execute(Object(Magento\\Framework\\Event\\Observer))\n#2/httpdocs/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): Magento\\Framework\\Event\\Invoker\\InvokerDefault->_callObserverMethod(Object(Ess\\M2ePro\\Observer\\Shipment\\Item), Object(Magento\\Framework\\Event\\Observer))\n#3 /httpdocs/vendor/magento/framework/Event/Manager.php(66): Magento\\Framework\\Event\\Invoker\\InvokerDefault->dispatch(Array, Object(Magento\\Framework\\Event\\Observer))\n#4 /var/www/vhosts/jekosho...'

 

did anybody have this issue?

David

Share this post


Link to post
Share on other sites
Guest rachelcbz

Hi, as a possible solution you may try to do the next:

 

replace the event that M2E Pro is subscribed to in the file app/code/Ess/M2ePro/etc/events.xml:

From this:

<event name="sales_shipment_item_save_after">

<observer name="m2epro_observer_shipment"

instance="Ess\M2ePro\Observer\Shipment\Item"

shared="false" />

</event>

 

To this:

<event name="sales_shipment_item_save_commit_after">

<observer name="m2epro_observer_shipment"

instance="Ess\M2ePro\Observer\Shipment\Item"

shared="false" />

</event>

Share this post


Link to post
Share on other sites

I do not suggest the previous fix by @rachelcbz, since from our shipping platform each call ot the event generates a new shipping entity in magento, decrement the quantity in salable stock (Magento MSI) but the shipping entity is not created correctly (missing user info) and DO NOT update magento “custom state” to complete.

This thing has caused problem in our MSI system since now we have orders that have more than 1 source reservation (one for each shipment). All these shipping entities cannot be deleted and had decremented the salable quantity more than 1 time (as it was supposed to be done), causing serious problems....

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this