Hi guys, I added additioal fields to the Product New/Edit form and need to save them onto a new table in the database as well as post the data onto another website store api. I have created the function to perform all of this but, I am not sure how this should be called. Should I hardcode the function call inside the Product Save execute() function?
Sorry guys, I am really new to Magento and am struggling, hope ye all can help me out.
Thanks.
Ok did some research and it seems I can use custom Productsaveafter class but does any of you know how I can get the POST data in the execute method of Productsaveafter so I can pass them to the function i made?
How is the «catalog_product_save_after» event triggered and can be handled? https://mage2.pro/t/1238
Thanks for the feedback, I am using Productsaveafter based on that catalog_product_save_after samplecode.
I have also asked stack magento community and the answer to the issue regarding getting the POST is this:
class Productsaveafter implements ObserverInterface { protected $_request; protected $_resource; public function __construct( \Magento\Framework\App\RequestInterface $request ) { $this->_request = $request; } public function execute(\Magento\Framework\Event\Observer $observer) { $post_data = $this->_request->getPost()->toArray(); }