Exemple #1
0
 /**
  * Function that sets data array for pdf rendering.
  *
  * @param ApiOrderInterface $apiOrder
  *
  * @return array
  */
 protected function getContentForPdf(ApiOrderInterface $apiOrder)
 {
     $order = $apiOrder->getEntity();
     $customerNumber = null;
     if ($order->getCustomerAccount()) {
         $customerNumber = $order->getCustomerAccount()->getNumber();
     } else {
         $customerNumber = sprintf('%05d', $order->getCustomerContact()->getId());
     }
     $data = ['recipient' => $order->getDeliveryAddress(), 'responsibleContact' => $order->getResponsibleContact(), 'deliveryAddress' => $order->getDeliveryAddress(), 'customerContact' => $order->getCustomerContact(), 'billingAddress' => $order->getInvoiceAddress(), 'order' => $order, 'customerNumber' => $customerNumber, 'orderApiEntity' => $apiOrder, 'itemApiEntities' => $apiOrder->getItems(), 'templateBasePath' => $this->templateBasePath, 'templateMacrosPath' => $this->templateMacrosPath, 'website_locale' => $this->websiteLocale];
     return $data;
 }
Exemple #2
0
 /**
  * Remove all item delivery-addresses that are the same as the default
  * delivery address of the order
  *
  * @param ApiOrderInterface $order
  */
 protected function removeItemAddressesThatAreEqualToOrderAddress($order)
 {
     $deliveryAddressId = $order->getDeliveryAddress()->getContactAddress()->getId();
     foreach ($order->getItems() as $item) {
         $itemEntity = $item->getEntity();
         $this->removeOrderAddressIfContactAddressIdIsEqualTo($itemEntity, $deliveryAddressId);
     }
 }