Code:
function query($order_id) {
global $db;
$order_id = zen_db_prepare_input($order_id);
$this->queryReturnFlag = NULL;
$this->notify('NOTIFY_ORDER_BEFORE_QUERY', array(), $order_id);
if ($this->queryReturnFlag === TRUE) return;
$order_query = "select customers_id, customers_name, customers_company,
customers_street_address, customers_suburb, customers_city,
customers_postcode, customers_state, customers_country,
customers_telephone, customers_email_address, customers_address_format_id,
delivery_name, delivery_company, delivery_street_address, delivery_suburb,
delivery_city, delivery_postcode, delivery_state, delivery_country,
delivery_address_format_id, billing_name, billing_company,
billing_street_address, billing_suburb, billing_city, billing_postcode,
billing_state, billing_country, billing_address_format_id,
payment_method, payment_module_code, shipping_method, shipping_module_code,
coupon_code, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value,
date_purchased, orders_status, last_modified, order_total, order_tax, ip_address
from " . TABLE_ORDERS . "
where orders_id = '" . (int)$order_id . "'";
$order = $db->Execute($order_query);
//-bof-edit_orders-lat9 *** 1 of 2 ***
$totals_query = "select title, text, class, value
from " . TABLE_ORDERS_TOTAL . "
where orders_id = '" . (int)$order_id . "'
order by sort_order";
//-eof-edit_orders-lat9 *** 1 of 2 ***
$totals = $db->Execute($totals_query);
while (!$totals->EOF) {
if ($totals->fields['class'] == 'ot_coupon') {
$coupon_link_query = "SELECT coupon_id
from " . TABLE_COUPONS . "
where coupon_code ='" . $order->fields['coupon_code'] . "'";
$coupon_link = $db->Execute($coupon_link_query);
$zc_coupon_link = '<a href="javascript:couponpopupWindow(\'' . zen_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $coupon_link->fields['coupon_id']) . '\')">';
}
$this->totals[] = array('title' => ($totals->fields['class'] == 'ot_coupon' ? $zc_coupon_link . $totals->fields['title'] . '</a>' : $totals->fields['title']),
'text' => $totals->fields['text'],
//-bof-edit_orders-lat9 *** 2 of 2 ***
'class' => $totals->fields['class'],
'value' => $totals->fields['value']);
//-eof-edit_orders-lat9 *** 2 of 2 ***
$totals->MoveNext();
}
Bookmarks