コード例 #1
0
ファイル: Cart66Usps.php プロジェクト: rbredow/allyzabbacart
 public function getIntlRates($zipOrigin, $countryCode, $value, $pounds = 0, $ounces = 0, $commercial = 'N', $mailType = 'Package', $container = 'VARIABLE', $size = "REGULAR", $machinable = 'true', $width = 10, $length = 15, $height = 10, $girth = 0)
 {
     $rateReq = 'IntlRateV2Request USERID="' . $this->_uspsUsername . '"';
     $countryName = Cart66Common::getCountryName($countryCode);
     $weight = $this->_convertToPoundOunces($pounds);
     $pounds = $weight->pounds;
     $ounces += $weight->ounces;
     $data = array('Revision' => '4', 'Package ID="1"' => array('Pounds' => $pounds, 'Ounces' => $ounces, 'Machinable' => $machinable, 'MailType' => $mailType, 'ValueOfContents' => $value, 'Country' => $countryName, 'Container' => $container, 'Size' => $size, 'Width' => $width, 'Length' => $length, 'Height' => $height, 'Girth' => $girth, 'OriginZip' => $zipOrigin));
     $xml = Cart66Common::arrayToXml($data, $rateReq);
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] USPS Intl rate request xml:\n{$xml}");
     $url = 'http://production.shippingapis.com/ShippingAPI.dll?API=IntlRateV2&Xml=' . urlencode($xml);
     $result = Cart66Common::curl($url);
     // Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] USPS Result:\n" . $result);
     $this->_parseIntlResult($result);
     return $this->_rates;
 }
コード例 #2
0
<?php

$url = trim($url);
$saleAmt = $order->subtotal - $order->discount_amount;
$saleAmt = number_format($saleAmt, 2, '.', '');
$url = str_replace('idev_saleamt=XXX', 'idev_saleamt=' . $saleAmt, $url);
$url = str_replace('idev_ordernum=XXX', 'idev_ordernum=' . $order->trans_id, $url);
$ip = $_SERVER['REMOTE_ADDR'];
if ($order->ip != '') {
    $ip = $order->ip;
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] order ip: {$ip}");
$url .= '&ip_address=' . $ip;
$promotionCode = Cart66Session::get('Cart66PromotionCode');
if (Cart66Setting::getValue('idev_coupon_codes') && $promotionCode) {
    $url .= '&coupon_code=' . $promotionCode;
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Commission notification sent to: {$url}");
Cart66Common::curl($url);