Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0"?>
- <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
- <event name="catalog_product_save_after">
- <observer name="test_name" instance="RahahaRahahaWebServiceObserverProductsaveafter" />
- </event>
- </config>
- <?php
- namespace RahahaRahahaWebServiceObserver;
- use MagentoFrameworkEventObserverInterface;
- use MagentoFrameworkEventObserver;
- class Productsaveafter implements ObserverInterface
- {
- protected $_request;
- protected $_resource;
- protected $_scopeConfig;
- protected $_rahaha;
- public function __construct(
- MagentoFrameworkAppRequestInterface $request,
- MagentoFrameworkAppResourceConnection $resource,
- MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig
- )
- {
- $this->_request = $request;
- $this->_resource = $resource;
- $this->_scopeConfig = $scopeConfig;
- $storeScope = MagentoStoreModelScopeInterface::SCOPE_STORE;
- $rahaha_username = $this->_scopeConfig->getValue("adminsample/rahaha_module_credentials_grp/rahaha_username", $storeScope);
- $rahaha_password = $this->_scopeConfig->getValue("adminsample/rahaha_module_credentials_grp/rahaha_password", $storeScope);
- $rahaha_api_key = $this->_scopeConfig->getValue("adminsample/rahaha_module_credentials_grp/rahaha_api_key", $storeScope);
- $rahaha_module_status = $this->_scopeConfig->getValue("adminsample/rahaha_module_status_grp/rahaha_module_status", $storeScope);
- $rs = $this->_resource;
- $this->_rahaha = new RahahaRahahaWebServiceModelRahahaRahaha($rahaha_username, $rahaha_password, $rahaha_api_key, $rahaha_module_status, $rs);
- }
- public function execute(MagentoFrameworkEventObserver $observer)
- {
- $post_data = $this->_request->getPost()->toArray();
- //save stuff here...
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement