I finally managed to do what I wanted. Info command + products.
Thanks to you.
Here is my code:
<?php
/**
* @package HikaShop for Joomla!
* @version 2.3.2
* @author hikashop.com
* @copyright (C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
while(ob_get_level() > 1)
ob_end_clean();
$config =& hikashop_config();
$format = $config->get('export_format','csv');
$separator = $config->get('csv_separator',';');
$force_quote = $config->get('csv_force_quote',1);
$export = hikashop_get('helper.spreadsheet');
$export->init($format, 'hikashop_export', $separator, $force_quote);
if(!empty($this->orders)){
$maxProd = 0;
$productFields = null;
foreach($this->orders as $order){
$nbProd = count($order->products);
if($maxProd < $nbProd){
$maxProd = $nbProd;
if(empty($productFields)){
$productFields = array('order_product_code','order_product_quantity');
}
}
}
if($maxProd && !empty($productFields)) {
$first = array();
$o = reset($this->orders);
foreach($o as $key => $val) {
if(is_array($val))
continue;
if(in_array($key,array('order_number','user_created','user_email','order_status','order_payment_method','order_full_price','order_discount_price','shipping_address_title','shipping_address_firstname','shipping_address_lastname','shipping_address_street','shipping_address_street2','shipping_address_post_code','shipping_address_post_code','shipping_address_city','shipping_address_telephone','shipping_address_state','shipping_address_country' )))
$first[] = $key;
}
$o = null;
for($i=1;$i<=$maxProd;$i++){
foreach($productFields as $field){
if(in_array($field,array('order_product_code','order_product_quantity')))
$first[] = 'item'.$i.'_'.$field;
}
}
} else {
$first = array_keys(get_object_vars(reset($this->orders)));
}
$export->writeLine($first);
foreach($this->orders as $row){
if(!empty($row->user_created)) $row->user_created = hikashop_getDate($row->user_created,'%Y-%m-%d %H:%M:%S');
if(!empty($row->order_created)) $row->order_created = hikashop_getDate($row->order_created,'%Y-%m-%d %H:%M:%S');
if(!empty($row->order_modified)) $row->order_modified = hikashop_getDate($row->order_modified,'%Y-%m-%d %H:%M:%S');
$new_row = array();
foreach ($row as $key => $value) {
if(in_array($key,array('order_number','user_created','user_email','order_status','order_payment_method','order_full_price','order_discount_price','shipping_address_title','shipping_address_firstname','shipping_address_lastname','shipping_address_street','shipping_address_street2','shipping_address_post_code','shipping_address_post_code','shipping_address_city','shipping_address_telephone','shipping_address_state','shipping_address_country' )))
$new_row[$key] = $value;
}
if($maxProd && !empty($productFields)){
for($i=1;$i<=$maxProd;$i++){
$prod =& $row->products[$i-1];
foreach($productFields as $field){
$n = 'item_'.$i.'_'.$field;
$new_row[$n] = @$prod->$field;
}
}
}
$export->writeLine($new_row);
}
}
$export->send();
exit;