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

Exporting filtered order variables to CSV file
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 06-01-2005, 12:27 AM
 
zilker zilker is offline
 

Advanced Member
  
Join Date: Feb 2003
Posts: 89
 

Default Exporting filtered order variables to CSV file

Alright, here we go. You're searching for orders based on certain criteria such as sku # or price. Basically this mod serves the purpose of being able to provide a modified copy of filtered orders that have been backed up into a CSV file. I'll tell you what I'm using it for and maybe it will make sense.

The site I'm currently working on is http://www.ezcruiseconnection.com. They sell motor coach transportation services to and from cruise lines. They contract this service to a local motor coach company. This company requires certain information about the customers. This allows my client to supply their provider with only the information they need.

I've made changes to 4 files:

./include/orders.php
./include/orders_export.php
./include/process_orders.php
./skin1/main/orders_list.tpl

and created one file: ./skin1/main/orders_export_mod.tpl

./include/orders.php
changed:
Code:
$do_export = in_array($mode, array("export","export_found","export_all"));
to
Code:
$do_export = in_array($mode, array("export","export_found","export_all","export_mod"));


./include/orders_export.php
changed:
Code:
# # Prepare the orderid condition # if ($mode == "export") { # Passed here via include/process_order.php if (!empty($orderids) and is_array($orderids)) { $orderids = array_keys($orderids); } else { $top_message["content"] = func_get_langvar_by_name("msg_adm_warn_orders_sel"); func_header_location("orders.php?mode=search"); } } elseif ($mode == "export_found" && is_array($orders)) { # Passed here via include/orders.php $orderids = array(); foreach ($orders as $k=>$v) $orderids[] = $v["orderid"]; }
to
Code:
# # Prepare the orderid condition # if ($mode == "export") { # Passed here via include/process_order.php if (!empty($orderids) and is_array($orderids)) { $orderids = array_keys($orderids); } else { $top_message["content"] = func_get_langvar_by_name("msg_adm_warn_orders_sel"); func_header_location("orders.php?mode=search"); } } if ($mode == "export_mod") { # Passed here via include/process_order.php if (!empty($orderids) and is_array($orderids)) { $orderids = array_keys($orderids); } else { $top_message["content"] = func_get_langvar_by_name("msg_adm_warn_orders_sel"); func_header_location("orders.php?mode=search"); } } elseif ($mode == "export_found" && is_array($orders)) { # Passed here via include/orders.php $orderids = array(); foreach ($orders as $k=>$v) $orderids[] = $v["orderid"]; }
AND
Code:
$smarty->assign("orders", $orders_full); func_display("main/orders_export.tpl",$smarty);
to
Code:
if ($mode == "export_mod") { $smarty->assign("orders", $orders_full); func_display("main/orders_export_mod.tpl",$smarty); } else { $smarty->assign("orders", $orders_full); func_display("main/orders_export.tpl",$smarty); }


./include/process_orders.php
changed:
Code:
elseif ($mode == "export" and !empty($orderids)) { include $xcart_dir."/include/orders_export.php"; } elseif ($mode == "export_found") { include $xcart_dir."/include/orders.php"; }
to
Code:
elseif ($mode == "export" and !empty($orderids)) { include $xcart_dir."/include/orders_export.php"; } elseif ($mode == "export_mod" and !empty($orderids)) { include $xcart_dir."/include/orders_export.php"; } elseif ($mode == "export_found") { include $xcart_dir."/include/orders.php"; }


The file that I created, ./skin1/main/orders_export_mod.tpl, is basically a copy of ./skin1/main/orders_export.tpl with the unecessary variables taken out. It looks like this:
Code:
{* $Id: orders_export_AFC.tpl,v 1.10 2004/06/29 06:47:31 svowl Exp $ *} {section name=oid loop=$orders} {$orders[oid].productcode}{$delimiter}{$orders[oid].product}{$delimiter}{$orders[oid].product_options}{$delimiter}{$orders[oid].amount}{$delimiter}{$orders[oid].notes|replace:"\r":" "|replace:"\n":" "|replace:"\t":" "} {/section}

I'm sure there can be other uses involved for created reports, etc. Let me know what your thoughts if you decide to try it out.
__________________
~zilker

uummm...perhaps you should tell me again.

http://www.designertrends.com
Version 4.0.6
Unix
Reply With Quote
  #2  
Old 04-16-2006, 01:24 AM
 
bigmaggot bigmaggot is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 74
 

Default

Has anyone got this to work?

Or how does it work?
__________________
X-Cart Gold v4.1.11
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:32 PM.

   

 
X-Cart forums © 2001-2018