Hi sorry for confused message at the top..
what i tried to do is...
in order > click on the ID to go to the details >
there is a "print invoice" button.
I actually made 2 print invoice buttons there.
One with CC and one without CC in it.
So... i then cut the 'label' section out for now as i can't make it 3 statements like eg. if not A go B if not B go C etc.
i stucked with 2 statement (if not A go B if not B toughluck.... )
Here the current file (include/history_order.php):
Code:
<?php
/*****************************************************************************\
#
# $Id: history_order.php,v 1.22.2.5 2004/11/01 11:41:13 svowl Exp $
#
# Collect infos about ordered products
#
if ( !defined('XCART_SESSION_START') ) { header("Location: ../"); die("Access denied"); }
if (empty($mode)) $mode = "";
if ($mode == "invoice" or $mode == "invoice_no_cc" or $mode == "label") {
header("Content-Type: text/html");
header("Content-Disposition: inline; filename=invoice.txt");
$orders = explode(",", $orderid);
if ($orders) {
$orders_data = array();
foreach ($orders as $orderid) {
$order_data = func_order_data($orderid);
#
# Security check if order owned by another customer
#
if ($current_area == 'C' && $order_data["userinfo"]["login"] != $login) {
func_header_location("error_message.php?access_denied&id=34");
}
$order = $order_data["order"];
$customer = $order_data["userinfo"];
$products = func_translate_products($order_data["products"], ($userinfo['language']?$userinfo['language']:$config['default_customer_language']));
$giftcerts = $order_data["giftcerts"];
$orders_data[] = array ("order" => $order, "customer" => $customer, "products" => $products, "giftcerts" => $giftcerts);
}
$smarty->assign("orders_data", $orders_data);
$_tmp_smarty_debug = $smarty->debugging;
$smarty->debugging = false;
if ($mode == "invoice") {
if ($current_area == "A" || ($current_area == "P" && !empty($active_modules["Simple_Mode"])))
$smarty->assign("show_order_details", "Y");
func_display("main/order_invoice_print.tpl",$smarty);
} elseif ($mode == "invoice_no_cc")
func_display("main/order_invoice_no_cc_print.tpl",$smarty);
$smarty->debugging = $_tmp_smarty_debug;
}
exit;
} else {
$order_data = func_order_data($orderid);
#
# Security check if order owned by another customer
#
if ($current_area == 'C' && $order_data["userinfo"]["login"] != $login) {
func_header_location("error_message.php?access_denied&id=35");
}
$smarty->assign("order", $order_data["order"]);
$smarty->assign("customer", $order_data["userinfo"]);
$order_data["products"] = func_translate_products($order_data["products"], ($order_data["userinfo"]['language']?$order_data["userinfo"]['language']:$config['default_customer_language']));
$smarty->assign("products", $order_data["products"]);
$smarty->assign("giftcerts", $order_data["giftcerts"]);
if ($order_data) {
$owner_condition = "";
if ($current_area == "C")
$owner_condition = " AND $sql_tbl[orders].login='".$login."'";
elseif ($current_area == "P" && !$single_mode ) {
$owner_condition = " AND $sql_tbl[order_details].provider='".$login."'";
}
# find next
$tmp = func_query_first("SELECT $sql_tbl[orders].orderid FROM $sql_tbl[orders], $sql_tbl[order_details] WHERE $sql_tbl[orders].orderid>'".$orderid."' AND $sql_tbl[order_details].orderid=$sql_tbl[orders].orderid $owner_condition ORDER BY $sql_tbl[orders].orderid ASC LIMIT 1");
if (!empty($tmp["orderid"]))
$smarty->assign("orderid_next", $tmp["orderid"]);
# find prev
$tmp = func_query_first("SELECT $sql_tbl[orders].orderid FROM $sql_tbl[orders], $sql_tbl[order_details] WHERE $sql_tbl[orders].orderid<'".$orderid."' AND $sql_tbl[order_details].orderid=$sql_tbl[orders].orderid $owner_condition ORDER BY $sql_tbl[orders].orderid DESC LIMIT 1");
if (!empty($tmp["orderid"]))
$smarty->assign("orderid_prev", $tmp["orderid"]);
}
}
$location[] = array(func_get_langvar_by_name("lbl_orders_management"), "orders.php");
$location[] = array(func_get_langvar_by_name("lbl_order_details_label"), "");
if(!empty($active_modules['RMA'])) {
include $xcart_dir."/modules/RMA/add_returns.php";
}
if(!empty($active_modules['Anti_Fraud'])) {
include $xcart_dir."/modules/Anti_Fraud/order.php";
}
?>
The original file is:
Code:
<?php
/*****************************************************************************\
\*****************************************************************************/
#
# $Id: history_order.php,v 1.22.2.5 2004/11/01 11:41:13 svowl Exp $
#
# Collect infos about ordered products
#
if ( !defined('XCART_SESSION_START') ) { header("Location: ../"); die("Access denied"); }
if (empty($mode)) $mode = "";
if ($mode == "invoice" or $mode == "invoice_no_cc" or $mode == "label") {
header("Content-Type: text/html");
header("Content-Disposition: inline; filename=invoice.txt");
$orders = explode(",", $orderid);
if ($orders) {
$orders_data = array();
foreach ($orders as $orderid) {
$order_data = func_order_data($orderid);
#
# Security check if order owned by another customer
#
if ($current_area == 'C' && $order_data["userinfo"]["login"] != $login) {
func_header_location("error_message.php?access_denied&id=34");
}
$order = $order_data["order"];
$customer = $order_data["userinfo"];
$products = func_translate_products($order_data["products"], ($userinfo['language']?$userinfo['language']:$config['default_customer_language']));
$giftcerts = $order_data["giftcerts"];
$orders_data[] = array ("order" => $order, "customer" => $customer, "products" => $products, "giftcerts" => $giftcerts);
}
$smarty->assign("orders_data", $orders_data);
$_tmp_smarty_debug = $smarty->debugging;
$smarty->debugging = false;
if ($mode == "invoice") {
if ($current_area == "A" || ($current_area == "P" && !empty($active_modules["Simple_Mode"])))
$smarty->assign("show_order_details", "Y");
func_display("main/order_invoice_print.tpl",$smarty);
} elseif ($mode == "label")
func_display("main/order_labels_print.tpl",$smarty);
$smarty->debugging = $_tmp_smarty_debug;
}
exit;
} else {
$order_data = func_order_data($orderid);
#
# Security check if order owned by another customer
#
if ($current_area == 'C' && $order_data["userinfo"]["login"] != $login) {
func_header_location("error_message.php?access_denied&id=35");
}
$smarty->assign("order", $order_data["order"]);
$smarty->assign("customer", $order_data["userinfo"]);
$order_data["products"] = func_translate_products($order_data["products"], ($order_data["userinfo"]['language']?$order_data["userinfo"]['language']:$config['default_customer_language']));
$smarty->assign("products", $order_data["products"]);
$smarty->assign("giftcerts", $order_data["giftcerts"]);
if ($order_data) {
$owner_condition = "";
if ($current_area == "C")
$owner_condition = " AND $sql_tbl[orders].login='".$login."'";
elseif ($current_area == "P" && !$single_mode ) {
$owner_condition = " AND $sql_tbl[order_details].provider='".$login."'";
}
# find next
$tmp = func_query_first("SELECT $sql_tbl[orders].orderid FROM $sql_tbl[orders], $sql_tbl[order_details] WHERE $sql_tbl[orders].orderid>'".$orderid."' AND $sql_tbl[order_details].orderid=$sql_tbl[orders].orderid $owner_condition ORDER BY $sql_tbl[orders].orderid ASC LIMIT 1");
if (!empty($tmp["orderid"]))
$smarty->assign("orderid_next", $tmp["orderid"]);
# find prev
$tmp = func_query_first("SELECT $sql_tbl[orders].orderid FROM $sql_tbl[orders], $sql_tbl[order_details] WHERE $sql_tbl[orders].orderid<'".$orderid."' AND $sql_tbl[order_details].orderid=$sql_tbl[orders].orderid $owner_condition ORDER BY $sql_tbl[orders].orderid DESC LIMIT 1");
if (!empty($tmp["orderid"]))
$smarty->assign("orderid_prev", $tmp["orderid"]);
}
}
$location[] = array(func_get_langvar_by_name("lbl_orders_management"), "orders.php");
$location[] = array(func_get_langvar_by_name("lbl_order_details_label"), "");
if(!empty($active_modules['RMA'])) {
include $xcart_dir."/modules/RMA/add_returns.php";
}
if(!empty($active_modules['Anti_Fraud'])) {
include $xcart_dir."/modules/Anti_Fraud/order.php";
}
?>
The different between the two are:
- added
Code:
} elseif ($mode == "invoice_no_cc")
func_display("main/order_invoice_no_cc_print.tpl",$smarty)
- delete
Code:
} elseif ($mode == "label")
func_display("main/order_labels_print.tpl",$smarty);
because i don't know how to have 3 statements (eg. if, elseif, else)
Can someone tell me how to put these 3 statements together?
Code:
if ($mode == "invoice") {
if ($current_area == "A" || ($current_area == "P" && !empty($active_modules["Simple_Mode"])))
$smarty->assign("show_order_details", "Y");
func_display("main/order_invoice_print.tpl",$smarty);
} elseif ($mode == "label")
func_display("main/order_labels_print.tpl",$smarty);
} elseif ($mode == "invoice_no_cc")
func_display("main/order_invoice_no_cc_print.tpl",$smarty);