diff --git a/modules/ant_configurations/AdminAntConfigurations.php b/modules/ant_configurations/AdminAntConfigurations.php index d53d163a..7b3a57a3 100644 --- a/modules/ant_configurations/AdminAntConfigurations.php +++ b/modules/ant_configurations/AdminAntConfigurations.php @@ -142,28 +142,30 @@ class AdminAntConfigurations extends AdminTab HelperFormBootstrap::displayErrors($this->l('Veuillez choisir une categorie')); } } elseif(Tools::isSubmit('submitExportDiscount')){ - HelperFormBootstrap::displayWarning($this->l('L\'outils n\'est pas encore disponible')); - // $results = DB::getInstance()->ExecuteS(' - // SELECT dh.`id_customer`, dh.`date_add` as `date_generate`,o.`id_order`, dh.`name`, o.`value` - // FROM `'._DB_PREFIX_.'ant_discount_history` dh - // LEFT JOIN `'._DB_PREFIX_.'order_discount` o ON (o.`id_discount` = dh.`id_discount`) - // WHERE 1 - // '); - // if($results) { - // $row_definition = array( - // 'id_customer' => 'Client ID', - // 'id_order' => 'Commande ID', - // 'name' => 'Bon de réduction', - // 'value' => 'Valeur', - // 'date_generate' => 'Date de génération', - // ); - // header("Content-Type: text/csv; charset=UTF-8"); - // header("Content-Disposition: attachment;filename=export-".date('dmYHi').".csv;"); - // $this->exportCsv($cmd); - // die(); - // } else { - // HelperFormBootstrap::displayWarning($this->l('Aucun résultat trouvé')); - // } + $results = DB::getInstance()->ExecuteS(' + SELECT dh.`id_customer`, dh.`date_add` as `date_generate`,od.`id_order`, dh.`code`, od.`value`, o.`total_paid_real`,o.`date_add` as `date_order` + FROM `'._DB_PREFIX_.'ant_discount_history` dh + LEFT JOIN `'._DB_PREFIX_.'order_discount` od ON (od.`id_discount` = dh.`id_discount`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = od.`id_order`) + WHERE 1 + '); + if($results) { + $row_definition = array( + 'id_customer' => 'Client ID', + 'id_order' => 'Commande ID', + 'name' => 'Bon de réduction', + 'value' => 'Valeur Bon', + 'total_paid_real' => 'Total Commande', + 'date_generate' => 'Date création du bon', + 'date_order' => 'Date Commande', + ); + header("Content-Type: text/csv; charset=UTF-8"); + header("Content-Disposition: attachment;filename=export-".date('dmYHi').".csv;"); + $this->exportCsv($results, $row_definition); + die(); + } else { + HelperFormBootstrap::displayWarning($this->l('Aucun résultat trouvé')); + } } }