ExecuteS(' SELECT `id_sale` FROM `'._DB_PREFIX_.'privatesale` WHERE `date_start` < "'.pSQL($argv[1]).' 00:00:00" ') as $row) { $sale = new Sale($row['id_sale']); $e = new CronExport('privatesales', array( 'headers' => array( 'id_sale', 'sale_title', 'id_order', 'id_customer', 'gender', 'email', 'firstname', 'lastname', 'shipping_firstname', 'shipping_lastname', 'shipping_street', 'shipping_street2', 'shipping_postcode', 'shipping_city', 'shipping_phone', 'shipping_phone_mobile', 'other_info', 'shipping_country', 'id_product', 'id_product_attribute', 'order_product_name', 'product_quantity', 'product_price_base_wo_taxes', 'tax_rate', 'product_name', 'product_combination', 'product_price_wo_taxes', 'product_price', 'wholesale_price', 'combination_wholesale_price', 'supplier_reference', 'quantity_refunded', 'quantity_returned', 'total_shipping', 'single', 'date', 'invoice_number', 'payment_type', 'order_state', 'version', ), 'postfix' => '_'.$id_sale.'_manual_accepted', 'dest_path' => '/../extracts/sales', 'params' => array( 'sale' => $sale, 'date_start' => date('Y-m-d 00:00:00', strtotime($argv[1].' 00:00:00') - 60*86400), 'date_end' => date('Y-m-d 23:59:59', strtotime($argv[1].' 00:00:00') - 1), ), )); $e->run(); $export = fopen($e->filename, 'r'); fgets($export); while(!feof($export)) { fwrite($file, fgets($export)); } fclose($export); unlink($e->filename); } fclose($file);