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.