Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Pre-Login Shipping Calculator

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #111  
Old 05-28-2005, 12:23 PM
  jedak's Avatar 
jedak jedak is offline
 

Senior Member
  
Join Date: Apr 2005
Location: NY
Posts: 149
 

Default

This is a great mod thanks to all who contributed.

I've added the shipping part of this mod into 4.0.13 but wanted to also include the taxes can someone please provide some guidence as to where to place the taxes code in cart.php and/or cart_total.tpl
Thanks again.
__________________
X-Cart pro v4.0.17
X-Cart pro v4.1.6
X-Cart pro v4.2
Reply With Quote
  #112  
Old 05-29-2005, 10:27 AM
 
jimmy_ jimmy_ is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 37
 

Default

Quote:
Originally Posted by shwekhaw
I like to have this feature on my site. But I use "Defined shipping methods" ( I define shipping rate by zones) plus "FedEx Priority". I have fedex rate sheet downloaded.

I cannot use the code posted in this thread. Does this code work with UPS only? I am not sure how zipcode lookup is done in my case. I define zones by states only but I have FedEx rate sheet with zipcode.

Can someone edit posted code so that it works for my case? I do not need a fancy zipcode lookup. All I need is the code that will lookup the state entered or zone entered and calculate the shipping according to defined shipping rate.

S-H-W-E-K-H-A-W


We also use DEFINED SHIPPING Rates that are state and country specific, we were very much hoping we could use this mod with our setup. It seems everyone else here is using it for the REAL TIME SHIPPING but what about those of us who do not use real time?


We would also be interested in Tax calculations as well, so our client knows exactly what they are paying before they go any further into the checkout process.


BTW we are running 4.0.13

If anyone can help with this, we would be more then happy to compensate you for your time
Reply With Quote
  #113  
Old 05-31-2005, 04:12 PM
 
TJ Stephens TJ Stephens is offline
 

Advanced Member
  
Join Date: May 2005
Location: California
Posts: 94
 

Default

This is a great mod! It should be integrated into future versions of x-cart. Thanks Rackit and all that contributed. I have the code posted by BCSE on page five working on 4.0.13 along with the tax modification posted by sportruck but I cannot figure out how to fix one problem.

I currently ship with UPS using realtime shipping costs. I also have defined another shipping option named "Customer Pick Up" so customers can pick the items up from our store without paying for shipping.

When a customer first comes to the site and inputs their zip code it displays UPS in the "select a carrier" box and the realtime shipping costs for the UPS delivery methods I have set up. That works great. If I select "Other Carriers", then it will show the defined shipping method "Customer Pick Up" that I created and the shipping cost will display n/a. That works great too.

However, once I select "Other Carriers" it will not let me go back to UPS. The "select a carrier" box disappears and only my "Customer Pick Up" option is displayed in the delivery box. Does anyone know what is causing this?

Interestingly, if I click on "Click here to change your zip code" it will display the UPS otions in the delivery box along with my customer pick up option but it does not show the realtime rates.

I hope this makes sense. Any help would be appreciated.
__________________
X-Cart Pro 4.1.11 (Live)
XRMA
XAFF
XAOM
DSEFU Pro
XGift Reg
Firetank Feed Manager
BCSE Shipping Calculator
XcartMod Dynamic Images
Reply With Quote
  #114  
Old 06-02-2005, 08:52 AM
 
jeanne jeanne is offline
 

Advanced Member
  
Join Date: Aug 2004
Posts: 85
 

Default taxes & defined rates 4.0.13

I use 4.0.13 with this mod and it works fine.
Right now I have Defined Shipping Rates and it works with them as well.

The taxes show up correctly on cart.php.
Define your tax zones by zip code and make sure that you do not have Default ZipCode (in General Settings) that would cause tax to be applied. I have it blank.
__________________
Jeanne
4.1.8 Gold
Reply With Quote
  #115  
Old 06-02-2005, 11:14 PM
  jedak's Avatar 
jedak jedak is offline
 

