From f66dd43c5556e5e6856a6bffaeb9dbcf6dc24f6c Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 29 Jul 2014 13:43:17 +0200 Subject: [PATCH] Begin OrderExport nouveau fichier: core/lib/Thelia/ImportExport/Export/Type/OrderExport.php --- .../ImportExport/Export/Type/OrderExport.php | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 core/lib/Thelia/ImportExport/Export/Type/OrderExport.php diff --git a/core/lib/Thelia/ImportExport/Export/Type/OrderExport.php b/core/lib/Thelia/ImportExport/Export/Type/OrderExport.php new file mode 100644 index 000000000..3df6562f1 --- /dev/null +++ b/core/lib/Thelia/ImportExport/Export/Type/OrderExport.php @@ -0,0 +1,123 @@ + + */ +class OrderExport extends ExportHandler +{ + /** + * @return string|array + * + * Define all the type of formatters that this can handle + * return a string if it handle a single type ( specific exports ), + * or an array if multiple. + * + * Thelia types are defined in \Thelia\Core\FileFormat\FormatType + * + * example: + * return array( + * FormatType::TABLE, + * FormatType::UNBOUNDED, + * ); + */ + public function getHandledTypes() + { + return array( + FormatType::TABLE, + FormatType::UNBOUNDED, + ); + } + + /** + * @param Lang $lang + * @return ModelCriteria|array|BaseLoop + */ + public function buildDataSet(Lang $lang) + { + $query = OrderQuery::create() + ->useOrderAddressRelatedByDeliveryOrderAddressIdQuery() + ->addAsColumn("delivery_address_TITLE", OrderAddressTableMap::TI) + ->addAsColumn("delivery_address_COMPANY", OrderAddressTableMap::COMPANY) + ->addAsColumn("delivery_address_FIRSTNAME", OrderAddressTableMap::FIRSTNAME) + ->addAsColumn("delivery_address_LASTNAME", OrderAddressTableMap::LASTNAME) + ->addAsColumn("delivery_address_ADDRESS1", OrderAddressTableMap::ADDRESS1) + ->addAsColumn("delivery_address_ADDRESS2", OrderAddressTableMap::ADDRESS2) + ->addAsColumn("delivery_address_ADDRESS3", OrderAddressTableMap::ADDRESS3) + ->addAsColumn("delivery_address_ZIPCODE", OrderAddressTableMap::ZIPCODE) + ->addAsColumn("delivery_address_CITY", OrderAddressTableMap::CITY) + ->addAsColumn("delivery_address_country_TITLE", OrderAddressTableMap::TITLE) + ->addAsColumn("delivery_address_PHONE", OrderAddressTableMap::PHONE) + ->endUse() + ->useOrderStatusQuery() + ->useOrderStatusI18nQuery() + ->addAsColumn("order_status_TITLE", OrderStatusI18nTableMap::TITLE) + ->endUse() + ->endUse() + ->select([ + OrderTableMap::REF, + "customer_REF", + "product_TITLE", + "product_PRICE", + "tax_TITLE", + // PRODUCT_TTC_PRICE + "product_QUANTITY", + // ORDER_TOTAL_TTC + OrderTableMap::DISCOUNT, + "coupon_COUPONS", + // TOTAL_WITH_DISCOUNT + OrderTableMap::POSTAGE, + // total ttc +postage + "payment_module_TITLE", + OrderTableMap::INVOICE_REF, + "delivery_module_TITLE", + "delivery_address_TITLE", + "delivery_address_COMPANY", + "delivery_address_FIRSTNAME", + "delivery_address_LASTNAME", + "delivery_address_ADDRESS1", + "delivery_address_ADDRESS2", + "delivery_address_ADDRESS3", + "delivery_address_ZIPCODE", + "delivery_address_CITY", + "delivery_address_country_TITLE", + "delivery_address_PHONE", + "invoice_address_TITLE", + "invoice_address_COMPANY", + "invoice_address_FIRSTNAME", + "invoice_address_LASTNAME", + "invoice_address_ADDRESS1", + "invoice_address_ADDRESS2", + "invoice_address_ADDRESS3", + "invoice_address_ZIPCODE", + "invoice_address_CITY", + "invoice_address_country_TITLE", + "invoice_address_PHONE", + "order_status_TITLE" + ]) + ; + } + +} \ No newline at end of file