View Single Post
  #1  
Old 03-25-2009, 02:58 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default BCSE Points - displaying in packing list

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
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote