function export() { global $toC_Json, $osC_Language; $type = strpos($_REQUEST['type'], 'customers') !== false ? 'customers' : 'products'; $param = array('type' => $type, 'csv_field_seperator' => $_REQUEST['seperator'], 'csv_field_enclosed' => $_REQUEST['enclosed'], 'file_type' => $_REQUEST['file_type'], 'compression_type' => $_REQUEST['compression']); $exporter = toC_Exporter::getExporter($param); $filename = $exporter->export(); if (file_exists($filename)) { header("Pragma: no-cache"); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: Application/octet-stream"); header('Content-Disposition: attachment; filename="' . $exporter->getFileName() . '"'); header("Content-Length: " . $exporter->getSize()); readfile($exporter->getTempFile()); $exporter->removeTempFile(); exit; } $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed')); echo $toC_Json->encode($response); }
function toC_Products_Exporter($parameters) { parent::toC_Exporter($parameters); $this->_products_column = array('products_id' => 'ID', 'products_type' => 'Type', 'products_quantity' => 'Quantity', 'products_moq' => 'Moq', 'products_max_order_quantity' => 'MaxQuantity', 'products_price' => 'Price', 'products_sku' => 'SKU', 'products_model' => 'Model', 'products_weight' => 'Weight', 'products_weight_class' => 'WeightClass', 'products_status' => 'Status', 'products_tax_class_id' => 'Tax', 'manufacturers_id' => 'Manufacturer', 'quantity_discount_groups_id' => 'QuantityDiscountGroup', 'quantity_unit_class' => 'UnitClass', 'order_increment' => 'OrderIncrement', 'products_attributes_groups_id' => 'ProductsAttributesGroup'); $this->_products_description_column = array('products_name' => 'ProductsName', 'products_short_description' => 'ProductsShortDescription', 'products_description' => 'ProductsDescription', 'products_keyword' => 'ProductsKeyword', 'products_tags' => 'ProductsTags', 'products_url' => 'ProductsUrl', 'products_friendly_url' => 'ProductsFriendlyUrl', 'products_page_title' => 'ProductsPageTitle', 'products_meta_keywords' => 'ProductsMetaKeywords', 'products_meta_description' => 'ProductsMetaDescription'); $this->_products_images_column = array('id' => 'ImagesID', 'image' => 'ImageName', 'sort_order' => 'SortOrder', 'default_flag' => 'DefaultFlag'); $this->_products = $this->renderData(); }