X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Select Shipping witrh military APO/ FPO (https://forum.x-cart.com/showthread.php?t=56790)

mrerotic 11-29-2010 10:29 AM

Select Shipping witrh military APO/ FPO
 
Ok I added the correct miltary "AE", "AP", "AA" to my states for user to select. However I have real time shipping enabled and upon checkout I get the following error in the cart:
PHP Code:

UPS Realtime shipping rate calculation service returned the following error:AP is not a valid state for the specified shipment. (errorcode111286

</DIV>
Is there anyway to disable UPS since they dont ship for APO/FPO if the users state is "AE", "AA" or "AP"? Please let me know.

mrerotic 11-29-2010 02:25 PM

Re: Select Shipping witrh military APO/ FPO
 
I was able to fix this. All APO/FPO are only shipped via USPS so therefore I only wanted rates to show from USPS for all military addresses. I had to edit the myshipper.php and shipping.php to allow for this to work. If anyone needs the edits, feel free to let me know and I will post them.

borisge 01-06-2011 08:26 AM

Re: Select Shipping witrh military APO/ FPO
 
I would appreciate this edit. I have a customer who commonly ships to APO and only just found that the UPS Address Validator tends to freak out if someone enters an APO address, not allowing checkout. I'm not certain that your problem is the same as mine, but it certainly wouldn't hurt to see how you did it.

borisge 01-10-2011 09:48 AM

Re: Select Shipping witrh military APO/ FPO
 
What I ended up doing was just modifying include/register.php so the if-statement that runs the validator also checks to see if you're trying to validate an APO:

PHP Code:

if (!@$error && $current_area == "C" && !empty($active_modules["UPS_OnLine_Tools"]) && $s_state != "AA" && $s_state !="AE" && $s_state != "AP" && $s_city != "APO"


If any other cases pop up in which it shouldn't be run, I'll probably modify this code to reflect that.

HookahMaster 03-18-2011 06:41 AM

Re: Select Shipping witrh military APO/ FPO
 
I am having this same issue. I can not get it to work correctly. I am now getting this message:

UPS Realtime shipping rate calculation service returned the following error:
AE is not a valid state for the specified shipment. (errorcode: 111286)
Unfortunately, we are unable to provide you with a shipping cost estimate for this order.

Can someone help?

Thanks

mrerotic 03-21-2011 12:33 PM

Re: Select Shipping witrh military APO/ FPO
 
Ok I'm trying to remember how I did this but here are the edits that I can remember. If your having issues after adding these let me know what the issue is and make sure you do the edits I have provided.

Open /shipping/shipping.php
Find the following:
Code:

func_https_ctl('IGNORE');

After add the following:
Code:

  $military = array("AP","AE","AA");
  if (in_array($userinfo['s_state'], $military)){
  $shipmilitary = "Y";
  $smarty->assign("military","Y");
  }


Find:
Code:

$intershipper_rates = func_shipper($data['items'], $userinfo, $data['seller_address'], 'N', $cart);

Replace with:
Code:

$intershipper_rates = func_shipper($data['items'], $userinfo, $data['seller_address'], 'N', $cart, $shipmilitary);

Find:
Code:

if (!empty($active_modules["UPS_OnLine_Tools"]) && $config["Shipping"]["use_intershipper"] != "Y") {

Replace with:
Code:

if (!empty($active_modules["UPS_OnLine_Tools"]) && $config["Shipping"]["use_intershipper"] != "Y" && !$shipmilitary) {

Find:
Code:

if (!empty($active_modules["UPS_OnLine_Tools"]) && $config["Shipping"]["realtime_shipping"] == "Y" && $config["Shipping"]["use_intershipper"] != "Y") {

Replace with:
Code:

if (!empty($active_modules["UPS_OnLine_Tools"]) && $config["Shipping"]["realtime_shipping"] == "Y" && $config["Shipping"]["use_intershipper"] != "Y" && !$shipmilitary) {

SAVE THIS FILE & UPLOAD.

Open /shipping/myshipper.php

Find:
Code:

function func_shipper ($items, $userinfo, $orig_address, $debug="N", $cart=false) {

Replace with:
Code:

function func_shipper ($items, $userinfo, $orig_address, $debug="N", $cart=false, $shipmilitary=false) {

Find:
Code:

$ups_rates_only = (!empty($active_modules["UPS_OnLine_Tools"]) && $current_carrier == "UPS");

Replace with:
Code:

$ups_rates_only = (!empty($active_modules["UPS_OnLine_Tools"]) && $current_carrier == "UPS" && !$shipmilitary);

Find:
Code:

if ($ups_rates_only) {
  $alt_ship_mods[] = "AP";
 } else {
  $ship_mods[] = "AP";
 }


Replace with:
Code:

//if ($ups_rates_only) {
  $alt_ship_mods[] = "AP";
 //} else {
  $ship_mods[] = "AP";
 //}
 
 if ($shipmilitary){
  x_session_register("current_carrier","USPS");
 }


Find:
Code:

$mods = array("USPS", "CPC", "ARB", "FEDEX");

Replace with:
Code:

$mods = array("USPS", "CPC", "ARB", "FEDEX", "UPS");

Find:
Code:

elseif (!empty($active_modules["UPS_OnLine_Tools"]) && $current_carrier != "UPS") {

Replace with:
Code:

elseif (!empty($active_modules["UPS_OnLine_Tools"]) && $current_carrier != "UPS" && !$shipmilitary) {

SAVE & UPLOAD

Login to your x-cart admin area and under "Management" click on "States" and add the following to the list under (United State of America):
Code:

Code    State
-----    -----
AE        Armed Forces (AE)
AA        Armed Forces Americas (AA)
AP        Armed Forces Pacific (AP)


LAST follow the instructions in post #1 that this user has provided.
http://forum.x-cart.com/showthread.php?t=51646

Once you have done all of this you are DONE. :) :) ENJOY...

mrerotic 03-21-2011 12:43 PM

Re: Select Shipping witrh military APO/ FPO
 
I believe this was all I did to get it working. Make sure you have real-time rates enabled for USPS. This addition will ONLY allow shipping using USPS to all military P.O. Box addresses. All other real-time shipping carriers will not be shown.

X-cart needs to integrate something like this for military shipping.

This has been tested and works in x-cart version 4.2.x. Not sure on any other version.

Let me know and Ill do my best to help if your having issues. :)


All times are GMT -8. The time now is 01:16 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.