本文整理汇总了PHP中Cart66Common::getCountryName方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::getCountryName方法的具体用法?PHP Cart66Common::getCountryName怎么用?PHP Cart66Common::getCountryName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::getCountryName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIntlRates
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: saveOrder
/**
* Store order in database after successful transaction is processed
*/
public function saveOrder($total, $tax, $transId, $status, $accountId = 0)
{
$address = $this->getShipping();
$b = $this->getBilling();
$p = $this->getPayment();
$orderInfo['ship_first_name'] = $address['firstName'];
$orderInfo['ship_last_name'] = $address['lastName'];
$orderInfo['ship_address'] = $address['address'];
$orderInfo['ship_address2'] = $address['address2'];
$orderInfo['ship_city'] = $address['city'];
$orderInfo['ship_state'] = $address['state'];
$orderInfo['ship_zip'] = $address['zip'];
$orderInfo['ship_country'] = Cart66Common::getCountryName($address['country']);
$orderInfo['bill_first_name'] = $b['firstName'];
$orderInfo['bill_last_name'] = $b['lastName'];
$orderInfo['bill_address'] = $b['address'];
$orderInfo['bill_address2'] = $b['address2'];
$orderInfo['bill_city'] = $b['city'];
$orderInfo['bill_state'] = $b['state'];
$orderInfo['bill_zip'] = $b['zip'];
$orderInfo['bill_country'] = Cart66Common::getCountryName($b['country']);
$orderInfo['phone'] = preg_replace("/[^0-9]/", "", $p['phone']);
$orderInfo['email'] = $p['email'];
$orderInfo['custom_field'] = isset($p['custom-field']) ? $p['custom-field'] : '';
$orderInfo['coupon'] = Cart66Common::getPromoMessage();
$orderInfo['tax'] = $tax;
$orderInfo['shipping'] = Cart66Session::get('Cart66Cart')->getShippingCost();
$orderInfo['subtotal'] = Cart66Session::get('Cart66Cart')->getSubTotal();
$orderInfo['total'] = preg_replace("/[^0-9\\.]/", "", $total);
$orderInfo['trans_id'] = $transId;
$orderInfo['status'] = $status;
$orderInfo['ordered_on'] = date('Y-m-d H:i:s', Cart66Common::localTs());
$orderInfo['shipping_method'] = Cart66Session::get('Cart66Cart')->getShippingMethodName();
$orderInfo['account_id'] = $accountId;
$additional_fields = array();
$custom_payment_fields = apply_filters('cart66_after_payment_form', '');
if (is_array($custom_payment_fields)) {
foreach ($custom_payment_fields as $key => $payment_field) {
if (isset($p[$payment_field['slug']])) {
$additional_fields[$payment_field['section']][$payment_field['slug']] = array('label' => $payment_field['label'], 'value' => $p[$payment_field['slug']]);
}
}
}
$custom_billing_fields = apply_filters('cart66_after_billing_form', '');
if (is_array($custom_billing_fields)) {
foreach ($custom_billing_fields as $key => $billing_field) {
if (isset($b[$billing_field['slug']])) {
$additional_fields[$billing_field['section']][$billing_field['slug']] = array('label' => $billing_field['label'], 'value' => $b[$billing_field['slug']]);
}
}
}
$custom_shipping_fields = apply_filters('cart66_after_shipping_form', '');
if (is_array($custom_shipping_fields)) {
foreach ($custom_shipping_fields as $key => $shipping_field) {
if (isset($address[$shipping_field['slug']])) {
$additional_fields[$shipping_field['section']][$shipping_field['slug']] = array('label' => $shipping_field['label'], 'value' => $address[$shipping_field['slug']]);
}
}
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] additional fields: " . print_r($additional_fields, true));
if (!empty($additional_fields)) {
$orderInfo['additional_fields'] = serialize($additional_fields);
}
$orderInfo = Cart66Common::deNullArrayValues($orderInfo);
$orderId = Cart66Session::get('Cart66Cart')->storeOrder($orderInfo);
return $orderId;
}
示例3: buildOrderDataArray
/**
* Return an array of data matching the rows in the Cart66 orders table for the given order.
*
* @param array The order as retrieved from mijireh
* @return array
*/
public function buildOrderDataArray($cloud_order)
{
$statusOptions = Cart66Common::getOrderStatusOptions();
$status = $statusOptions[0];
$order_token = $cloud_order['order_number'] . $cloud_order['email'];
$ouid = md5($order_token);
$order_info = array('trans_id' => $cloud_order['order_number'], 'authorization' => $cloud_order['authorization'], 'shipping' => $cloud_order['shipping'], 'shipping_method' => $cloud_order['meta_data']['shipping_method'], 'subtotal' => $cloud_order['subtotal'], 'discount_amount' => $cloud_order['discount'], 'tax' => $cloud_order['tax'], 'total' => $cloud_order['total'], 'status' => $status, 'email' => $cloud_order['email'], 'bill_first_name' => $cloud_order['first_name'], 'bill_last_name' => $cloud_order['last_name'], 'ordered_on' => $cloud_order['order_date'], 'ouid' => $ouid, 'coupon' => $cloud_order['meta_data']['coupon'], 'custom_field' => $cloud_order['meta_data']['custom-field']);
if (isset($cloud_order['shipping_address']) && is_array($cloud_order['shipping_address'])) {
$address = $cloud_order['shipping_address'];
$order_info['ship_first_name'] = $address['first_name'];
$order_info['ship_last_name'] = $address['last_name'];
$order_info['ship_address'] = $address['street'];
$order_info['ship_address2'] = $address['apt_suite'];
$order_info['ship_city'] = $address['city'];
$order_info['ship_state'] = $address['state_province'];
$order_info['ship_zip'] = $address['zip_code'];
$order_info['ship_country'] = Cart66Common::getCountryName($address['country']);
$order_info['phone'] = $address['phone'];
}
return $order_info;
}