jedak |
06-04-2005 08:34 AM |
Quote:
Originally Posted by jeanne
I have my destination zone (that I use for taxing) set up by zip code like this:
90%
91%
92%
93%
94%
95%
960%
961%
This mod is basically giving a temporary value to the 'Default Zip Code' entry that you can set in General Settings.
So when an zip code entry is put in the shipping calculator that matches my tax zone, the tax shows up as long as the 'Default Zip Code' entry in General Settings blank. If you have any other of the default settings (zip code, state) filled in clear the entries to see if that makes a difference.
|
:? :?
I 'm not sure how and where you got % in there. I remove the zipcode and city in general settings but no luck, I tried to remove the state but there is no blank option. The assign shipping is displayed in the shipping label
e.g. Sales Tax 8.625%: n/a or Sales Tax 9.50%: n/a
but the calculation is not made 'n/a' is always displayed. for some reason its not being allow to change 'n/a' to display calulated taxes. :(
Here is a look at my cart.php maybe you can see something that I couldn't.
Code:
#
# $Id: cart.php,v 1.6.2.45 2005/03/28 06:12:46 max Exp $
#
# This script implements shopping cart facility
#
require "./auth.php";
include $xcart_dir."/shipping/shipping.php";
//include "./nocookie_warning.php";
x_session_register("cart");
x_session_register("intershipper_rates");
x_session_register("intershipper_recalc");
x_session_unregister("secure_oid");
x_session_register("extended_userinfo");
x_session_register("anonymous_checkout");
x_session_register("payment_cc_fields");
x_session_register("current_carrier","UPS");
x_session_register("is_sns_action");
x_session_register("zipcode_estimate");
if($zip_estimate == "clear")
{
$zipcode_estimate = "";
func_header_location("cart.php");
}
if(!empty($zip_estimate))
{
$zipcode_estimate = $zip_estimate;
$count = substr_count($zipcode_estimate,"0") + substr_count($zipcode_estimate,"1") + substr_count($zipcode_estimate,"2") + substr_count($zipcode_estimate,"3") + substr_count($zipcode_estimate,"4") + substr_count($zipcode_estimate,"5") + substr_count($zipcode_estimate,"6") + substr_count($zipcode_estimate,"7") + substr_count($zipcode_estimate,"8") + substr_count($zipcode_estimate,"9");
if($count != 5){ //checking for 5 digits
$zipcode_estimate = "";}
if($mode=="checkout")
func_header_location("cart.php?mode=checkout");
else
func_header_location("cart.php");
}
if($zipcode_estimate != "")
{
$config["General"]["apply_default_country"] = "Y";
$config["General"]["default_zipcode"] = $zipcode_estimate;
$smarty->assign("estimate","NO");
}
if($zipcode_estimate >= 10001 && $zipcode_estimate <= 14975){
$config["General"]["default_state"] = "NY";
}
$intershipper_recalc = "Y";
x_session_register("arb_account_used");
x_session_register("airborne_account");
function check_payment_methods($membership) {
global $sql_tbl, $config, $cart;
$gc_condition = ((@empty($cart["products"]) && @!empty($cart["giftcerts"]))?" AND pm.paymentid != 14 ":"");
$payment_methods=func_query("select pm.*,cc.module_name,cc.processor,cc.type from $sql_tbl[payment_methods] as pm left join $sql_tbl[ccprocessors] as cc on pm.paymentid=cc.paymentid where pm.active='Y' AND (pm.membership='' OR pm.membership='$membership') $gc_condition order by pm.orderby");
$payment_methods = test_payment_methods($payment_methods,($config["General"]["hide_disfunctional_payments"]=="Y"));
return $payment_methods;
}
#
# Stop list module: check transaction
#
if (!empty($active_modules["Stop_List"]) and !func_is_allowed_trans()) {
if($mode == "checkout" || $mode == "auth") {
$top_message["content"] = func_get_langvar_by_name("txt_stop_list_customer_note");
$top_message["type"] = "E";
func_header_location("cart.php");
}
$smarty->assign("unallowed_transaction", "Y");
}
#
# Normalize cart content
#
if(!func_is_cart_empty($cart) && $REQUEST_METHOD == 'GET' && !in_array($mode, array('wishlist','wl2cart'))) {
$hash = array();
if(!empty($cart['products'])) {
foreach($cart['products'] as $k => $p) {
if($p['hidden'] || !empty($p['pconf_data']))
continue;
$po = (!empty($p['options']) && is_array($p['options'])?serialize($p['options']):"");
$key = $p['productid'].$po.$p['free_price'];
if(isset($hash[$key])) {
if(empty($p['distribution'])) {
$cart['products'][$hash[$key]]['amount'] += $p['amount'];
} else {
$cart['products'][$hash[$key]]['amount'] = 1;
}
unset($cart['products'][$k]);
} else {
$hash[$key] = $k;
}
}
}
unset($hash);
}
if ($mode == "checkout" || $mode == "auth") {
#
# Calculate total number of checkout process steps
#
$total_checkout_steps = 2;
$checkout_step_modifier["anonymous"] = 0;
$checkout_step_modifier["payment_methods"] = 0;
if ($login == "" or $anonymous_checkout) {
$total_checkout_steps++;
$checkout_step_modifier["anonymous"] = 1;
}
$payment_methods = check_payment_methods(@$user_account["membership"]);
if(empty($payment_methods)) {
$top_message['content'] = func_get_langvar_by_name("txt_no_payment_methods");
$top_message['type'] = 'E';
func_header_location("cart.php");
} elseif (count($payment_methods) == 1) {
$total_checkout_steps--;
$checkout_step_modifier["payment_methods"] = 1;
}
}
else
$anonymous_checkout = false;
#
# $order_secureid (for security reasons)
#
x_session_register("order_secureid");
if ($mode == "clear_cart") {
if(!empty($active_modules['SnS_connector']) && !empty($cart['products'])) {
foreach($cart['products'] as $p) {
$is_sns_action['DeleteFromCart'][] = $p['productid'];
}
}
$cart = "";
func_header_location("cart.php");
}
#
# UNSET GIFT CERTIFICATE
#
if ($mode == "unset_gc" && $gcid) {
foreach ($cart["applied_giftcerts"] as $k=>$v) {
if ($v["giftcert_id"] == $gcid) {
$cart["total_cost"] = $cart["total_cost"] - $v["giftcert_cost"];
continue;
}
$tmp[] = $v;
}
$cart["applied_giftcerts"] = @$tmp;
db_query("UPDATE $sql_tbl[giftcerts] SET status='A' WHERE gcid='$gcid'");
func_header_location("cart.php?mode=checkout");
}
#
# Register member if not registerred yet
# (not a newbie - do not show help messages)
#
$smarty->assign("register_script_name",(($config["General"]["use_https_login"]=="Y")?$xcart_catalogs_secure['customer']."/":"")."cart.php");
if ($mode == "checkout") {
$usertype = "C";
$old_action = $action;
$action = "cart";
$smarty->assign("action", $action);
if (empty($login))
include $xcart_dir."/include/register.php";
if (!empty($auto_login)) {
func_header_location("cart.php?mode=checkout®istered=");
}
$saved_userinfo = $userinfo;
$action = $old_action;
}
if (!empty($login)) $userinfo = func_userinfo($login, $current_area, true);
if (!empty($extended_userinfo))
$userinfo = func_array_merge($userinfo, $extended_userinfo);
#
# Add to cart
#
if($mode=="add" && $productid!="") {
$added_product = func_select_product($productid, (!empty($user_account['membership'])?$user_account['membership']:""), false, true);
if ($added_product["forsale"] == "B") {
$top_message["content"] = func_get_langvar_by_name("txt_pconf_product_is_bundled");
$top_message["type"] = "W";
func_header_location($HTTP_REFERER);
}
if(!empty($active_modules['Egoods']) && !empty($added_product['distribution'])) {
$amount = 1;
}
$amount = abs(intval($amount));
#
# Do addition to cart with options
#
if($active_modules["Product_Options"]) {
if (!empty($product_options)) {
if(!func_check_product_options ($productid, $product_options)) {
if (!empty($active_modules["Product_Configurator"]) and $added_product["product_type"] == "C")
func_header_location("pconf.php?productid=$productid&err=options");
else
func_header_location("product.php?productid=$productid&err=options");
}
} else {
$product_options = func_get_default_options($productid, $amount, @$user_account['membership']);
if($product_options === false) {
func_header_location ("error_message.php?access_denied&id=30");
} elseif($product_options === true) {
$product_options = "";
unset($product_options);
}
}
$variantid = func_get_variantid($product_options);
if(!empty($cart['products']) && !empty($variantid)) {
$added_product["avail"] = func_get_options_amount($product_options, $productid);
foreach($cart['products'] as $k => $v) {
if($v['productid'] == $productid) {
if($variantid == func_get_variantid($v['options'])) {
$added_product["avail"] -= $v['amount'];
}
}
}
}
}
#
# Add to cart amount of items that is not much than in stock
#
if ($config["General"]["unlimited_products"]=="N" && $added_product["product_type"]!="C")
if ($amount > $added_product["avail"])
$amount = $added_product["avail"];
if ($productid && $amount) {
if ($amount < $added_product["min_amount"]) {
func_header_location ("error_message.php?access_denied&id=31");
}
$found = false;
$product_distribution = func_query_first_cell("SELECT distribution FROM $sql_tbl[products] WHERE productid='$productid'");
if (!empty($cart) and @$cart["products"] and $added_product["product_type"]!="C") {
foreach ($cart["products"] as $k=>$v) {
if (($v["productid"] == $productid) && (!$found) && ($v["options"] == $product_options) && empty($v["hidden"])) {
if ((float)$v["free_price"] != $price)
continue;
$found = true;
if (($cart["products"][$k]["amount"] >=1) && !empty($product_distribution)) {
$cart["products"][$k]["amount"]=1;
$amount=0;
}
$cart["products"][$k]["amount"] += $amount;
}
}
}
if (!$found) {
#
# Add product to the cart
#
if (!empty($price))
# price value is defined by customer if admin set it to '0.00'
$free_price = abs(doubleval($price));
$cartid = func_generate_cartid($cart["products"]);
if(empty($cart["products"]))
$add_to_cart_time = time();
$cart["products"][]=array("cartid"=>$cartid, "productid"=>$productid,"amount"=>$amount, "options"=>$product_options, "free_price"=>@price_format(@$free_price),"distribution"=>$product_distribution);
if(!empty($active_modules["Product_Configurator"]))
include $xcart_dir."/modules/Product_Configurator/pconf_customer_cart.php";
}
$intershipper_recalc = "Y";
} elseif($from == 'partner' && $productid) {
func_header_location($xcart_catalogs['customer']."/product.php?productid=".$productid);
}
}
#
# DELETE PRODUCT FROM THE CART
#
if ($mode=="delete" && $productindex!="") {
#
# Delete product from cart
#
if(!empty($active_modules["Product_Configurator"]))
include $xcart_dir."/modules/Product_Configurator/pconf_customer_cart.php";
foreach ($cart["products"] as $k=>$v)
if ($v["cartid"] == $productindex) {
$productid = $v["productid"];
if(!empty($active_modules["Advanced_Statistics"]))
@include $xcart_dir."/modules/Advanced_Statistics/prod_del.php";
array_splice($cart["products"],$k,1);
break;
}
if (!empty($active_modules['SnS_connector']) && !empty($productid)) {
$is_sns_action['DeleteFromCart'][] = $productid;
}
if (func_is_cart_empty($cart)) {
$cart = "";
}
$intershipper_recalc = "Y";
func_header_location("cart.php");
}
elseif (!empty($shippingid)) {
$cart["shippingid"]=$shippingid;
}
if (empty($action)) $action = "";
#
# UPDATES PRODUCTS QUANTITY IN THE CART
#
if ($action=="update") {
if(!empty($productindexes)) {
#
# Update quantity
#
foreach($productindexes as $_cartid=>$new_quantity) {
foreach ($cart["products"] as $k=>$v)
if ($v["cartid"] == $_cartid) {
$productindexes_tmp[$k] = $new_quantity;
break;
}
}
$productindexes = $productindexes_tmp;
unset($productindexes_tmp);
if(!empty($active_modules["Product_Configurator"]))
include $xcart_dir."/modules/Product_Configurator/pconf_customer_cart.php";
foreach($cart["products"] as $k=>$v) {
$tot = 0;
$tot_amount = 0;
if($active_modules['Product_Options'] && !empty($v['options']))
$vid = func_get_variantid($v['options']);
foreach($productindexes as $productindex=>$new_quantity) {
if (!is_numeric($new_quantity)) continue;
if($active_modules['Product_Options'] && !empty($cart["products"][$productindex]['options']))
$lvid = func_get_variantid($cart["products"][$productindex]['options']);
if ($cart["products"][$productindex]["productid"] == $v["productid"] && $vid == $lvid)
$tot += floor($new_quantity);
}
foreach($cart["products"] as $k2 => $v2) {
if($active_modules['Product_Options'] && !empty($cart["products"][$k2]['options']))
$lvid = func_get_variantid($cart["products"][$k2]['options']);
if ($v["productid"] == $v2["productid"] && $vid == $lvid)
$tot_amount += $v2['amount'];
}
$updates_array[$k] = array("quantity"=>$v["amount"], "total_quantity"=>$tot, "total_amount" => $tot_amount);
}
# Create hash array with variants
$hash = array();
if(!empty($active_modules['Product_Options'])) {
foreach($productindexes as $productindex => $new_quantity) {
if(!empty($cart["products"][$productindex]['options'])) {
$variantid = func_get_variantid($cart["products"][$productindex]['options']);
if($variantid) {
if(!isset($hash[$variantid])) {
$hash[$variantid]['avail'] = func_get_options_amount($cart["products"][$productindex]['options'], $cart["products"][$productindex]['productid']);
}
$hash[$variantid]['old'] += $cart["products"][$productindex]['amount'];
$hash[$variantid]['new'] += $new_quantity;
$hash[$variantid]['ids'][] = $cart["products"][$productindex]['productid'];
$cart["products"][$productindex]['variantid'] = $variantid;
}
}
}
}
# Check&set new quantity
foreach($productindexes as $productindex => $new_quantity) {
if (!is_numeric($new_quantity) || empty($cart["products"][$productindex]))
continue;
$new_quantity = floor($new_quantity);
$productid=$cart["products"][$productindex]["productid"];
$total_quantity = $updates_array[$productindex]["total_quantity"];
$total_amount = $updates_array[$productindex]["total_amount"];
if ($config["General"]["unlimited_products"]=="N" && $cart["products"][$productindex]["product_type"] != "C")
if(!empty($cart["products"][$productindex]['variantid'])) {
$amount_max = $hash[$cart["products"][$productindex]['variantid']]['avail'];
$total_quantity = $hash[$cart["products"][$productindex]['variantid']]['old'];
} else {
$amount_max=func_query_first_cell("select avail from $sql_tbl[products] where productid='$productid'");
}
else
$amount_max=$total_quantity+1;
$amount_min=func_query_first_cell("select min_amount from $sql_tbl[products] where productid='$productid'");
#
# Do not change
#
if ($config["General"]["unlimited_products"] == "Y") {
$cart["products"][$productindex]["amount"] = $new_quantity;
continue;
}
if (($new_quantity >= $amount_min ) && ($products[$productindex]["distribution"]))
$cart["products"][$productindex]["amount"] = 1;
elseif (($new_quantity >= $amount_min) && ($new_quantity <= ($amount_max-$total_amount+$cart["products"][$productindex]["amount"]))) {
$cart["products"][$productindex]["amount"] = $new_quantity;
if(!empty($cart["products"][$productindex]['variantid'])) {
$hash[$cart["products"][$productindex]['variantid']]['old'] += ($new_quantity-$cart["products"][$productindex]["amount"]);
} else {
$updates_array[$productindex]["total_amount"] += ($new_quantity-$cart["products"][$productindex]["amount"]);
}
} elseif ($new_quantity >= $amount_min) {
$old_amount = $cart["products"][$productindex]["amount"];
$cart["products"][$productindex]["amount"] = ($amount_max-$total_amount+$cart["products"][$productindex]["amount"]);
if(!empty($cart["products"][$productindex]['variantid'])) {
$hash[$cart["products"][$productindex]['variantid']]['old'] += ($amount_max-$total_amount+$cart["products"][$productindex]["amount"]-$old_amount);
} else {
$updates_array[$productindex]["total_amount"] += ($amount_max-$total_amount+$cart["products"][$productindex]["amount"]-$old_amount);
}
} else
$cart["products"][$productindex]["amount"] = 0;
if($cart["products"][$productindex]["amount"] < 0)
$cart["products"][$productindex]["amount"] = 0;
}
if(!empty($active_modules["Product_Configurator"])) {
$pconf_update = "post_update";
include $xcart_dir."/modules/Product_Configurator/pconf_customer_cart.php";
}
foreach($cart["products"] as $index => $product) {
if($product["amount"] > 0) {
$products[] = $product;
}
$cart["products"] = $products;
}
$intershipper_recalc = "Y";
}
#
# Update shipping method
#
if ($config["Shipping"]["realtime_shipping"] == "Y" and !empty($active_modules["UPS_OnLine_Tools"]) and $config["Shipping"]["use_intershipper"] != "Y")
$current_carrier = $selected_carrier;
if($shippingid!="") $cart["shippingid"]=$shippingid;
$airborne_account = $arb_account;
if(!empty($active_modules['SnS_connector']) && !empty($productindexes))
func_generate_sns_action("CartChanged");
func_header_location("cart.php".(!empty($mode) ? "?mode=$mode" : ""));
}
if (!func_is_cart_empty($cart)) {
$products = func_products_in_cart($cart, (!empty($userinfo["membership"])?$userinfo["membership"]:""));
if (is_array($products))
if (!empty($cart["products"]) and count($products) != count($cart["products"])) {
foreach($products as $k=>$v) {
$prodids[] = $v["productid"];
$prodids_opts[] = $v['options'];
}
if (is_array($prodids)) {
foreach($cart["products"] as $k=>$v)
if (in_array($v["productid"], $prodids) && in_array($v["options"], $prodids_opts))
$cart_prods[$k] = $v;
$cart["products"] = $cart_prods;
}
else
$cart = "";
func_header_location("cart.php?$QUERY_STRING");
}
if(!empty($active_modules["Subscriptions"])) {
include $xcart_dir."/modules/Subscriptions/subscription.php";
}
if (empty($login) && $config["General"]["apply_default_country"]=="Y") {
$userinfo["s_country"] = $config["General"]["default_country"];
$userinfo["s_state"] = $config["General"]["default_state"];
$userinfo["s_zipcode"] = $config["General"]["default_zipcode"];
$userinfo["s_city"] = $config["General"]["default_city"];
$userinfo["s_countryname"] = func_get_country($userinfo["s_country"]);
$userinfo["s_statename"] = func_get_state($userinfo["s_state"], $userinfo["s_country"]);
}
#
# Check if only downloadable products placed in cart
#
$need_shipping = false;
if ($config["Shipping"]["disable_shipping"]!="Y") {
if (is_array($products))
foreach ($products as $product)
if ($product["free_shipping"] == "Y" or ($active_modules["Egoods"] and $product["distribution"] != "") or ($config["Shipping"]["replace_shipping_with_freight"] == "Y" and $product["shipping_freight"] > 0))
continue;
else
$need_shipping = true;
}
$smarty->assign("need_shipping", $need_shipping);
if ($need_shipping) {
#
# Get the allowed shipping methods list
#
$shipping = func_get_shipping_methods_list($cart, $products, $userinfo);
$smarty->assign("shipping", $shipping);
$smarty->assign("current_carrier", $current_carrier);
}
}
if (!empty($need_shipping)) {
#
# If current shipping is empty set it to default (first in shipping array)
#
$shipping_matched = false;
if(!empty($shipping))
foreach($shipping as $shipping_method)
if(@$cart["shippingid"]==$shipping_method["shippingid"]) $shipping_matched=true;
if(!$shipping_matched && !empty($shipping))
$cart["shippingid"] = $shipping[0]["shippingid"];
$cart["delivery"]=func_query_first_cell("select shipping from $sql_tbl[shipping] where shippingid='$cart[shippingid]'");
}
else {
$cart["delivery"] = "";
$cart["shippingid"] = 0;
}
$smarty->assign("main","cart");
#
# If cart is not empty put products' details into products array
#
if (!func_is_cart_empty($cart)) {
#
# Discount coupons
#
if($active_modules["Discount_Coupons"])
include $xcart_dir."/modules/Discount_Coupons/discount_coupons.php";
#
# Calculate all prices
#
$cart = func_array_merge ($cart, func_calculate($cart, $products, $login, $current_area));
if (func_is_cart_empty($cart)) {
$cart = "";
func_header_location($xcart_web_dir.DIR_CUSTOMER."/error_message.php?product_in_cart_expired");
} else {
$products = func_products_in_cart($cart, (!empty($userinfo["membership"])?$userinfo["membership"]:""));
}
$smarty->assign("cart",$cart);
}
#
# Redirect
#
if($mode=="add" and $productid) {
if(!empty($active_modules['SnS_connector'])) {
func_generate_sns_action("AddToCart", $productid);
}
if($config["General"]["redirect_to_cart"]=="Y") {
func_header_location("cart.php");
} else{
if(!empty($HTTP_REFERER)) {
func_header_location($HTTP_REFERER);
} else {
func_header_location("home.php?cat=$cat&page=$page");
}
}
} elseif (!empty($is_sns_action)) {
foreach ($is_sns_action as $a => $v) {
foreach ($v as $v2) {
func_generate_sns_action($a, $v2);
}
}
$is_sns_action = array();
}
#
# Wishlist facility
#
if (!empty($active_modules["Wishlist"]) && $mode != "checkout") {
@include $xcart_dir."/modules/Wishlist/wishlist.php";
}
if ($mode != "wishlist") {
if ($mode == "checkout")
$location[] = array(func_get_langvar_by_name("lbl_checkout"), "");
else
$location[] = array(func_get_langvar_by_name("lbl_your_shopping_cart"), "");
}
#
# SHOPPING CART FEATURE
#
if (($mode=="checkout") && (!empty($cart["products"])) && (empty($shipping)) && ($login) && $need_shipping && $config["Shipping"]["disable_shipping"]!="Y") {
func_header_location("error_message.php?error_no_shipping");
}
if ($mode=="checkout" && !func_is_cart_empty($cart) && ($cart["subtotal"]<$config["General"]["minimal_order_amount"]) && $config["General"]["minimal_order_amount"] > 0) {
func_header_location("error_message.php?error_min_order");
}
if($mode=="checkout" && $login=="" && !func_is_cart_empty($cart)) {
#
# Anonimous checkout
#
$smarty->assign("main","anonymous_checkout");
$smarty->assign("anonymous","Y");
if(empty($userinfo) && !empty($saved_userinfo)) {
$userinfo = $saved_userinfo;
}
$checkout_step = 1;
$anonymous_checkout = true;
$location[] = array(func_get_langvar_by_name("lbl_your_order"), "");
} elseif($mode=="checkout" && empty($paymentid) && !func_is_cart_empty($cart) && $cart["total_cost"] == 0) {
func_header_location($current_location."/payment/payment_offline.php");
} elseif($mode=="checkout" && $paymentid!="" && !func_is_cart_empty($cart)) {
#
# Check if paymentid isn't faked
#
$is_egoods = false;
if($config['Modules']['egoods_manual_cc_processing'] == 'Y') {
$is_egoods = func_esd_in_cart($cart);
}
$membership = $user_account["membership"];
$is_valid_paymentid = func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[payment_methods] WHERE paymentid='$paymentid'".(($is_egoods && $paymentid == 1)?"":" AND active='Y'")." AND (membership='' OR membership='$membership') ");
if (!$is_valid_paymentid) {
func_header_location("cart.php?mode=checkout&err=paymentid");
}
#
# Generate uniq orderid which will identify order session
#
$order_secureid = md5(uniqid(rand()));
#
# Show payment details checkout page
#
$payment_cc_data = func_query_first("SELECT * FROM $sql_tbl[ccprocessors] WHERE paymentid='$paymentid'");
if($is_egoods && $paymentid != 1 && !empty($payment_cc_data)) {
$paymentid = 1;
$payment_cc_data = array();
}
$smarty->assign("payment_cc_data", $payment_cc_data);
#
# Generate payment script URL depending on HTTP/HTTPS settings
#
$payment_data = func_query_first("select * from $sql_tbl[payment_methods] where paymentid='$paymentid'");
$payment_data["payment_script_url"] = ($payment_data["protocol"]=="https"?$https_location:$http_location)."/payment/".$payment_data["payment_script"];
$smarty->assign("payment_data",$payment_data);
if(!empty($payment_cc_fields)) {
$userinfo = func_array_merge($userinfo, $payment_cc_fields);
}
$smarty->assign("userinfo",$userinfo);
$smarty->assign("main","checkout");
if ($checkout_step_modifier["payment_methods"] == 1)
$smarty->assign("ignore_payment_method_selection", 1);
$checkout_step = 2 + $checkout_step_modifier["anonymous"] - $checkout_step_modifier["payment_methods"];
$location[] = array(func_get_langvar_by_name("lbl_payment_details"), "");
} elseif($mode=="checkout" && !func_is_cart_empty($cart)) {
#
# Show checkout page with payment options only methods availiable to current
# membership level are displayed
#
$payment_methods = check_payment_methods(@$user_account["membership"]);
if (count($payment_methods) == 1)
func_header_location("cart.php?paymentid=".$payment_methods[0]["paymentid"]."&mode=checkout");
if (!empty($payment_methods))
$payment_methods[0]["is_default"] = 1;
$checkout_step = 1 + $checkout_step_modifier["anonymous"] - $checkout_step_modifier["payment_methods"];
$smarty->assign("payment_methods",$payment_methods);
$smarty->assign("main","checkout");
$location[] = array(func_get_langvar_by_name("lbl_payment_details"), "");
}
elseif ($mode=="order_message") {
$smarty->assign("main","order_message");
$location[] = array(func_get_langvar_by_name("lbl_order_processed"), "");
}
elseif ($mode=="auth") {
$smarty->assign("main","checkout");
$checkout_step = 1;
}
require $xcart_dir."/include/categories.php";
if($active_modules["Manufacturers"])
include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php";
$giftcerts = (!empty($cart["giftcerts"])? $cart["giftcerts"] : array());
#
# In this mode cart.php show info about existing order (order_message)
#
if (!empty($orderids)) {
if (empty($login))
func_header_location("error_message.php?access_denied&id=32");
$orders = array ();
$_orderids = split (",",$orderids);
foreach ($_orderids as $orderid) {
$order_data = func_order_data($orderid);
$order_data['products'] = func_translate_products($order_data['products'], $shop_language);
#
# Security check if current customer is not order's owner
#
if ($order_data["order"]["login"]!=$login) unset($order_data);
$orders[] = $order_data;
}
$smarty->assign("orders", $orders);
if ($action == "print") {
$smarty->assign("template", "customer/main/order_message.tpl");
func_display("customer/preview.tpl",$smarty);
exit;
}
$smarty->assign("orderids", $orderids);
}
include "./minicart.php";
if(!empty($payment_cc_fields)) {
$userinfo = func_array_merge($userinfo, $payment_cc_fields);
}
if(!empty($login) || $mode != 'checkout') {
$smarty->assign("userinfo",@$userinfo);
}
$smarty->assign("products",@$products);
$smarty->assign("giftcerts",$giftcerts);
if ($mode == "checkout" || $mode == "auth") {
$smarty->assign("checkout_step",$checkout_step);
$smarty->assign("total_checkout_steps",$total_checkout_steps);
}
if (!empty($order))
$smarty->assign("order",$order);
if (!empty($login))
db_query("UPDATE $sql_tbl[customers] SET cart='".addslashes(serialize($cart))."' WHERE login='$login'");
if (func_use_arb_account()) {
$smarty->assign("use_airborne_account", true);
$smarty->assign("airborne_account", $airborne_account);
}
x_session_save();
# Assign the current location line
$smarty->assign("location", $location);
func_display("customer/home.tpl",$smarty);
?>
Thanks for the help! :)
|