I'm trying to create a Module that gets the order data when an order is placed and sends it to a third party using FTP.
I've created an Observer that gets called by the sales_order_place_after event.
My Observer code:
<?php
use Magento\Framework\Event\ObserverInterface;
class Orderobserver implements ObserverInterface
{
public function __construct(
\Magento\Quote\Model\QuoteFactory $quoteFactory,
\Magento\Sales\Model\Order $order,
\Digitaq\CbFashion\Helper\Data $helper
)
{
$this->_order = $order;
$this->_helper = $helper;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$order = $observer->getEvent()->getOrder();
$this->_helper->writeShp($order);
}
}
The observer gets called succesfully and the writeShp method also does, but it's not possible for me to dump the $order variable, as that leads to a redirect to the cart without the order being fulfilled. How can I see this variable so I know what data I can pull?