/** * @param Order $order * @param Customer $customer */ protected function processCustomer(Order $order, Customer $customer = null) { if (!$customer || !$customer->getId()) { $customer = $this->databaseHelper->findOneBy('OroCRM\\Bundle\\MagentoBundle\\Entity\\Customer', ['email' => $order->getCustomerEmail(), 'channel' => $order->getChannel()]); } if ($customer instanceof Customer) { // now customer orders subtotal calculation support only one currency. // also we do not take into account order refunds due to magento does not bring subtotal data // customer currency needs on customer's grid to format lifetime value. $customer->setCurrency($order->getCurrency()); } $order->setCustomer($customer); if ($order->getCart()) { $order->getCart()->setCustomer($customer); } }