Senior Member
  
Join Date: Apr 2005
Location: NY
Posts: 149
 

Default Re: taxes & defined rates 4.0.13

Quote:
Originally Posted by jeanne
The taxes show up correctly on cart.php.
Define your tax zones by zip code and make sure that you do not have Default ZipCode (in General Settings) that would cause tax to be applied. I have it blank.
I've tried all that you have said but still no luck were in cart.php should this code be place
Code:
if($zipcode_estimate >= 10002 && $zipcode_estimate <= 14925){ $config["General"]["default_state"] = "NY"; }
before or after the chipping calculation code or somewhere else.
thx
__________________
X-Cart pro v4.0.17
X-Cart pro v4.1.6
X-Cart pro v4.2
Reply With Quote
  #116  
Old 06-03-2005, 12:30 PM
 
jeanne jeanne is offline
 

Advanced Member
  
Join Date: Aug 2004
Posts: 85
 

Default

I don't have code like that in cart.php. The code is already set up to do this if your tax zone is set up by zip code.
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.
__________________
Jeanne
4.1.8 Gold
Reply With Quote
  #117  
Old 06-04-2005, 08:34 AM
  jedak's Avatar 
jedak jedak is offline
 

Senior Member
  
Join Date: Apr 2005
Location: NY
Posts: 149
 

Default

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&registered="); } $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!
__________________
X-Cart pro v4.0.17
X-Cart pro v4.1.6
X-Cart pro v4.2
Reply With Quote
  #118  
Old 06-07-2005, 12:14 PM
 
jeanne jeanne is offline
 

Advanced Member
  
Join Date: Aug 2004
Posts: 85
 

Default

90%
91%
92%
93%
94%
95%
960%
961%

is how I have my destination zone that I use for taxes set up. It is not in the code. It's under Inventory-> Destination Zones
I am taxing orders to all Zip Codes in California so when you enter a zip code that matches (% are the wild cards in this set up) the tax shows up.
How do you have your taxing zone set up?
Does it check by zip code, state, city ????
__________________
Jeanne
4.1.8 Gold
Reply With Quote
  #119  
Old 06-07-2005, 09:58 PM
  jedak's Avatar 
jedak jedak is offline
 

Senior Member
  
Join Date: Apr 2005
Location: NY
Posts: 149
 

Default

Quote:
Originally Posted by jeanne
90%
91%
92%
93%
94%
95%
960%
961%
I forgot wildcards could be used.

Quote:
Originally Posted by jeanne
It's under Inventory-> Destination Zones
I am taxing orders to all Zip Codes in California so when you enter a zip code that matches (% are the wild cards in this set up) the tax shows up.
How do you have your taxing zone set up?
Does it check by zip code, state, city ????
Under Inventory-> Destination Zones I have state city and zipcodes entered. Could it be because I have the cities entered??
Thanks
__________________
X-Cart pro v4.0.17
X-Cart pro v4.1.6
X-Cart pro v4.2
Reply With Quote
  #120  
Old 06-07-2005, 10:09 PM
 
TJ Stephens TJ Stephens is offline
 

Advanced Member
  
Join Date: May 2005
Location: California
Posts: 94
 

Default

Jedak,

I think I am having the same problem as you. Try going to "taxing system" under management and uncheck "Display cart/order totals including tax:". See if this makes it display the taxes. I'm using 4.0.13 too and if this box is checked then it displays takes for me with the pre-login shipping calculator. If I uncheck it (which I want to do for formating reasons) then the total still includes the taxes but the tax line displays "n/a" instead of the actual tax amount. Is this the same thing you are having trouble with? If so, I will let you know if I figure out how to fix this and please do the same if you find a fix.

TJ
__________________
X-Cart Pro 4.1.11 (Live)
XRMA
XAFF
XAOM
DSEFU Pro
XGift Reg
Firetank Feed Manager
BCSE Shipping Calculator
XcartMod Dynamic Images
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:44 AM.

   

 
X-Cart forums © 2001-2020