Skip to main content
added 164 characters in body
Source Link
Ronak Rathod
  • 6.5k
  • 18
  • 43

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>

 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <!--    Reorder from Admin side-->
    <event name="sales_convert_order_to_quote">
        <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
    </event>

    <!--    Reorder from customer side-->
    <event name="controller_action_predispatch_sales_order_reorder">
        <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
    </event>

    <event name="checkout_onepage_controller_success_action">
        <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
    </event>

    <event name="checkout_cart_product_add_after">
        <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
    </event>
</config>
  

Here is my Observer file

<?php

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface { protected $customerSession; public function __construct(Session $customerSession) { $this->customerSession = $customerSession; }

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface
{
    protected $customerSession;
    public function __construct(Session $customerSession)
    {
        $this->customerSession = $customerSession;
    }

    public function execute(Observer $observer)
    {
        $order = $observer->getEvent();
        $entity_id = $order->getRequest()->getParam('order_id');
        $customer = $this->customerSession;
        $parentOrder = [$entity_id, []];
        $customer->setMyValue($parentOrder);
    }
}

}

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>

 <!--    Reorder from Admin side-->
<event name="sales_convert_order_to_quote">
    <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
</event>

<!--    Reorder from customer side-->
<event name="controller_action_predispatch_sales_order_reorder">
    <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
</event>

<event name="checkout_onepage_controller_success_action">
    <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
</event>

<event name="checkout_cart_product_add_after">
    <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
</event>
 

Here is my Observer file

<?php

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface { protected $customerSession; public function __construct(Session $customerSession) { $this->customerSession = $customerSession; }

public function execute(Observer $observer)
{
    $order = $observer->getEvent();
    $entity_id = $order->getRequest()->getParam('order_id');
    $customer = $this->customerSession;
    $parentOrder = [$entity_id, []];
    $customer->setMyValue($parentOrder);
}

}

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <!--    Reorder from Admin side-->
    <event name="sales_convert_order_to_quote">
        <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
    </event>

    <!--    Reorder from customer side-->
    <event name="controller_action_predispatch_sales_order_reorder">
        <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
    </event>

    <event name="checkout_onepage_controller_success_action">
        <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
    </event>

    <event name="checkout_cart_product_add_after">
        <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
    </event>
</config>
 

Here is my Observer file

<?php
namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface
{
    protected $customerSession;
    public function __construct(Session $customerSession)
    {
        $this->customerSession = $customerSession;
    }

    public function execute(Observer $observer)
    {
        $order = $observer->getEvent();
        $entity_id = $order->getRequest()->getParam('order_id');
        $customer = $this->customerSession;
        $parentOrder = [$entity_id, []];
        $customer->setMyValue($parentOrder);
    }
}
deleted 2 characters in body
Source Link

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>

<!--    Reorder from Admin side-->
<event name="sales_convert_order_to_quote">
    <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
</event>

<!--    Reorder from customer side-->
<event name="controller_action_predispatch_sales_order_reorder">
    <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
</event>

<event name="checkout_onepage_controller_success_action">
    <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
</event>

<event name="checkout_cart_product_add_after">
    <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
</event>

Here is my Observer file

<?php

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface { protected $customerSession; public function __construct(Session $customerSession) { $this->customerSession = $customerSession; }

public function __construct(Session $customerSession)
{
    $this->customerSession = $customerSession;
}

public function execute(Observer $observer)
{
 
    $order = $observer->getEvent();
    $entity_id = $order->getRequest()->getParam('order_id');
    $customer = $this->customerSession;
    $parentOrder = [$entity_id, []];
    $customer->setMyValue($parentOrder);

    




}

}

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>

<!--    Reorder from Admin side-->
<event name="sales_convert_order_to_quote">
    <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
</event>

<!--    Reorder from customer side-->
<event name="controller_action_predispatch_sales_order_reorder">
    <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
</event>

<event name="checkout_onepage_controller_success_action">
    <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
</event>

<event name="checkout_cart_product_add_after">
    <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
</event>
<?php

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface { protected $customerSession;

public function __construct(Session $customerSession)
{
    $this->customerSession = $customerSession;
}

public function execute(Observer $observer)
{
 
    $order = $observer->getEvent();
    $entity_id = $order->getRequest()->getParam('order_id');
    $customer = $this->customerSession;
    $parentOrder = [$entity_id, []];
    $customer->setMyValue($parentOrder);

    




}

}

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>

<!--    Reorder from Admin side-->
<event name="sales_convert_order_to_quote">
    <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
</event>

