Author Topic: USPS domestic military shipping *need conditional written  (Read 2674 times)


  • Jr. Member
  • **
  • Posts: 80
USPS domestic military shipping *need conditional written
« on: February 14, 2011, 04:56:11 am »
URL to reference:

Right now I have FedEx enabled for all domestic shipping and USPS enabled for all international shipping. I want that to continue to working the way it is.

But I would also like to be able to ship to military APO addresses (AA, AE, and AP). I've added those as "states" within the United States in VirtueMart and that part seems to work correctly.

The fix I need is for a conditional to be written so that USPS domestic options (Express or Parcel Post) only show up when a APO shipping address is requested.

Anyone willing to help with this? Right now I'm using lowmips's FedEx V5 module and the USPS V4 module.



  • Global Moderator
  • Full Member
  • *
  • Posts: 1464
Re: USPS domestic military shipping *need conditional written
« Reply #1 on: February 14, 2011, 15:47:51 pm »
I actually made a mod exactly for this purpose some time back.  It was based on the 4.0 version of Chaz's module.  Note the "state" declarations in the $apo_states array.  Modify that to fit your state abbreviations.  The code I added was this, in the "list_rates()" function at the top (just below the global declarations) :

Code: [Select]
$db =& new ps_DB;

/** Read current Configuration ***/

require_once(CLASSPATH ."shipping/".$this->classname.".cfg.php");

$q  = "SELECT * FROM `#__{vm}_user_info`, `#__{vm}_country` WHERE user_info_id='" . $d["ship_to_info_id"]."' AND ( country=country_2_code OR country=country_3_code)";




 * Modified to only show USPS rates if the user has an APO address



$apo_states = array("AA","AE","AP");

$mystate = $db->f('state');

if (!in_array($mystate,$apo_states)) return false;
Visit my website at
View my newsletters Here (sign up for newsletters on the front page of my website)