Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Customizing orders export excel format

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-23-2008, 11:47 PM
 
qinwubi qinwubi is offline
 

Member
  
Join Date: Jul 2006
Posts: 16
 

Red face Customizing orders export excel format

Hi there,

Really need some help here.

What I'm trying to do is to change the output format looks of the orders export excel csv file. But after hours of struggle, I'm unable to figure out which files to go after. It was supposed to be skin1/main/orders_export.tpl, but it doesn't seem to work for me, as whatever changes I made to it, there's absolutely No effect on the output. Actually I tried to detete this file, and the export still worked the same way.

There must be something wrong here. But I'm just not sure. Not smart enough to be a programmer....

Please please any advice would be greatly appreciated!
__________________
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
  #2  
Old 09-24-2008, 05:54 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Customizing orders export excel format

Please describe what kind of changes you need for export
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #3  
Old 09-25-2008, 06:17 PM
 
qinwubi qinwubi is offline
 

Member
  
Join Date: Jul 2006
Posts: 16
 

Default Re: Customizing orders export excel format

Ok, here's what I want to achieve:

currently I'm having the built in default export scripts, which output these fields:
!ORDERID !ITEMID !PRODUCTID !PRODUCTCODE !PRODUCT !PRICE !AMOUNT !PROVIDER !OPTION_CLASS !OPTION_VALUE !EXTRA_DATA

I don't want some of these field, for example, the EXTRA_DATA field. At the same time, I want to add a few more fields, for example PRODUCT_OPTIONS (which is actually the human readable version of EXTRA_DATA if I'm right.

Any advice would be appreciated Victor. Thanks in advance.
__________________
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
  #4  
Old 09-26-2008, 02:33 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Customizing orders export excel format

There is no template to do so.
You should edit include/import_orders.php

Extra data is a serialized representation of product options.

find following lines
PHP Code:
# Export extra fields
            
$ef func_query("SELECT khash, value FROM $sql_tbl[order_extras] WHERE orderid = '$id'");
            if (!empty(
$ef)) {
                foreach (
$ef as $v) {
                    
$row['extra_field'][] = $v['khash'];
                    
$row['extra_value'][] = $v['value'];
                }
            }
            unset(
$ef); 
and comment it like this
PHP Code:
# Export extra fields
/*            $ef = func_query("SELECT khash, value FROM $sql_tbl[order_extras] WHERE orderid = '$id'");
            if (!empty($ef)) {
                foreach ($ef as $v) {
                    $row['extra_field'][] = $v['khash'];
                    $row['extra_value'][] = $v['value'];
                }
            }
            unset($ef); */ 
to disable extra data export




To change extra data export format you need not to comment but modify the lines above. It can be done like this
PHP Code:
# Export extra fields
  
$ef func_query("SELECT khash, value FROM $sql_tbl[order_extras] WHERE orderid = '$id'");
            if (!empty(
$ef)) {
                foreach (
$ef as $v) {
                    
$row['extra_field'] .= $v['khash'].':'.$v['value'].' ';
}
            }
            unset(
$ef); 



But it is necessary to disable serialization of this array
change the lines above in the same file
PHP Code:
"extra_field"            => array(
                
"array"        => true), 
to
PHP Code:
"extra_field"            => array(  ), 
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #5  
Old 09-29-2008, 06:29 AM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default Re: Customizing orders export excel format

Hey Victor,

What if I needed to add a custom column to exporting orders for Worldship? I specifically need to add a column with the value 'shipper' and the header 'Billing shipping charges to' so that I can properly map all the required fields in Worldship.
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
  #6  
Old 10-06-2008, 12:35 AM
 
qinwubi qinwubi is offline
 

Member
  
Join Date: Jul 2006
Posts: 16
 

Default Re: Customizing orders export excel format

Victor,

Great! You're the man! I'll implement it and post the results for others having the same concerns.
__________________
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
  #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
  #8  
Old 04-21-2009, 01:36 AM
 
dolaghan dolaghan is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 51
 

Default Re: Customizing orders export excel format

would anyone be able to give me any pointers on this to export my products so it just lists the sku and the wholesale price?
__________________
Now on X-Cart version 4.1.8
Reply With Quote
  #9  
Old 07-02-2012, 08:09 AM
 
dmpinder dmpinder is offline
 

Advanced Member
  
Join Date: Jun 2009
Posts: 86
 

Default Re: Customizing orders export excel format

I'm not sure if this helps in this particular situation but I've done something similar with adding a date of purchase column and category of product purchased: http://forum.x-cart.com/showthread.php?t=64163&highlight=order_items
__________________
Darren

X-Cart Gold 4.3.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:25 AM.

   

 
X-Cart forums © 2001-2020