0

I first used sales_model_service_quote_submit_before then used event sales_order_place_after but secound event is not working..any idea? scope is global.

ex- Company/Vendors/etc/events.xml

<?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="sales_order_place_after">
        <observer name="sales_order_grid_vendors_customer" instance="Company\Vendors\Observer\AddVendorOrders" />
    </event>
</config>

Observer/AddVendorOrders.php

<?php
namespace Company\Vendors\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
class AddVendorOrders implements ObserverInterface
{
  public function execute(Observer $observer)
      {
        die('testing);
      }
}
  • Any error are generate in log, Have you checked? – Rakesh Jesadiya Jun 24 '16 at 9:41
  • nop..i solve one error now not get quote details..code is $quoteRepository = $this->_objectManager->create('Magento\Quote\Model\QuoteRepository'); $quote = $quoteRepository->get($order->getQuoteId()); $customerEmail = $quote->getCustomerEmail(); not get $customerEmail..how to get? – Magento2 Devloper Jun 24 '16 at 9:49
  • you can do it using $order->getCustomerEmail() – Rakesh Jesadiya Jun 24 '16 at 9:57
  • tx.. how to get quote data..ex- status. – Magento2 Devloper Jun 24 '16 at 9:59
  • you can fetch using $order->getData() – Rakesh Jesadiya Jun 24 '16 at 10:01
0

You can just find from getData() method,

check using ,

$quote = $quoteRepository->get($order->getQuoteId()); 
echo "<pre>";print_R($quote->getData()); 

Now you can check all field of quote object and get field based on your requirements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.