Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. **File Paths:**
  2.  
  3. namespace EwallCustomPriceObserver;
  4.  
  5. use MagentoFrameworkEventObserverInterface;
  6. use MagentoFrameworkAppRequestInterface;
  7.  
  8. class SalesQuoteSaveAfterCustom
  9. {
  10. protected $checkoutSession;
  11.  
  12. public function __construct(MagentoCheckoutModelSession $checkoutSession)
  13. {
  14. $this->checkoutSession = $checkoutSession;
  15. }
  16. public function invoke($observer)
  17. {
  18. $writer = new ZendLogWriterStream(BP . '/var/log/test.log');
  19. $logger = new ZendLogLogger();
  20. $logger->addWriter($writer);
  21. $logger->info('invoke function is calling');
  22.  
  23. $quote = $observer->getEvent()->getQuote();
  24.  
  25. /* @var $quote MagentoQuoteModelQuote */
  26.  
  27. if($quote->getIsCheckoutCart())
  28. {
  29. $this->checkoutSession->getQuoteId($quote->getId());
  30. }
  31. }
  32. }
  33.  
  34. <?xml version="1.0"?>
  35. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
  36. <event name="sales_quote_save_after">
  37. <observer name="Ewall_CustomPrice_Custom" instance="EwallCustomPriceObserverSalesQuoteSaveAfterCustom" />
  38. </event>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement