We have a comprehensive server application successfully running on Magento 1.x sending various information between Magento and an accounts system via SOAP/REST web services. We now have a need to convert various Magento V1.xx code to version 2.xx. Due to the multitude of changes in V2 this not a small task.
In version 1.0 it was possible using SOAP to let Magento know which websites to assign to new product. This is not available in the current Magento V2.xx REST POST method, so I have been trying to do this by adding our own JSON website properties to the POST request JSON against our own new xxxProductRepository class ( which extends from the Magento one). We have also got to have our own class which extends from the standard Magento Product as it must have a setter method to accept any new properties we wish to send in the JSON POST request.
I have got all that working with a new defined route BUT the save method is not saving the stock information included in the JSON request because there are a number of standard plugins associated with the Magento ProductRepository class which are not being called. I assumed naively that extending from the Magento classes would be enough.
It it quite possible I'm going about it all wrong or just missing a step but if anyone can give me a few pointers on a possible efficient solution it would be greatly appreciated.
Solved! Go to Solution.
Thanks to anyone that bothered to look. Sorted myself it was because the public function "save" (which the plugins were bound to on the parent class) was not on my custom class which inherited from ProductRepository. Inheritance on it's own was not enough.