本文整理汇总了PHP中wpsc_get_state_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_get_state_by_id函数的具体用法?PHP wpsc_get_state_by_id怎么用?PHP wpsc_get_state_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_get_state_by_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_gateway_data
public function get_gateway_data()
{
if (!($this->gateway_data = wp_cache_get($this->log_id, 'wpsc_checkout_form_gateway_data'))) {
$map = array('firstname' => 'first_name', 'lastname' => 'last_name', 'address' => 'street', 'city' => 'city', 'state' => 'state', 'country' => 'country', 'postcode' => 'zip', 'phone' => 'phone');
foreach (array('shipping', 'billing') as $type) {
$data_key = "{$type}_address";
$this->gateway_data[$data_key] = array();
foreach ($map as $key => $new_key) {
$key = $type . $key;
if (isset($this->data[$key])) {
$value = $this->data[$key];
if ($new_key == 'state' && is_numeric($value)) {
$value = wpsc_get_state_by_id($value, 'code');
}
$this->gateway_data[$data_key][$new_key] = $value;
}
}
$name = isset($this->gateway_data[$data_key]['first_name']) ? $this->gateway_data[$data_key]['first_name'] . ' ' : '';
$name .= isset($this->gateway_data[$data_key]['last_name']) ? $this->gateway_data[$data_key]['last_name'] : '';
$this->gateway_data[$data_key]['name'] = trim($name);
}
wp_cache_set($this->log_id, $this->gateway_data, 'wpsc_checkout_form_gateway_data');
}
return apply_filters('wpsc_checkout_form_gateway_data', $this->gateway_data, $this->log_id);
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:25,代码来源:checkout-form-data.class.php
示例2: collate_data
/**
* collate_data method, collate purchase data, like addresses, like country
* @access public
*/
function collate_data()
{
global $wpdb;
// get purchase data, regardless of being fed the ID or the sessionid
if ($this->purchase_id > 0) {
$purchase_id =& $this->purchase_id;
$purchase_logs = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = {$purchase_id} LIMIT 1", ARRAY_A);
} else {
if ($this->session_id != null) {
$purchase_logs = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid` = {$this->session_id} LIMIT 1", ARRAY_A);
$this->purchase_id = $purchase_logs['id'];
$purchase_id =& $this->purchase_id;
}
}
$email_address = $wpdb->get_var("SELECT `value` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` AS `form_field` INNER JOIN `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` AS `collected_data` ON `form_field`.`id` = `collected_data`.`form_id` WHERE `form_field`.`type` IN ( 'email' ) AND `collected_data`.`log_id` IN ( '{$purchase_id}' )");
$currency_code = $wpdb->get_var("SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . get_option('currency_type') . "' LIMIT 1");
$collected_form_data = $wpdb->get_results("SELECT `data_names`.`id`, `data_names`.`unique_name`, `collected_data`.`value` FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` AS `collected_data` JOIN `" . WPSC_TABLE_CHECKOUT_FORMS . "` AS `data_names` ON `collected_data`.`form_id` = `data_names`.`id` WHERE `log_id` = '" . $purchase_id . "'", ARRAY_A);
$address_keys = array('billing' => array('first_name' => 'billingfirstname', 'last_name' => 'billinglastname', 'address' => 'billingaddress', 'city' => 'billingcity', 'state' => 'billingstate', 'country' => 'billingcountry', 'post_code' => 'billingpostcode'), 'shipping' => array('first_name' => 'shippingfirstname', 'last_name' => 'shippinglastname', 'address' => 'shippingaddress', 'city' => 'shippingcity', 'state' => 'shippingstate', 'country' => 'shippingcountry', 'post_code' => 'shippingpostcode'));
$address_data = array('billing' => array(), 'shipping' => array());
foreach ((array) $collected_form_data as $collected_form_row) {
$address_data_set = 'billing';
$address_key = array_search($collected_form_row['unique_name'], $address_keys['billing']);
if ($address_key == null) {
$address_data_set = 'shipping';
// exit('<pre>'.print_r($collected_form_row,true).'</pre>');
$address_key = array_search($collected_form_row['unique_name'], $address_keys['shipping']);
}
if ($address_key == null) {
continue;
}
if ($collected_form_row['unique_name'] == 'billingcountry' || $collected_form_row['unique_name'] == 'shippingcountry') {
$country = maybe_unserialize($collected_form_row['value']);
$address_data[$address_data_set][$address_key] = $country[0];
} elseif ($collected_form_row['unique_name'] == 'shippingstate') {
$address_data[$address_data_set][$address_key] = wpsc_get_state_by_id($collected_form_row['value'], 'code');
} else {
$address_data[$address_data_set][$address_key] = $collected_form_row['value'];
}
}
// exit('<pre>'.print_r($address_data,true).'</pre>');
if (count($address_data['shipping']) < 1) {
$address_data['shipping'] = $address_data['billing'];
}
$this->cart_data = array('software_name' => 'WP e-Commerce/' . WPSC_PRESENTABLE_VERSION . '', 'store_location' => get_option('base_country'), 'store_currency' => $currency_code, 'is_subscription' => false, 'has_discounts' => false, 'notification_url' => add_query_arg('wpsc_action', 'gateway_notification', get_option('siteurl') . "/index.php"), 'transaction_results_url' => get_option('transact_url'), 'shopping_cart_url' => get_option('shopping_cart_url'), 'products_page_url' => get_option('product_list_url'), 'base_shipping' => $purchase_logs['base_shipping'], 'total_price' => $purchase_logs['totalprice'], 'session_id' => $purchase_logs['sessionid'], 'transaction_id' => $purchase_logs['transaction_id'], 'email_address' => $email_address, 'billing_address' => $address_data['billing'], 'shipping_address' => $address_data['shipping']);
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:49,代码来源:merchant.class.php
示例3: get_shipping_xml
/**
* Builds XML API request for Shipping Rates API
* *
* @uses apply_filters - filters XML on return
* @todo Get ZIP as transient when #437 is complete
* @since 3.8.9
* @return string $xml
*/
public static function get_shipping_xml()
{
global $wpsc_cart;
$zip = wpsc_get_customer_meta('shipping_zip');
$state = wpsc_get_state_by_id($wpsc_cart->delivery_region, 'code');
$country = $wpsc_cart->delivery_country;
$products = $wpsc_cart->cart_items;
$products_xml = '';
$num = 0;
if (count($products)) {
foreach ($products as $product) {
if (!$product->uses_shipping) {
continue;
}
$products_xml .= '<Item num="' . $num . '">';
$products_xml .= '<Code>' . wpsc_esc_xml($product->sku) . '</Code>';
$products_xml .= '<Quantity>' . wpsc_esc_xml($product->quantity) . '</Quantity>';
$products_xml .= '</Item>';
$num++;
}
}
if (empty($products_xml)) {
return '';
}
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= '<RateRequest>';
$xml .= '<Username>' . wpsc_esc_xml(self::$email) . '</Username>';
$xml .= '<Password>' . wpsc_esc_xml(self::$passwd) . '</Password>';
$xml .= '<Order>';
$xml .= '<AddressInfo type="ship">';
$xml .= '<State>' . wpsc_esc_xml($state) . '</State>';
$xml .= '<Country>' . wpsc_esc_xml($country) . '</Country>';
$xml .= '<Zip>' . wpsc_esc_xml($zip) . '</Zip>';
$xml .= '</AddressInfo>';
$xml .= $products_xml;
$xml .= '</Order>';
$xml .= '</RateRequest>';
return apply_filters('get_shipping_xml', $xml);
}
开发者ID:ashik968,项目名称:digiplot,代码行数:47,代码来源:shipwire_functions.php
示例4: transaction_results
//.........这里部分代码省略.........
$report = str_replace('%total_price%', $total_price_email, $report);
$report = str_replace('%shop_name%', get_option('blogname'), $report);
$report = str_replace('%find_us%', $purchase_log['find_us'], $report);
$message_html = str_replace('%product_list%', $product_list_html, $message_html);
$message_html = str_replace('%total_shipping%', $total_shipping_html, $message_html);
$message_html = str_replace('%total_price%', $total_price_email, $message_html);
$message_html = str_replace('%shop_name%', get_option('blogname'), $message_html);
$message_html = str_replace('%find_us%', $purchase_log['find_us'], $message_html);
//$message_html = str_replace('%order_status%',get_option('blogname'),$message_html);
if ($email != '' && $purchase_log['email_sent'] != 1) {
add_filter('wp_mail_from', 'wpsc_replace_reply_address', 0);
add_filter('wp_mail_from_name', 'wpsc_replace_reply_name', 0);
if ($purchase_log['processed'] < 2) {
$payment_instructions = strip_tags(get_option('payment_instructions'));
$message = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions . "\n\r" . $message;
wp_mail($email, __('Order Pending: Payment Required', 'wpsc'), $message);
} else {
wp_mail($email, __('Purchase Receipt', 'wpsc'), $message);
}
}
remove_filter('wp_mail_from_name', 'wpsc_replace_reply_name');
remove_filter('wp_mail_from', 'wpsc_replace_reply_address');
$report_user = __('Customer Details', 'wpsc') . "\n\r";
$report_user .= "Billing Info \n\r";
foreach ((array) $thepurchlogitem->userinfo as $userinfo) {
if ($userinfo['unique_name'] != 'billingcountry') {
$report_user .= "" . $userinfo['name'] . ": " . $userinfo['value'] . "\n";
} else {
$userinfo['value'] = maybe_unserialize($userinfo['value']);
if (is_array($userinfo['value'])) {
if (!empty($userinfo['value'][1]) && !is_numeric($userinfo['value'][1])) {
$report_user .= "State: " . $userinfo['value'][1] . "\n";
} elseif (is_numeric($userinfo['value'][1])) {
$report_user .= "State: " . wpsc_get_state_by_id($userinfo['value'][1], 'name') . "\n";
}
if (!empty($userinfo['value'][0])) {
$report_user .= "Country: " . $userinfo['value'][0] . "\n";
}
} else {
$report_user .= "" . $userinfo['name'] . ": " . $userinfo['value'] . "\n";
}
}
}
$report_user .= "\n\rShipping Info \n\r";
foreach ((array) $thepurchlogitem->shippinginfo as $userinfo) {
if ($userinfo['unique_name'] != 'shippingcountry' && $userinfo['unique_name'] != 'shippingstate') {
$report_user .= "" . $userinfo['name'] . ": " . $userinfo['value'] . "\n";
} elseif ($userinfo['unique_name'] == 'shippingcountry') {
$userinfo['value'] = maybe_unserialize($userinfo['value']);
if (is_array($userinfo['value'])) {
if (!empty($userinfo['value'][1]) && !is_numeric($userinfo['value'][1])) {
$report_user .= "State: " . $userinfo['value'][1] . "\n";
} elseif (is_numeric($userinfo['value'][1])) {
$report_user .= "State: " . wpsc_get_state_by_id($userinfo['value'][1], 'name') . "\n";
}
if (!empty($userinfo['value'][0])) {
$report_user .= "Country: " . $userinfo['value'][0] . "\n";
}
} else {
$report_user .= "" . $userinfo['name'] . ": " . $userinfo['value'] . "\n";
}
} elseif ($userinfo['unique_name'] == 'shippingstate') {
if (!empty($userinfo['value']) && !is_numeric($userinfo['value'])) {
$report_user .= "" . $userinfo['name'] . ": " . $userinfo['value'] . "\n";
} elseif (is_numeric($userinfo['value'])) {
$report_user .= "State: " . wpsc_get_state_by_id($userinfo['value'], 'name') . "\n";
开发者ID:BGCX261,项目名称:zombie-craft-svn-to-git,代码行数:67,代码来源:transaction_result_functions.php
示例5: add_pushes
public function add_pushes($session_id)
{
global $wpdb;
$purchase = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= %s LIMIT 1", $session_id));
$purchase_id = $purchase->id;
$output = '';
$city = $wpdb->get_var($wpdb->prepare("\n\t\t\t\t\t\tSELECT tf.value FROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " tf\n\t\t\t\t\t\tLEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf\n\t\t\t\t\t\tON cf.id = tf.form_id\n\t\t\t\t\t\tWHERE cf.unique_name = 'billingcity'\n\t\t\t\t\t\tAND log_id = %d", $purchase_id));
$state = $wpdb->get_var($wpdb->prepare("\n\t\t\t\t\t\tSELECT tf.value\n\t\t\t\t\t\tFROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " tf\n\t\t\t\t\t\tLEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf\n\t\t\t\t\t\tON cf.id = tf.form_id\n\t\t\t\t\t\tWHERE cf.unique_name = 'billingstate'\n\t\t\t\t\t\tAND log_id = %d", $purchase_id));
$country = $wpdb->get_var($wpdb->prepare("\n\t\t\t\t\t\tSELECT tf.value\n\t\t\t\t\t\tFROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " tf\n\t\t\t\t\t\tLEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf\n\t\t\t\t\t\tON cf.id = tf.form_id\n\t\t\t\t\t\tWHERE cf.unique_name = 'billingcountry'\n\t\t\t\t\t\tAND log_id = %d", $purchase_id));
$city = !empty($city) ? $city : '';
$state = !empty($state) ? wpsc_get_state_by_id($state, 'name') : '';
$country = !empty($country) ? $country : '';
$cart_items = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid = %d", $purchase_id), ARRAY_A);
$total_shipping = wpsc_get_total_shipping($purchase_id);
$total_tax = $total_price = 0;
foreach ($cart_items as $item) {
$total_tax += $item['tax_charged'];
$total_price += $item['price'];
}
if ($this->is_theme_tracking || $this->advanced_code) {
$output .= "<script type='text/javascript'>\n\r";
}
add_filter('wpsc_toggle_display_currency_code', array($this, 'remove_currency_and_html'));
$output .= "\n\t\t\t_gaq.push(['_addTrans',\n\t\t\t'" . $purchase_id . "', // order ID - required\n\t\t\t'" . wp_specialchars_decode($this->get_site_name()) . "', // affiliation or store name\n\t\t\t'" . number_format($total_price, 2, '.', '') . "', // total - required\n\t\t\t'" . wpsc_currency_display($total_tax) . "', // tax\n\t\t\t'" . wpsc_currency_display($total_shipping) . "', // shipping\n\t\t\t'" . wp_specialchars_decode($city) . "', // city\n\t\t\t'" . wp_specialchars_decode($state) . "', // state or province\n\t\t\t'" . wp_specialchars_decode($country) . "' // country\n \t\t]);\n\r";
remove_filter('wpsc_toggle_display_currency_code', array($this, 'remove_currency_and_html'));
foreach ($cart_items as $item) {
$category = wp_get_object_terms($item['prodid'], 'wpsc_product_category', array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'all_with_object_id'));
$item['sku'] = get_post_meta($item['prodid'], '_wpsc_sku', true);
if ($category) {
$item['category'] = $category[0]->name;
} else {
$item['category'] = '';
}
$item = array_map('wp_specialchars_decode', $item);
$output .= "_gaq.push(['_addItem'," . "'" . $purchase_id . "'," . "'" . $item['sku'] . "'," . "'" . $item['name'] . "'," . "'" . $item['category'] . "'," . "'" . $item['price'] . "'," . "'" . $item['quantity'] . "']);\n\r";
// Item Quantity
}
$output .= "_gaq.push(['_trackTrans']);\n\r";
if ($this->is_theme_tracking || $this->advanced_code) {
$output .= "</script>\n\r";
}
return $output;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:43,代码来源:google-analytics.class.php
示例6: wpsc_user_purchases
//.........这里部分代码省略.........
echo " <td class='details_total'>";
$endtotal += $price;
echo wpsc_currency_display($shipping + $price, array('display_as_html' => false));
echo " </td>";
echo '</tr>';
}
echo "<tr>";
echo " <td>";
echo " </td>";
echo " <td>";
echo " </td>";
echo " <td>";
echo " <td>";
echo " </td>";
echo " </td>";
echo " <td class='details_totals_labels'>";
echo "<strong>" . __('Total Shipping', 'wpsc') . ":</strong><br />";
echo "<strong>" . __('Total Tax', 'wpsc') . ":</strong><br />";
echo "<strong>" . __('Final Total', 'wpsc') . ":</strong>";
echo " </td>";
echo " <td class='details_totals_labels'>";
$total_shipping += $purchase['base_shipping'];
$endtotal += $total_shipping;
$endtotal += $purchase['wpec_taxes_total'];
echo wpsc_currency_display($total_shipping, array('display_as_html' => false)) . "<br />";
if ($gsttotal) {
//if false then must be exclusive.. doesnt seem too reliable needs more testing
echo wpsc_currency_display($gsttotal, array('display_as_html' => false)) . "<br />";
} else {
echo wpsc_currency_display($purchase['wpec_taxes_total'], array('display_as_html' => false)) . "<br />";
}
echo wpsc_currency_display($endtotal, array('display_as_html' => false));
echo " </td>";
echo '</tr>';
echo "</table>";
echo "<br />";
echo "<strong>" . __('Customer Details', 'wpsc') . ":</strong>";
echo "<table class='customer_details'>";
$usersql = $wpdb->prepare("SELECT `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "`.value, `" . WPSC_TABLE_CHECKOUT_FORMS . "`.* FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` LEFT JOIN `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` ON `" . WPSC_TABLE_CHECKOUT_FORMS . "`.id = `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "`.`form_id` WHERE `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "`.log_id = %d OR `" . WPSC_TABLE_CHECKOUT_FORMS . "`.type = 'heading' ORDER BY `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`checkout_set`, `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`checkout_order`", $purchase['id']);
$formfields = $wpdb->get_results($usersql, ARRAY_A);
if (!empty($formfields)) {
foreach ((array) $formfields as $form_field) {
// If its a heading display the Name otherwise continue on
if ('heading' == $form_field['type']) {
echo " <tr><td colspan='2'>" . esc_html($form_field['name']) . ":</td></tr>";
continue;
}
switch ($form_field['unique_name']) {
case 'shippingcountry':
case 'billingcountry':
$country = maybe_unserialize($form_field['value']);
if (is_array($country)) {
$country = $country[0];
} else {
$country = $form_field['value'];
}
echo " <tr><td>" . esc_html($form_field['name']) . ":</td><td>" . esc_html($country) . "</td></tr>";
break;
case 'billingstate':
case 'shippingstate':
if (is_numeric($form_field['value'])) {
$state = wpsc_get_state_by_id($form_field['value'], 'name');
} else {
$state = $form_field['value'];
}
echo " <tr><td>" . esc_html($form_field['name']) . ":</td><td>" . esc_html($state) . "</td></tr>";
break;
default:
echo " <tr><td>" . esc_html($form_field['name']) . ":</td><td>" . esc_html($form_field['value']) . "</td></tr>";
}
}
}
$payment_gateway_names = '';
$payment_gateway_names = get_option('payment_gateway_names');
foreach ((array) $payment_gateway_names as $gatewayname) {
//if the gateway has a custom name
if (!empty($gatewayname)) {
$display_name = $payment_gateway_names[$purchase_log[0]['gateway']];
} else {
//if not fall back on default name
foreach ((array) $nzshpcrt_gateways as $gateway) {
if ($gateway['internalname'] == $purchase['gateway']) {
$display_name = $gateway['name'];
}
}
}
}
echo " <tr><td>" . __('Payment Method', 'wpsc') . ":</td><td>" . $display_name . "</td></tr>";
echo " <tr><td>" . __('Purchase #', 'wpsc') . ":</td><td>" . $purchase['id'] . "</td></tr>";
if ($purchase['transactid'] != '') {
echo " <tr><td>" . __('Transaction Id', 'wpsc') . ":</td><td>" . $purchase['transactid'] . "</td></tr>";
}
echo "</table>";
}
echo " </div>\n\r";
echo " </div>\n\r";
echo " </td>\n\r";
echo "</tr>\n\r";
}
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:101,代码来源:wpsc-user_log_functions.php
示例7: gateway_sagepay
function gateway_sagepay($seperator, $sessionid)
{
global $wpdb;
// Get Purchase Log
$purchase_log_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= " . $sessionid . " LIMIT 1";
$purchase_log = $wpdb->get_results($purchase_log_sql, ARRAY_A);
// Get Cart Contents
$cart_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='" . $purchase_log[0]['id'] . "'";
$cart = $wpdb->get_results($cart_sql, ARRAY_A);
// exit('<pre>' . print_r($cart, true) . '</pre>');
foreach ((array) $cart as $item) {
$product_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `id`='" . $item['prodid'] . "' LIMIT 1", ARRAY_A);
$product_data = $product_data[0];
}
//Set Post Data
$data['VendorTxCode'] = $sessionid;
$data['Amount'] = number_format($purchase_log[0]['totalprice'], 2, '.', '');
$data['Currency'] = get_option('protx_cur');
$data['Description'] = get_bloginfo('name') . " wpEcommerce";
$transact_url = get_option('transact_url');
$site_url = get_option('shopping_cart_url');
$data['SuccessURL'] = $transact_url . $seperator . "protx=success";
$data['FailureURL'] = $site_url;
// $data['FailureURL'] = urlencode($transact_url);
if ($_POST['collected_data'][get_option('protx_form_last_name')] != '') {
$data['BillingSurname'] = urlencode($_POST['collected_data'][get_option('protx_form_last_name')]);
}
if ($_POST['collected_data'][get_option('protx_form_post_code')] != '') {
$data['BillingPostCode'] = $_POST['collected_data'][get_option('protx_form_post_code')];
}
if ($_POST['collected_data'][get_option('protx_form_address')] != '') {
$data['BillingAddress1'] = $_POST['collected_data'][get_option('protx_form_address')];
}
if ($_POST['collected_data'][get_option('protx_form_city')] != '') {
$data['BillingCity'] = $_POST['collected_data'][get_option('protx_form_city')];
}
if ($_POST['collected_data'][get_option('protx_form_first_name')] != '') {
$data['BillingFirstnames'] = urlencode($_POST['collected_data'][get_option('protx_form_first_name')]);
}
if ($_POST['collected_data'][get_option('protx_form_country')] != '') {
$result = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE isocode='" . $_POST['collected_data'][get_option('protx_form_country')][0] . "'", ARRAY_A);
if ($result[0]['isocode'] == 'UK') {
$data['BillingCountry'] = 'GB';
} else {
$data['BillingCountry'] = $result[0]['isocode'];
}
}
//billingstate
if (is_numeric($_POST['collected_data'][get_option('protx_form_country')][1])) {
$data['BillingState'] = wpsc_get_state_by_id($_POST['collected_data'][get_option('protx_form_country')][1], 'code');
}
if ($_POST['collected_data'][get_option('protx_form_last_name')] != '') {
$data['DeliverySurname'] = urlencode($_POST['collected_data'][get_option('protx_form_last_name')]);
}
if ($_POST['collected_data'][get_option('protx_form_post_code')] != '') {
$data['DeliveryPostCode'] = $_POST['collected_data'][get_option('protx_form_post_code')];
}
if ($_POST['collected_data'][get_option('protx_form_address')] != '') {
$data['DeliveryAddress1'] = $_POST['collected_data'][get_option('protx_form_address')];
}
if ($_POST['collected_data'][get_option('protx_form_city')] != '') {
$data['DeliveryCity'] = $_POST['collected_data'][get_option('protx_form_city')];
}
if ($_POST['collected_data'][get_option('protx_form_first_name')] != '') {
$data['DeliveryFirstnames'] = urlencode($_POST['collected_data'][get_option('protx_form_first_name')]);
}
if (preg_match("/^[a-zA-Z]{2}\$/", $_SESSION['wpsc_delivery_country'])) {
$result = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE isocode='" . $_SESSION['wpsc_delivery_country'] . "'", ARRAY_A);
if ($result[0]['isocode'] == 'UK') {
$data['DeliveryCountry'] = 'GB';
} else {
$data['DeliveryCountry'] = $result[0]['isocode'];
}
}
if ($data['DeliveryCountry'] == '') {
$data['DeliveryCountry'] = 'GB';
}
//billingstate
if (is_numeric($_SESSION['wpsc_delivery_region'])) {
$data['DeliveryState'] = wpsc_get_state_by_id($_SESSION['wpsc_delivery_region'], 'code');
}
// Start Create Basket Data
$basket_productprice_total = 0;
$basket_rows = count($cart) + 1;
if (!empty($purchase_log[0]['discount_value'])) {
$basket_rows += 1;
}
$data['Basket'] = $basket_rows . ':';
foreach ((array) $cart as $item) {
$product_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `id`='" . $item['prodid'] . "' LIMIT 1", ARRAY_A);
$product_data = $product_data[0];
$basket_productprice_total += $item['price'] * $item['quantity'];
$data['Basket'] .= preg_replace('/[^a-z0-9]/i', '_', $product_data['name']) . ":" . $item['quantity'] . ":" . $item['price'] . ":---:" . $item['price'] * $item['quantity'] . ":" . $item['price'] * $item['quantity'] . ":";
}
$basket_delivery = $data['Amount'] - $basket_productprice_total;
if (!empty($purchase_log[0]['discount_value'])) {
$basket_delivery += $purchase_log[0]['discount_value'];
}
$data['Basket'] .= "Delivery:---:---:---:---:" . $basket_delivery;
if (!empty($purchase_log[0]['discount_value'])) {
//.........这里部分代码省略.........
开发者ID:hornet9,项目名称:Morato,代码行数:101,代码来源:protx.php
示例8: wpsc_packing_slip
function wpsc_packing_slip($purchase_id)
{
global $wpdb, $purchlogitem, $wpsc_cart, $purchlog;
if (isset($_REQUEST['purchaselog_id'])) {
$purchlogitem = new wpsc_purchaselogs_items((int) $_REQUEST['purchaselog_id']);
}
$purch_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`='" . $purchase_id . "'";
$purch_data = $wpdb->get_row($purch_sql, ARRAY_A);
//echo "<p style='padding-left: 5px;'><strong>".__('Date', 'wpsc')."</strong>:".date("jS M Y", $purch_data['date'])."</p>";
$cartsql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase_id . "";
$cart_log = $wpdb->get_results($cartsql, ARRAY_A);
$j = 0;
if ($cart_log != null) {
echo "<div class='packing_slip'>\n\r";
echo apply_filters('wpsc_packing_slip_header', '<h2>' . __('Packing Slip', 'wpsc') . "</h2>\n\r");
echo "<strong>" . __('Order', 'wpsc') . " #</strong> " . $purchase_id . "<br /><br />\n\r";
echo "<table>\n\r";
/*
$form_sql = "SELECT * FROM `".WPSC_TABLE_SUBMITED_FORM_DATA."` WHERE `log_id` = '".(int)$purchase_id."'";
$input_data = $wpdb->get_results($form_sql,ARRAY_A);
*/
echo "<tr class='heading'><td colspan='2'><strong>Billing Info</strong></td></tr>";
foreach ((array) $purchlogitem->userinfo as $userinfo) {
if ($userinfo['unique_name'] != 'billingcountry') {
echo "<tr><td>" . $userinfo['name'] . ": </td><td>" . $userinfo['value'] . "</td></tr>";
} else {
$userinfo['value'] = maybe_unserialize($userinfo['value']);
if (is_array($userinfo['value'])) {
if (!empty($userinfo['value'][1]) && !is_numeric($userinfo['value'][1])) {
echo "<tr><td>State: </td><td>" . $userinfo['value'][1] . "</td></tr>";
} elseif (is_numeric($userinfo['value'][1])) {
echo "<tr><td>State: </td><td>" . wpsc_get_state_by_id($userinfo['value'][1], 'name') . "</td></tr>";
}
if (!empty($userinfo['value'][0])) {
echo "<tr><td>Country: </td><td>" . $userinfo['value'][0] . "</td></tr>";
}
} else {
echo "<tr><td>" . $userinfo['name'] . ": </td><td>" . $userinfo['value'] . "</td></tr>";
}
}
}
echo "<tr class='heading'><td colspan='2'><strong>Shipping Info</strong></td></tr>";
foreach ((array) $purchlogitem->shippinginfo as $userinfo) {
if ($userinfo['unique_name'] != 'shippingcountry' && $userinfo['unique_name'] != 'shippingstate') {
echo "<tr><td>" . $userinfo['name'] . ": </td><td>" . $userinfo['value'] . "</td></tr>";
} elseif ($userinfo['unique_name'] == 'shippingcountry') {
$userinfo['value'] = maybe_unserialize($userinfo['value']);
if (is_array($userinfo['value'])) {
if (!empty($userinfo['value'][1]) && !is_numeric($userinfo['value'][1])) {
echo "<tr><td>State: </td><td>" . $userinfo['value'][1] . "</td></tr>";
} elseif (is_numeric($userinfo['value'][1])) {
echo "<tr><td>State: </td><td>" . wpsc_get_state_by_id($userinfo['value'][1], 'name') . "</td></tr>";
}
if (!empty($userinfo['value'][0])) {
echo "<tr><td>Country: </td><td>" . $userinfo['value'][0] . "</td></tr>";
}
} else {
echo "<tr><td>" . $userinfo['name'] . ": </td><td>" . $userinfo['value'] . "</td></tr>";
}
} elseif ($userinfo['unique_name'] == 'shippingstate') {
if (!empty($userinfo['value']) && !is_numeric($userinfo['value'])) {
echo "<tr><td>" . $userinfo['name'] . ": </td><td>" . $userinfo['value'] . "</td</tr>>";
} elseif (is_numeric($userinfo['value'])) {
echo "<tr><td>State: </td><td>" . wpsc_get_state_by_id($userinfo['value'], 'name') . "</td></tr>";
}
}
}
// echo('<pre>'.print_r($purchlogitem,true).'</pre>');
/*
foreach($input_data as $input_row) {
$rekeyed_input[$input_row['form_id']] = $input_row;
}
if($input_data != null) {
$form_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1'",ARRAY_A);
// exit('<pre>'.print_r($purch_data, true).'</pre>');
foreach($form_data as $form_field) {
switch($form_field['type']) {
case 'country':
$delivery_region_count = $wpdb->get_var("SELECT COUNT(`regions`.`id`) FROM `".WPSC_TABLE_REGION_TAX."` AS `regions` INNER JOIN `".WPSC_TABLE_CURRENCY_LIST."` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('".$wpdb->escape( $purch_data['billing_country'])."')");
if(is_numeric($purch_data['billing_region']) && ($delivery_region_count > 0)) {
echo " <tr><td>".__('State', 'wpsc').":</td><td>".wpsc_get_region($purch_data['billing_region'])."</td></tr>\n\r";
}
echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".wpsc_get_country($purch_data['billing_country'])."</td></tr>\n\r";
break;
case 'delivery_country':
echo " <tr><td>".$form_field['name'].":</td><td>".wpsc_get_country($purch_data['shipping_country'])."</td></tr>\n\r";
break;
case 'heading':
echo " <tr><td colspan='2'><strong>".wp_kses($form_field['name'], array()).":</strong></td></tr>\n\r";
break;
default:
if($form_field['unique_name'] == 'shippingstate'){
//.........这里部分代码省略.........
开发者ID:kasima,项目名称:wp-e-commerce-ezp,代码行数:101,代码来源:admin-form-functions.php
示例9: transaction_results
//.........这里部分代码省略.........
', 'wpsc'), wpsc_currency_display($total_shipping));
}
$total_price_html .= sprintf(__('Total: %s
', 'wpsc'), wpsc_currency_display($total));
$report_id = sprintf(__("Purchase # %s\n", 'wpsc'), $purchase_log['id']);
if (isset($_GET['ti'])) {
$message .= "\n\r" . __('Your Transaction ID', 'wpsc') . ": " . $_GET['ti'];
$message_html .= "\n\r" . __('Your Transaction ID', 'wpsc') . ": " . $_GET['ti'];
$report .= "\n\r" . __('Transaction ID', 'wpsc') . ": " . $_GET['ti'];
}
$message = apply_filters('wpsc_transaction_result_message', $message);
$message = str_replace('%purchase_id%', $report_id, $message);
$message = str_replace('%product_list%', $product_list, $message);
$message = str_replace('%total_tax%', $total_tax, $message);
$message = str_replace('%total_shipping%', $total_shipping_email, $message);
$message = str_replace('%total_price%', $total_price_email, $message);
$message = str_replace('%shop_name%', get_option('blogname'), $message);
$message = str_replace('%find_us%', $purchase_log['find_us'], $message);
$report = apply_filters('wpsc_transaction_result_report', $report);
$report = str_replace('%purchase_id%', $report_id, $report);
$report = str_replace('%product_list%', $report_product_list, $report);
$report = str_replace('%total_tax%', $total_tax, $report);
$report = str_replace('%total_shipping%', $total_shipping_email, $report);
$report = str_replace('%total_price%', $total_price_email, $report);
$report = str_replace('%shop_name%', get_option('blogname'), $report);
$report = str_replace('%find_us%', $purchase_log['find_us'], $report);
$message_html = apply_filters('wpsc_transaction_result_message_html', $message_html);
$message_html = str_replace('%purchase_id%', $report_id, $message_html);
$message_html = str_replace('%product_list%', $product_list_html, $message_html);
$message_html = str_replace('%total_tax%', $total_tax_html, $message_html);
$message_html = str_replace('%total_shipping%', $total_shipping_html, $message_html);
$message_html = str_replace('%total_price%', $total_price_html, $message_html);
$message_html = str_replace('%shop_name%', get_option('blogname'), $message_html);
$message_html = str_replace('%find_us%', $purchase_log['find_us'], $message_html);
if (!empty($email)) {
add_filter('wp_mail_from', 'wpsc_replace_reply_address', 0);
add_filter('wp_mail_from_name', 'wpsc_replace_reply_name', 0);
$message = apply_filters('wpsc_email_message', $message, $report_id, $product_list, $total_tax, $total_shipping_email, $total_price_email);
if (!$is_transaction) {
$payment_instructions = strip_tags(stripslashes(get_option('payment_instructions')));
if (!empty($payment_instructions)) {
$payment_instructions .= "\n\r";
}
$message = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions . $message;
$message_html = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions . $message_html;
// prevent email duplicates
if (!get_transient("{$sessionid}_pending_email_sent") || $resend_email) {
wp_mail($email, __('Order Pending: Payment Required', 'wpsc'), $message);
set_transient("{$sessionid}_pending_email_sent", true, 60 * 60 * 12);
}
} elseif (!get_transient("{$sessionid}_receipt_email_sent") || $resend_email) {
wp_mail($email, __('Purchase Receipt', 'wpsc'), $message);
set_transient("{$sessionid}_receipt_email_sent", true, 60 * 60 * 12);
}
}
remove_filter('wp_mail_from_name', 'wpsc_replace_reply_name');
remove_filter('wp_mail_from', 'wpsc_replace_reply_address');
$report_user = __('Customer Details', 'wpsc') . "\n\r";
$form_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` = %d", $purchase_log['id']);
$form_data = $wpdb->get_results($form_sql, ARRAY_A);
if ($form_data != null) {
foreach ($form_data as $form_field) {
$form_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `id` = %d LIMIT 1", $form_field['form_id']), ARRAY_A);
switch ($form_data['type']) {
case "country":
$country_code = $form_field['value'];
$report_user .= $form_data['name'] . ": " . wpsc_get_country($country_code) . "\n";
//check if country has a state then display if it does.
$country_data = wpsc_country_has_state($country_code);
if ($country_data['has_regions'] == 1) {
$report_user .= __('Billing State', 'wpsc') . ": " . wpsc_get_region($purchase_log['billing_region']) . "\n";
}
break;
case "delivery_country":
$report_user .= $form_data['name'] . ": " . wpsc_get_country($form_field['value']) . "\n";
break;
default:
if ($form_data['name'] == 'State' && is_numeric($form_field['value'])) {
$report_user .= __('Delivery State', 'wpsc') . ": " . wpsc_get_state_by_id($form_field['value'], 'name') . "\n";
} else {
$report_user .= wp_kses($form_data['name'], array()) . ": " . $form_field['value'] . "\n";
}
break;
}
}
}
$report_user .= "\n\r";
$report = $report_id . $report_user . $report;
//echo '======REPORT======<br />'.$report.'<br />';
//echo '======EMAIL======<br />'.$message.'<br />';
if (get_option('purch_log_email') != null && $purchase_log['email_sent'] != 1) {
wp_mail(get_option('purch_log_email'), __('Purchase Report', 'wpsc'), $report);
$wpdb->update(WPSC_TABLE_PURCHASE_LOGS, array('email_sent' => '1'), array('sessionid' => $sessionid));
}
/// Adjust stock and empty the cart
$wpsc_cart->submit_stock_claims($purchase_log['id']);
$wpsc_cart->empty_cart();
}
}
}
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:101,代码来源:wpsc-transaction_results_functions.php
示例10: gateway_bluepay
function gateway_bluepay($seperator, $sessionid)
{
//$transact_url = get_option('transact_url');
//exit("<pre>".print_r($_POST,true)."</pre>");
// if($_SESSION['cart_paid'] == true)
// {
// header("Location: ".get_option('transact_url').$seperator."sessionid=".$sessionid);
// }
$x_Login = urlencode(get_option('bluepay_login'));
// Replace LOGIN with your login
$x_Password = urlencode(get_option("bluepay_password"));
// Replace PASS with your password
$x_Delim_Data = urlencode("TRUE");
$x_Delim_Char = urlencode(",");
$x_Encap_Char = urlencode("");
$x_Type = urlencode("AUTH_CAPTURE");
$x_ADC_Relay_Response = urlencode("FALSE");
if (get_option('bluepay_testmode') == 1) {
$x_Test_Request = urlencode("TRUE");
// Remove this line of code when you are ready to go live
}
#
# Customer Information
#
$x_Method = urlencode("CC");
$x_Amount = urlencode(nzshpcrt_overall_total_price($_SESSION['delivery_country']));
//exit($x_Amount);
$x_First_Name = urlencode($_POST['collected_data'][get_option('bluepay_form_first_name')]);
$x_Last_Name = urlencode($_POST['collected_data'][get_option('bluepay_form_last_name')]);
$x_Card_Num = urlencode($_POST['card_number']);
$ExpDate = urlencode($_POST['expiry']['month'] . $_POST['expiry']['year']);
$x_Exp_Date = $ExpDate;
$x_Address = urlencode($_POST['collected_data'][get_option('bluepay_form_address')]);
$x_City = urlencode($_POST['collected_data'][get_option('bluepay_form_city')]);
$State = urlencode($_POST['collected_data'][get_option('bluepay_form_state')]);
$x_State = wpsc_get_state_by_id($State, 'name');
$x_Zip = urlencode($_POST['collected_data'][get_option('bluepay_form_post_code')]);
$x_Email = urlencode($_POST['collected_data'][get_option('bluepay_form_email')]);
$x_Email_Customer = urlencode("TRUE");
$x_Merchant_Email = urlencode(get_option('purch_log_email'));
// Replace MERCHANT_EMAIL with the merchant email address
$x_Card_Code = urlencode($_POST['card_code']);
#
# Build fields string to post
#
$fields = "x_Version=3.1&x_Login={$x_Login}&x_Delim_Data={$x_Delim_Data}&x_Delim_Char={$x_Delim_Char}&x_Encap_Char={$x_Encap_Char}";
$fields .= "&x_Type={$x_Type}&x_Test_Request={$x_Test_Request}&x_Method={$x_Method}&x_Amount={$x_Amount}&x_First_Name={$x_First_Name}";
$fields .= "&x_Last_Name={$x_Last_Name}&x_Card_Num={$x_Card_Num}&x_Exp_Date={$x_Exp_Date}&x_Card_Code={$x_Card_Code}&x_Address={$x_Address}&x_City={$x_City}&x_State={$x_State}&x_Zip={$x_Zip}&x_Email={$x_Email}&x_Email_Customer={$x_Email_Customer}&x_Merchant_Email={$x_Merchant_Email}&x_ADC_Relay_Response={$x_ADC_Relay_Response}";
if ($x_Password != '') {
$fields .= "&x_Password={$x_Password}";
}
//exit($fields);
#
# Start CURL session
#
$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
$ref = get_option('transact_url');
// Replace this URL with the URL of this script
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://secure.bluepay.com/interfaces/a.net");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_NOPROGRESS, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$buffer = curl_exec($ch);
curl_close($ch);
// This section of the code is the change from Version 1.
// This allows this script to process all information provided by Authorize.net...
// and not just whether if the transaction was successful or not
// Provided in the true spirit of giving by Chuck Carpenter
|
请发表评论