📄 order.php
字号:
$this->billing = array('firstname' => $billing_address->fields['entry_firstname'],
'lastname' => $billing_address->fields['entry_lastname'],
'company' => $billing_address->fields['entry_company'],
'street_address' => $billing_address->fields['entry_street_address'],
'suburb' => $billing_address->fields['entry_suburb'],
'city' => $billing_address->fields['entry_city'],
'postcode' => $billing_address->fields['entry_postcode'],
'state' => ((zen_not_null($billing_address->fields['entry_state'])) ? $billing_address->fields['entry_state'] : $billing_address->fields['zone_name']),
'zone_id' => $billing_address->fields['entry_zone_id'],
'country' => array('id' => $billing_address->fields['countries_id'], 'title' => $billing_address->fields['countries_name'], 'iso_code_2' => $billing_address->fields['countries_iso_code_2'], 'iso_code_3' => $billing_address->fields['countries_iso_code_3']),
'country_id' => $billing_address->fields['entry_country_id'],
'format_id' => (int)$billing_address->fields['address_format_id']);
$index = 0;
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if (($i/2) == floor($i/2)) {
$rowClass="rowEven";
} else {
$rowClass="rowOdd";
}
$this->products[$index] = array('qty' => $products[$i]['quantity'],
'name' => $products[$i]['name'],
'model' => $products[$i]['model'],
'tax' => zen_get_tax_rate($products[$i]['tax_class_id'], $tax_address->fields['entry_country_id'], $tax_address->fields['entry_zone_id']),
'tax_description' => zen_get_tax_description($products[$i]['tax_class_id'], $tax_address->fields['entry_country_id'], $tax_address->fields['entry_zone_id']),
'price' => $products[$i]['price'],
'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']),
'onetime_charges' => $_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity']),
'weight' => $products[$i]['weight'],
'products_priced_by_attribute' => $products[$i]['products_priced_by_attribute'],
'product_is_free' => $products[$i]['product_is_free'],
'products_discount_type' => $products[$i]['products_discount_type'],
'products_discount_type_from' => $products[$i]['products_discount_type_from'],
'id' => $products[$i]['id'],
'rowClass' => $rowClass);
if ($products[$i]['attributes']) {
$subindex = 0;
reset($products[$i]['attributes']);
while (list($option, $value) = each($products[$i]['attributes'])) {
/*
//clr 030714 Determine if attribute is a text attribute and change products array if it is.
if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID){
$attr_value = $products[$i]['attributes_values'][$option];
} else {
$attr_value = $attributes->fields['products_options_values_name'];
}
*/
$attributes_query = "select popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix
from " . TABLE_PRODUCTS_OPTIONS . " popt,
" . TABLE_PRODUCTS_OPTIONS_VALUES . " poval,
" . TABLE_PRODUCTS_ATTRIBUTES . " pa
where pa.products_id = '" . (int)$products[$i]['id'] . "'
and pa.options_id = '" . (int)$option . "'
and pa.options_id = popt.products_options_id
and pa.options_values_id = '" . (int)$value . "'
and pa.options_values_id = poval.products_options_values_id
and popt.language_id = '" . (int)$_SESSION['languages_id'] . "'
and poval.language_id = '" . (int)$_SESSION['languages_id'] . "'";
$attributes = $db->Execute($attributes_query);
//clr 030714 Determine if attribute is a text attribute and change products array if it is.
if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID){
$attr_value = $products[$i]['attributes_values'][$option];
} else {
$attr_value = $attributes->fields['products_options_values_name'];
}
$this->products[$index]['attributes'][$subindex] = array('option' => $attributes->fields['products_options_name'],
'value' => $attr_value,
'option_id' => $option,
'value_id' => $value,
'prefix' => $attributes->fields['price_prefix'],
'price' => $attributes->fields['options_values_price']);
$subindex++;
}
}
// add onetime charges here
//$_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity'])
/*********************************************
* Calculate taxes for this product
*********************************************/
$shown_price = (zen_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'])
+ zen_add_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']);
$this->info['subtotal'] += $shown_price;
// find product's tax rate and description
$products_tax = $this->products[$index]['tax'];
$products_tax_description = $this->products[$index]['tax_description'];
if (DISPLAY_PRICE_WITH_TAX == 'true') {
// calculate the amount of tax "inc"luded in price (used if tax-in pricing is enabled)
$tax_add = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
} else {
// calculate the amount of tax for this product (assuming tax is NOT included in the price)
$tax_add = zen_round(($products_tax / 100) * $shown_price, $currencies->currencies[$this->info['currency']]['decimal_places']);
}
$this->info['tax'] += $tax_add;
if (isset($this->info['tax_groups'][$products_tax_description])) {
$this->info['tax_groups'][$products_tax_description] += $tax_add;
} else {
$this->info['tax_groups'][$products_tax_description] = $tax_add;
}
/*********************************************
* END: Calculate taxes for this product
*********************************************/
$index++;
}
// Update the final total to include tax if not already tax-inc
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
} else {
$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
}
/*
// moved to function create
if ($this->info['total'] == 0) {
if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
$this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
} else {
$this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
}
}
*/
if (isset($GLOBALS[$class]) && is_object($GLOBALS[$class])) {
if ( isset($GLOBALS[$class]->order_status) && is_numeric($GLOBALS[$class]->order_status) && ($GLOBALS[$class]->order_status > 0) ) {
$this->info['order_status'] = $GLOBALS[$class]->order_status;
}
}
}
function create($zf_ot_modules, $zf_mode = 2) {
global $db, $zco_notifier;
if ($this->info['total'] == 0) {
if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
$this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
} else {
if ($_SESSION['payment'] != 'freecharger') {
$this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
}
}
}
if ($_SESSION['shipping'] == 'free_free') {
$this->info['shipping_module_code'] = $_SESSION['shipping'];
}
$sql_data_array = array('customers_id' => $_SESSION['customer_id'],
'customers_name' => $this->customer['firstname'] . ' ' . $this->customer['lastname'],
'customers_company' => $this->customer['company'],
'customers_street_address' => $this->customer['street_address'],
'customers_suburb' => $this->customer['suburb'],
'customers_city' => $this->customer['city'],
'customers_postcode' => $this->customer['postcode'],
'customers_state' => $this->customer['state'],
'customers_country' => $this->customer['country']['title'],
'customers_telephone' => $this->customer['telephone'],
'customers_email_address' => $this->customer['email_address'],
'customers_address_format_id' => $this->customer['format_id'],
'delivery_name' => $this->delivery['firstname'] . ' ' . $this->delivery['lastname'],
'delivery_company' => $this->delivery['company'],
'delivery_street_address' => $this->delivery['street_address'],
'delivery_suburb' => $this->delivery['suburb'],
'delivery_city' => $this->delivery['city'],
'delivery_postcode' => $this->delivery['postcode'],
'delivery_state' => $this->delivery['state'],
'delivery_country' => $this->delivery['country']['title'],
'delivery_address_format_id' => $this->delivery['format_id'],
'billing_name' => $this->billing['firstname'] . ' ' . $this->billing['lastname'],
'billing_company' => $this->billing['company'],
'billing_street_address' => $this->billing['street_address'],
'billing_suburb' => $this->billing['suburb'],
'billing_city' => $this->billing['city'],
'billing_postcode' => $this->billing['postcode'],
'billing_state' => $this->billing['state'],
'billing_country' => $this->billing['country']['title'],
'billing_address_format_id' => $this->billing['format_id'],
'payment_method' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_METHOD_GV : $this->info['payment_method']),
'payment_module_code' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_MODULE_GV : $this->info['payment_module_code']),
'shipping_method' => $this->info['shipping_method'],
'shipping_module_code' => (strpos($this->info['shipping_module_code'], '_') > 0 ? substr($this->info['shipping_module_code'], 0, strpos($this->info['shipping_module_code'], '_')) : $this->info['shipping_module_code']),
'coupon_code' => $this->info['coupon_code'],
'cc_type' => $this->info['cc_type'],
'cc_owner' => $this->info['cc_owner'],
'cc_number' => $this->info['cc_number'],
'cc_expires' => $this->info['cc_expires'],
'date_purchased' => 'now()',
'orders_status' => $this->info['order_status'],
'order_total' => $this->info['total'],
'order_tax' => $this->info['tax'],
'currency' => $this->info['currency'],
'currency_value' => $this->info['currency_value'],
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -