private function generateCSV($collection)
 {
     // clean buffer
     if (ob_get_level() && ob_get_length() > 0) {
         ob_clean();
     }
     $this->getList($this->context->language->id);
     if (!count($this->_list)) {
         return;
     }
     header('Content-type: text/csv');
     header('Content-Type: application/force-download; charset=ISO-8859-2');
     header('Cache-Control: no-store, no-cache');
     header('Content-disposition: attachment; filename="' . $this->className . '_' . date('Y-m-d_His') . '.csv"');
     $megrendelok = [];
     foreach ($collection as $i => $orderInvoice) {
         $order = new Order((int) $orderInvoice->id_order);
         $customer = new Customer((int) $order->id_customer);
         $cart = new CartCore((int) $order->id_cart);
         $megrendelok[$i] = ['order' => $order, 'order_invoice' => $orderInvoice, 'customer' => $customer, 'weight' => $cart->getTotalWeight(), 'address' => new Address((int) $order->id_address_invoice)];
     }
     //var_dump($megrendelok);
     $this->context->smarty->assign(['megrendelok' => $megrendelok]);
     $this->layout = dirname(__FILE__) . '/../../views/templates/admin/csv.tpl';
 }