View Single Post
  #7  
Old 10-13-2008, 06:54 PM
 
qinwubi qinwubi is offline
 

Member
  
Join Date: Jul 2006
Posts: 16
 

Post Re: Customizing orders export excel format

I find the default code in import_order_items.php is wrong.

[code]
1. in import_order_items.php:
"option_value" => array(
"array" => true),
should be instead:
"product_class_option" => array(
"array" => true)
if you want to export the human readable product options in order details.

2. if you want to get data from order_details, do the following:
find
if ($single_mode || AREA_TYPE == 'A') {
$row = func_query_first("SELECT * FROM $sql_tbl[order_details] WHERE itemid = '$id'");
} else {
$row = func_query_first("SELECT * FROM $sql_tbl[order_details] WHERE itemid = '$id' AND $sql_tbl[order_details].provider = '$login'");
}


replace with
if ($single_mode || AREA_TYPE == 'A') {
$row = func_query_first("SELECT * FROM $sql_tbl[order_details] WHERE itemid = '$id'");
$myorderid = $row['orderid'];
$row2 = func_query_first("SELECT * FROM $sql_tbl[orders] WHERE orderid = '$myorderid'");
} else {
$row = func_query_first("SELECT * FROM $sql_tbl[order_details] WHERE itemid = '$id' AND $sql_tbl[order_details].provider = '$login'");
$myorderid = $row['orderid'];
$row2 = func_query_first("SELECT $sql_tbl[orders].* FROM $sql_tbl[orders], $sql_tbl[order_details] WHERE $sql_tbl[orders].orderid = '$id' AND $sql_tbl[orders].orderid = $sql_tbl[order_details].orderid AND $sql_tbl[order_details].provider = '$login'");
}
[code]

And if you want to add or eliminate more export fields, just add or delete more elements in $import_specification['ORDER_ITEMS'].

At the end, I'm not a program guy. So my code may look a little junky. But it did what I want to achieve. Hopefully it helps those with the same concern.

Many thanks to Victor.
__________________
all the best,
Wubi
:::::::::
xcart gold v4.3.2 with lots of customizations
Linux
Php 5.2.4
MySQL: 4.1.22-standard
Reply With Quote