I've used th epacking list mod on the forum to create a packing list/invoice combo. I'd like to put the customers current reward points total at the bottom.
I've edited history_order.php to add the following:
Code added:
Code:
$username=$order_data["userinfo"]["login"];
$agq="select sum(points) as total from points where login = '$username' and (expire >= '".time()."' or expire = '' or expire is null)";
$result=mysql_query($agq);
$points = mysql_fetch_row($result);
$smarty->assign("points", $points[0]);
In Place:
[code]
if ($orders) {
$orders_data = array();
foreach ($orders as $orderid) {
$order_data = func_order_data($orderid);
if (empty($order_data))
continue;
#
# Security check if order owned by another customer
#
if ($current_area == 'C' && $order_data["userinfo"]["login"] != $login) {
func_header_location("error_message.php?access_den ied&id=34");
}
$order = $order_data["order"];
$customer = $order_data["userinfo"];
$giftcerts = $order_data["giftcerts"];
$products = $order_data['products'];
$orders_data[] = array ("order" => $order, "customer" => $customer, "products" => $products, "giftcerts" => $giftcerts);
//Added below
$username=$order_data["userinfo"]["login"];
$agq="select sum(points) as total from points where login = '$username' and (expire >= '".time()."' or expire = '' or expire is null)";
$result=mysql_query($agq);
$points = mysql_fetch_row($result);
$smarty->assign("points", $points[0]);
}
I'm then using {$points} in the template. My problem is that it's pulling the value for the last customer only, and putting the same value in each invoice when i'm batch printing.
can anyone help?
tia