internal_name = "usps"; $this->name="USPS"; $this->is_external=true; $this->requires_curl=true; $this->needs_zipcode=true; return true; } function getId() { return $this->usps_id; } function setId($id) { $usps_id = $id; return true; } function getName() { return $this->name; } function getInternalName() { return $this->internal_name; } function getForm() { $checked = ''; if(get_option("usps_test_server") == '1'){ $checked = 'checked = "checked"'; } $output="
'.print_r($_POST, true).''); if ($_POST['uspsid'] != '') { update_option('uspsid', $_POST['uspsid']); } if ($_POST['uspspw'] != '') { update_option('uspspw', $_POST['uspspw']); } if($_POST['usps_test_server'] != ''){ update_option('usps_test_server', $_POST['usps_test_server']); }else{ update_option('usps_test_server', ''); } return true; } function getQuote() { global $wpdb, $wpsc_usps_quote; if(isset($wpsc_usps_quote) && (count($wpsc_usps_quote)> 0)) { return $wpsc_usps_quote; } if(isset($_POST['zipcode'])) { $zipcode = $_POST['zipcode']; $_SESSION['wpsc_zipcode'] = $_POST['zipcode']; } else if(isset($_SESSION['wpsc_zipcode'])) { $zipcode = $_SESSION['wpsc_zipcode']; }else{ $zipcode = get_option('base_zipcode'); } $dest = $_SESSION['wpsc_delivery_country']; $weight = wpsc_cart_weight_total(); $pound = floor($weight); $ounce = ($weight-$pound)*16; $machinable = 'true'; if (($ounce > 13) || ($pound > 1)) { define('MODULE_SHIPPING_USPS_TYPES', "PRIORITY, EXPRESS, PARCEL POST"); } else { define('MODULE_SHIPPING_USPS_TYPES', "FIRST CLASS, PRIORITY, EXPRESS, PARCEL POST"); } if (($dest =='US') && ('US'== get_option('base_country'))) { $request = '
'.print_r($body, true).''.$url); curl_close($ch); //exit($body); $rates=array(); $response=array(); while (true) { if ($start = strpos($body, '
'.print_r($uspsQuote,true).''); return $uspsQuote; } function get_item_shipping() { } } $usps = new usps(); $wpsc_shipping_modules[$usps->getInternalName()] = $usps; ?>