/**
  * This function prepares the list of customers with information about:
  *
  * id - user ID
  * customer_firstname - customer's first name
  * customer_country - country according to customer's address
  * customer_city - country according to customer's address
  * customer_zip_code - ZIP code according to customer's address
  * customer_email - customer's email
  * customer_registration - indicates if it is a registered customer ( 0 ), or he chose the purchase without registration ( 1 ), (INT 0 or 1)
  * customer_type - indicates if it is an end customer ( 0 ) or a company ( 1 ), (INT 0 or 1)
  * customer_vat_status - indicates  it is a VAT payer (1) or not (0), (INT 0 or 1)
  * The list can be implemented under a condition from actually used orders Shipping IDs, this list is available as a $this->getShippingsIds() list.
  *  If you decide not to use the list of ids of customers found in orders, the export can be slower and more data-demanding, in case of larger amount of orders.
  *
  * @param array $customerIds
  * @return ShippingList
  */
 public function getCustomers($customerIds)
 {
     $result = $this->getCustomersItems($customerIds);
     $data = new CustomerList();
     foreach ($result as $row) {
         $data->addBean(new CustomerBean($row));
     }
     return $data;
 }
 /**
  * 
  * @param OrderBean $order
  */
 private function showShopOrder($order)
 {
     $shopOrder = new ShopOrderEntity();
     // basic order section
     $shopOrder->addItem(new ShopIdEntity($this->model->getEshopId()));
     $shopOrder->addItem(new ShopNameEntity($this->model->getEshopName()));
     $shopOrder->addItem(new IdOrderEntity($order->id));
     $shopOrder->addItem(new DateCreatedEntity($order->date_created));
     $shopOrder->addItem(new DateUpdatedEntity($order->date_updated));
     $shopOrder->addItem(new CurrencyIdEntity($order->currency_id));
     $shopOrder->addItem(new CurrencyEntity($order->currency));
     $shopOrder->addItem(new PriceEntity($order->price));
     $shopOrder->addItem(new PriceWithoutVatEntity($order->price_without_vat));
     // order status section
     $orderStatusBean = $this->orderStatusBean->getBeanById($order->order_status_id);
     $shopOrder->addItem(new OrderStatusIdEntity($order->order_status_id));
     $shopOrder->addItem(new OrderStatusNameEntity($orderStatusBean->order_status_name));
     // payment section
     $payment = $this->payment->getBeanById($order->payment_id);
     $shopOrder->addItem(new PaymentIdEntity($order->payment_id));
     $shopOrder->addItem(new PaymentNameEntity($payment->payment_name));
     $shopOrder->addItem(new PaymentPriceEntity($payment->payment_price));
     $shopOrder->addItem(new PaymentPriceWithoutVatEntity($payment->payment_price_without_vat));
     // shipping section
     if ($shipping = $this->shipping->getBeanById($order->shipping_id)) {
         $shopOrder->addItem(new ShippingIdEntity($order->shipping_id));
         $shopOrder->addItem(new ShippingNameEntity($shipping->shipping_name));
         $shopOrder->addItem(new ShippingPriceEntity($shipping->shipping_price));
         $shopOrder->addItem(new ShippingPriceWithoutVatEntity($shipping->shipping_price_without_vat));
         $shopOrder->addItem(new NoteEntity($order->note));
     }
     // customer section
     if ($customerBean = $this->customerBean->getBeanById($order->customer_id)) {
         $customer = new CustomerEntity();
         $customer->addItem(new CustomerCityEntity($customerBean->customer_city));
         $customer->addItem(new CustomerCountryEntity($customerBean->customer_country));
         $customer->addItem(new CustomerZipCodeEntity($customerBean->customer_zip_code));
         $customer->addItem(new CustomerEmailEntity($customerBean->customer_email));
         $customer->addItem(new CustomerFirstnameEntity($customerBean->customer_firstname));
         $customer->addItem(new CustomerRegistrationEntity($customerBean->customer_registration));
         $customer->addItem(new CustomerTypeEntity($customerBean->customer_type));
         $customer->addItem(new CustomerVatStatusEntity($customerBean->customer_vat_status));
         $customer->addItem(new CustomerIdEntity($customerBean->id));
         $shopOrder->addItem($customer);
     }
     // product section
     if ($orderProductBean = $this->orderProductBean->getBeanById($order->id)) {
         $orderProducts = new OrderProductsEntity();
         $productList = $orderProductBean->getProduct_list();
         foreach ($productList as $productBean) {
             $product = new ProductEntity();
             $product->addItem(new ProductIdEntity($productBean->id));
             $product->addItem(new ProductNameEntity($productBean->product_name));
             $product->addItem(new ProductPriceEntity($productBean->product_price));
             $product->addItem(new ProductPriceWithoutVatEntity($productBean->product_price_without_vat));
             $product->addItem(new ProductPurchasePriceEntity($productBean->product_purchase_price));
             $product->addItem(new ProductCountEntity($productBean->product_count));
             $orderProducts->addItem($product);
             // categories section
             if ($productCategoryBean = $this->model->getCategories($this->categoriesList, $productBean->category_id, $productBean->id)->getBeanById($productBean->id)) {
                 $productCategories = new CategoryTreeEntity();
                 $categoriesList = $productCategoryBean->getCategoryList();
                 foreach ($categoriesList as $categoryBean) {
                     $category = new CategoryEntity();
                     $category->addItem(new CategoryIdEntity($categoryBean->id));
                     $category->addItem(new CategoryNameEntity($categoryBean->category_name));
                     $category->addItem(new CategoryLevelEntity($categoryBean->category_level));
                     $productCategories->addItem($category);
                 }
                 $product->addItem($productCategories);
             }
         }
         $shopOrder->addItem($orderProducts);
     }
     echo $shopOrder;
 }