I need to change some data in request before reorder in backend with observer. But I'm constantly failing in changing request params. There are two entities of the request, one in core create controller and one in observer. Seems they are not connected at all.
My question: Can I possibly change any data on adminhtml_sales_order_create_process_data_before
to make influence on order creation process, or better step aside from observer and rewrite controller function?
public function checkPonAndIponData($observer)
{
$request = $observer->getEvent()->getRequest()->getParams();
if(isset($request['order']['quote'])) {
$data['purchase_order_number'] = isset($request['order']['quote']['purchase_order_number'])?:null;
$data['internal_purchase_order_number'] = isset($request['order']['quote']['internal_purchase_order_number'])?:null;
foreach($data as $key => $array) {
if(isset($array['check'])) {
$data[$key] = isset($array['old'])?:null;
} else {
$data[$key] = isset($array['new'])?:null;
}
$request['order']['quote'][$key] = $data[$key];
}
}
$observer->getEvent()->getRequest()->setParams($request);
return $observer;
}