<!--    Reorder from customer side-->
<event name="controller_action_predispatch_sales_order_reorder">
    <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
</event>

<event name="checkout_onepage_controller_success_action">
    <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
</event>

<event name="checkout_cart_product_add_after">
    <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
</event>

Here is my Observer file

<?php

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface { protected $customerSession; public function __construct(Session $customerSession) { $this->customerSession = $customerSession; }

public function execute(Observer $observer)
{
    $order = $observer->getEvent();
    $entity_id = $order->getRequest()->getParam('order_id');
    $customer = $this->customerSession;
    $parentOrder = [$entity_id, []];
    $customer->setMyValue($parentOrder);
}

}

deleted 307 characters in body
Source Link

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>

<!--    Reorder from Admin side-->
<event name="sales_convert_order_to_quote">
    <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
</event>

<!--    Reorder from customer side-->
<event name="controller_action_predispatch_sales_order_reorder">
    <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
</event>

<event name="checkout_onepage_controller_success_action">
    <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
</event>

<event name="checkout_cart_product_add_after">
    <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
</event>
<?php

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface { protected $customerSession;

public function __construct(Session $customerSession)
{
    $this->customerSession = $customerSession;
}

public function execute(Observer $observer)
{

    $order = $observer->getEvent();
    $entity_id = $order->getRequest()->getParam('order_id');
    $customer = $this->customerSession;
    $parentOrder = [$entity_id, []];
    $customer->setMyValue($parentOrder);

    $orderid = $observer->getOrder();  
    $product_id=$orderid->getProductId(); 
    $event = $observer->getEvent()->getRequest();
    $product=$event->getProduct(); 
    $quote = $event->getQuote();
    $quoteItem = $event->getQuoteItem();
    $allItems = $event->getAllItems();




}

}

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>

<!--    Reorder from Admin side-->
<event name="sales_convert_order_to_quote">
    <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
</event>

<!--    Reorder from customer side-->
<event name="controller_action_predispatch_sales_order_reorder">
    <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
</event>

<event name="checkout_onepage_controller_success_action">
    <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
</event>

<event name="checkout_cart_product_add_after">
    <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
</event>
<?php

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface { protected $customerSession;

public function __construct(Session $customerSession)
{
    $this->customerSession = $customerSession;
}

public function execute(Observer $observer)
{

    $order = $observer->getEvent();
    $entity_id = $order->getRequest()->getParam('order_id');
    $customer = $this->customerSession;
    $parentOrder = [$entity_id, []];
    $customer->setMyValue($parentOrder);

    $orderid = $observer->getOrder();  
    $product_id=$orderid->getProductId(); 
    $event = $observer->getEvent()->getRequest();
    $product=$event->getProduct(); 
    $quote = $event->getQuote();
    $quoteItem = $event->getQuoteItem();
    $allItems = $event->getAllItems();




}

}

I am using "controller_action_predispatch_sales_order_reorder" event to find out whether an order is reorder or not. Using this event I am able to get original orderId but along with that I want Order details as well which were ordered in the original order.

How can I get that from this event? I have already tried getOrder(), getProduct(), getQoute(), getAllItems() everything is coming up as null.

Here is my code

<?xml version="1.0"?>

<!--    Reorder from Admin side-->
<event name="sales_convert_order_to_quote">
    <observer name="admin_reorder" instance="VoltLighting\OrderInfo\Observer\AdminReorder"/>
</event>

<!--    Reorder from customer side-->
<event name="controller_action_predispatch_sales_order_reorder">
    <observer name="customer_reorder" instance="VoltLighting\OrderInfo\Observer\CustomerReorder"/>
</event>

<event name="checkout_onepage_controller_success_action">
    <observer name="customer_reorder_success" instance="VoltLighting\OrderInfo\Observer\CustomerReorderSuccess"/>
</event>

<event name="checkout_cart_product_add_after">
    <observer name="customer_predispatch_cart" instance="VoltLighting\OrderInfo\Observer\CustomerReorderCart"/>
</event>
<?php

namespace VoltLighting\OrderInfo\Observer;

use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface;

class CustomerReorder implements ObserverInterface { protected $customerSession;

public function __construct(Session $customerSession)
{
    $this->customerSession = $customerSession;
}

public function execute(Observer $observer)
{

    $order = $observer->getEvent();
    $entity_id = $order->getRequest()->getParam('order_id');
    $customer = $this->customerSession;
    $parentOrder = [$entity_id, []];
    $customer->setMyValue($parentOrder);

    




}

}

Source Link
Loading