View Single Post
  #7  
Old 11-13-2003, 02:06 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

Close, but no cigar. I tried several variations of that and still no data. What I would really like is an understanding of what is happening programmatically when you pull up the order details in the admin. I see a trail of the following relevant php files:
func.php - used to get the $userdata - it looks like it pulls the entire customers table into $userdata:
Code:
# # Get information associated with user # function func_userinfo($user,$usertype) { global $sql_tbl; $userinfo = func_query_first("SELECT $sql_tbl[customers].*, $sql_tbl[countries].country FROM $sql_tbl[customers], $sql_tbl[countries] WHERE $sql_tbl[customers].login='$user' AND $sql_tbl[customers].usertype='$usertype' AND $sql_tbl[countries].code=$sql_tbl[customers].b_country"); $userinfo["passwd1"] = stripslashes(text_decrypt($userinfo["password"])); $userinfo["passwd2"] = stripslashes(text_decrypt($userinfo["password"])); $userinfo["password"] = stripslashes(text_decrypt($userinfo["password"])); $userinfo["card_number"] = text_decrypt($userinfo["card_number"]); $userinfo["b_statename"] = func_get_state($userinfo["b_state"]); $userinfo["b_countryname"] = func_get_country($userinfo["b_country"]); $userinfo["s_statename"] = func_get_state($userinfo["s_state"]); $userinfo["s_countryname"] = func_get_country($userinfo["s_country"]); $email = $userinfo["email"]; if(func_query_first("SELECT email FROM $sql_tbl[maillist] WHERE email='$email'")) $userinfo["newsletter"]="Y"; return $userinfo; }

Then history_order.php:
Code:
# # $Id: history_order.php,v 1.9 2002/11/14 07:58:19 zorg Exp $ # # Collect infos about ordered products # if ($mode == "invoice" or $mode == "label") { header("Content-Type: text/plain"); 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); $order = $order_data["order"]; $customer = $order_data["userinfo"]; $products = $order_data["products"]; $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") $smarty->display("main/order_invoice_print.tpl"); elseif ($mode == "label") $smarty->display("main/order_labels_print.tpl"); $smarty->debugging = $_tmp_smarty_debug; } exit; } else { $order_data = func_order_data($orderid); $smarty->assign("order", $order_data["order"]); $smarty->assign("customer", $order_data["userinfo"]); $smarty->assign("products", $order_data["products"]); $smarty->assign("giftcerts", $order_data["giftcerts"]); }
And the php file called up: order.php
Code:
# # $Id: order.php,v 1.19 2002/12/10 08:57:10 sdg Exp $ # require "../smarty.php"; require "../config.php"; require "./auth.php"; require "../include/security.php"; # # Collect infos about ordered products # require "../include/history_order.php"; $order = $order_data["order"]; $userinfo = $order_data["userinfo"]; $products = $order_data["products"]; $giftcerts = $order_data["giftcerts"]; if ($mode == "status_change") { # Update order # func_change_order_status($orderid, $status); db_query("update $sql_tbl[orders] set tracking='$tracking', notes='$notes', details='".text_crypt($details)."' where orderid='$orderid'"); header("Location: order.php?orderid=$orderid&mode=status_changed"); exit; } # # Delete order # if ($mode=="delete") { db_query("DELETE FROM $sql_tbl[orders] WHERE orderid='$orderid'"); db_query("DELETE FROM $sql_tbl[order_details] WHERE orderid='$orderid'"); db_query("DELETE FROM $sql_tbl[giftcerts] WHERE orderid='$orderid'"); db_query("DELETE FROM $sql_tbl[partner_payment] WHERE orderid='$orderid'"); db_query("DELETE FROM $sql_tbl[subscription_customers] WHERE orderid='$orderid'"); header("Location: orders.php?".$query_string); exit; } $smarty->assign("main","history_order"); @include "../modules/gold_display.php"; $smarty->display("admin/home.tpl"); ?>
Then the history_order.tpl file has this in it (excerpt of 3 of the fields to be displayed):
Code:
<tr> <td valign="top">{$lng.lbl_fax}</td> <td valign="top">{$customer.fax}</td> </tr> <tr> <td valign="top">{$lng.lbl_email}</td> <td valign="top">{$customer.email}</td> </tr> <tr> <td valign="top">{$lng.lbl_how_heard}</td> <td valign="top">{$customer.hear}</td> </tr>

To reiterate: xcart_customers.hear is the field in the customers table I need to show. It has data in it. The variables $customer.fax and $customer.email show up fine and it looks like they are just pulled from the userdata array in func.php from the SQL query that pulls all fields from the table and assigned through this (I think) in the history_order.php file:
Code:
$smarty->assign("customer", $order_data["userinfo"]);
WHAT IS MISSING?
__________________
-Ken
X-Cart User / Developer Since April 2003
(Varying versions, multiple client sites, 3.x through 4.4.x)
www.pointbweb.com
Reply With Quote