本文整理汇总了PHP中wpsc_get_customer_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_get_customer_meta函数的具体用法?PHP wpsc_get_customer_meta怎么用?PHP wpsc_get_customer_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_get_customer_meta函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _wpsc_filter_merchant_v2_payment_method_form_fields
function _wpsc_filter_merchant_v2_payment_method_form_fields($fields)
{
$selected_value = isset($_POST['wpsc_payment_method']) ? $_POST['wpsc_payment_method'] : '';
if (empty($selected_value)) {
$current_purchase_log_id = wpsc_get_customer_meta('current_purchase_log_id');
$purchase_log = new WPSC_Purchase_Log($current_purchase_log_id);
$selected_value = $purchase_log->get('gateway');
}
$gateways = _wpsc_merchant_v2_get_active_gateways();
if (empty($gateways)) {
return $fields;
}
foreach (_wpsc_merchant_v2_get_active_gateways() as $gateway) {
$gateway = (object) $gateway;
$title = $gateway->name;
if (!empty($gateway->image)) {
$title .= ' <img src="' . $gateway->image . '" alt="' . $gateway->name . '" />';
}
$field = array('title' => $title, 'type' => 'radio', 'value' => $gateway->internalname, 'name' => 'wpsc_payment_method', 'checked' => $selected_value == $gateway->internalname);
$fields[] = $field;
}
// check the first payment gateway by default
if (empty($selected_value)) {
$fields[0]['checked'] = true;
}
return $fields;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:27,代码来源:checkout.php
示例2: callback_login
private function callback_login()
{
if (empty($_COOKIE[TEST_COOKIE])) {
$this->message_collection->add(__("Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to log in to your account.", 'wp-e-commerce'), 'error');
}
$form_args = wpsc_get_login_form_args();
$validation = wpsc_validate_form($form_args);
if (is_wp_error($validation)) {
wpsc_set_validation_errors($validation);
return;
}
$user = wp_signon(array('user_login' => $_POST['username'], 'user_password' => $_POST['password'], 'rememberme' => !empty($_POST['rememberme'])));
if (is_wp_error($user)) {
$this->message_collection->add(__('We do not recognize the login information you entered. Please try again.', 'wp-e-commerce'), 'error');
return;
}
$redirect_to = wp_get_referer();
if (wpsc_get_customer_meta('checkout_after_login')) {
$redirect_to = wpsc_get_checkout_url();
wpsc_delete_customer_meta('checkout_after_login');
}
if (!$redirect_to || trim(str_replace(home_url(), '', $redirect_to), '/') == trim($_SERVER['REQUEST_URI'], '/')) {
$redirect_to = wpsc_get_store_url();
}
wp_redirect($redirect_to);
exit;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:27,代码来源:login.php
示例3: gateway_paystation
function gateway_paystation($seperator, $sessionid)
{
$price = number_format(nzshpcrt_overall_total_price(wpsc_get_customer_meta('billing_country')), 2, '', ',');
$url = "https://www.paystation.co.nz/dart/darthttp.dll?paystation&pi=" . get_option('paystation_id') . "&ms=" . $sessionid . "&am=" . $price . "";
header("Location: {$url}");
exit;
}
开发者ID:benhuson,项目名称:Gold-Cart,代码行数:7,代码来源:paystation.php
示例4: get_completed
private function get_completed()
{
$this->completed = wpsc_get_customer_meta('checkout_wizard_completed_steps');
if (!is_array($this->completed)) {
$this->completed = array();
}
}
开发者ID:ashik968,项目名称:digiplot,代码行数:7,代码来源:checkout-wizard.php
示例5: gateway_dps
function gateway_dps($seperator, $sessionid)
{
$PxAccess_Url = get_option('access_url');
$PxAccess_Userid = get_option('access_userid');
$PxAccess_Key = get_option('access_key');
$Mac_Key = get_option('mac_key');
$pxaccess = new PxAccess($PxAccess_Url, $PxAccess_Userid, $PxAccess_Key, $Mac_Key);
$request = new PxPayRequest();
$http_host = getenv("HTTP_HOST");
$request_uri = getenv("SCRIPT_NAME");
$server_url = get_option('siteurl');
$script_url = get_option('transact_url');
//Using this code after PHP version 4.3.4 ?page_id=$_GET['page_id']
//echo $script_url . '<br />';
//exit(get_option('checkout_url'));
# the following variables are read from the form
$Address1 = $_POST['address'];
$Address2 = "";
#Set up PxPayRequest Object
$request->setAmountInput(nzshpcrt_overall_total_price(wpsc_get_customer_meta('shipping_country')));
$request->setTxnData1(get_option('blogname'));
# whatever you want to appear, original: $request->setTxnData1("Widget order");
$request->setTxnData2("n/a");
# whatever you want to appear
$request->setTxnData3("n/a");
# whatever you want to appear
$request->setTxnType("Purchase");
if (get_option('dps_curcode') != '') {
$request->setInputCurrency(get_option('dps_curcode'));
} else {
$request->setInputCurrency("USD");
}
$request->setMerchantReference($sessionid);
# fill this with your order number
$request->setEmailAddress(get_option('purch_log_email'));
$request->setUrlFail($script_url);
$request->setUrlSuccess($script_url);
#Call makeResponse of PxAccess object to obtain the 3-DES encrypted payment request
$request_string = $pxaccess->makeRequest($request);
header("Location: {$request_string}");
exit;
}
开发者ID:benhuson,项目名称:Gold-Cart,代码行数:42,代码来源:dps.php
示例6: getQuote
function getQuote()
{
global $wpdb, $wpec_ash;
if (!is_object($wpec_ash)) {
$wpec_ash = new ASH();
}
// Arguments array for various functions to use
$args = array();
// Final rate table
$rate_table = array();
// Get the ups settings from the ups account info page (Shipping tab)
$wpsc_ups_settings = get_option("wpsc_ups_settings", array());
// Get the wordpress shopping cart options
$wpsc_options = get_option("wpsc_options");
// API Auth settings //
$args['username'] = array_key_exists('upsaccount', $wpsc_ups_settings) ? $wpsc_ups_settings['upsusername'] : "";
$args['password'] = array_key_exists('upspassword', $wpsc_ups_settings) ? $wpsc_ups_settings['upspassword'] : "";
$args['api_id'] = array_key_exists('upsid', $wpsc_ups_settings) ? $wpsc_ups_settings['upsid'] : "";
$args['account_number'] = array_key_exists('upsaccount', $wpsc_ups_settings) ? $wpsc_ups_settings['upsaccount'] : "";
$args['negotiated_rates'] = array_key_exists('ups_negotiated_rates', $wpsc_ups_settings) ? $wpsc_ups_settings['ups_negotiated_rates'] : "";
$args['residential'] = $wpsc_ups_settings['49_residential'];
$args["singular_shipping"] = array_key_exists("singular_shipping", $wpsc_ups_settings) ? $wpsc_ups_settings["singular_shipping"] : "0";
$args['insured_shipment'] = array_key_exists("insured_shipment", $wpsc_ups_settings) ? $wpsc_ups_settings["insured_shipment"] : "0";
// What kind of pickup service do you use ?
$args['DropoffType'] = $wpsc_ups_settings['DropoffType'];
$args['packaging'] = $wpsc_ups_settings['48_container'];
// Preferred Currency to display
$currency_data = $wpdb->get_row($wpdb->prepare("SELECT `code`\n FROM `" . WPSC_TABLE_CURRENCY_LIST . "`\n WHERE `isocode`= %s\n LIMIT 1", get_option('currency_type')), ARRAY_A);
if ($currency_data) {
$args['currency'] = $currency_data['code'];
} else {
$args['currency'] = "USD";
}
// Shipping billing / account address
$origin_region_data = $wpdb->get_results($wpdb->prepare("SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "`\n WHERE `" . WPSC_TABLE_REGION_TAX . "`.`id` = %d ", get_option('base_region')), ARRAY_A);
$args['shipr_state'] = is_array($origin_region_data) ? $origin_region_data[0]['code'] : "";
$args['shipr_city'] = get_option('base_city');
$args['shipr_ccode'] = get_option('base_country');
$args['shipr_pcode'] = get_option('base_zipcode');
// Physical Shipping address being shipped from
$args['shipf_state'] = $args['shipr_state'];
$args['shipf_city'] = $args['shipr_city'];
$args['shipf_ccode'] = $args['shipr_ccode'];
$args['shipf_pcode'] = $args['shipr_pcode'];
// Get the total weight from the shopping cart
$args['units'] = "LBS";
$args['weight'] = wpsc_cart_weight_total();
// Destination zip code
$args['dest_ccode'] = wpsc_get_customer_meta('shipping_country');
if ($args['dest_ccode'] == "UK") {
// So, UPS is a little off the times
$args['dest_ccode'] = "GB";
}
// If ths zip code is provided via a form post use it!
$args['dest_pcode'] = (string) wpsc_get_customer_meta('shipping_zip');
if (isset($_POST['zipcode']) && ($_POST['zipcode'] != __("Your Zipcode", 'wpsc') && $_POST['zipcode'] != "YOURZIPCODE")) {
$args['dest_pcode'] = esc_attr($_POST['zipcode']);
}
if (in_array($args['dest_pcode'], array(__('Your Zipcode', 'wpsc'), 'YOURZIPCODE'))) {
$args['dest_pcode'] = '';
}
wpsc_update_customer_meta('shipping_zip', $args['dest_pcode']);
if (empty($args['dest_pcode'])) {
// We cannot get a quote without a zip code so might as well return!
return array();
}
// If the region code is provided via a form post use it!
if (isset($_POST['region']) && !empty($_POST['region'])) {
$query = $wpdb->prepare("SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "`\n WHERE `" . WPSC_TABLE_REGION_TAX . "`.`id` = %d", $_POST['region']);
$dest_region_data = $wpdb->get_results($query, ARRAY_A);
$args['dest_state'] = is_array($dest_region_data) ? $dest_region_data[0]['code'] : "";
wpsc_update_customer_meta('ups_state', $args['dest_state']);
} else {
if ($dest_state = wpsc_get_customer_meta('ups_state')) {
// Well, we have a zip code in the session and no new one provided
$args['dest_state'] = $dest_state;
} else {
$args['dest_state'] = "";
}
}
$shipping_cache_check['state'] = $args['dest_state'];
$shipping_cache_check['zipcode'] = $args['dest_pcode'];
$shipping_cache_check['weight'] = $args['weight'];
$session_cache_check = wpsc_get_customer_meta('ups_shipping_cache_check');
if (!is_array($session_cache_check)) {
$session_cache_check = array();
}
$session_cache = wpsc_get_customer_meta('ups_shipping_cache');
if (!is_array($session_cache)) {
$session_cache = array();
}
if (!(bool) $args["singular_shipping"]) {
// This is where shipping breaks out of UPS if weight is higher than 150 LBS
if ($weight > 150) {
wpsc_delete_customer_meta('quote_shipping_method');
$shipping_quotes[TXT_WPSC_OVER_UPS_WEIGHT] = 0;
$session_cache_check['weight'] = $args['weight'];
$session_cache[$this->internal_name] = $shipping_quotes;
wpsc_update_customer_meta('quote_shipping_method', $this->internal_name);
wpsc_update_customer_meta('ups_shipping_cache_check', $session_cache_check);
//.........这里部分代码省略.........
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:101,代码来源:ups_20.php
示例7: getQuote
function getQuote()
{
global $wpdb, $wpec_ash, $wpsc_cart, $wpec_ash_tools;
// Arguments array for various functions to use
$args = array();
$args['dest_ccode'] = wpsc_get_customer_meta('shippingcountry');
// Get the ups settings from the ups account info page (Shipping tab)
$wpsc_ups_settings = get_option('wpsc_ups_settings', array());
//Disable International Shipping. Default: Enabled, as it currently is.
$args['intl_rate'] = isset($wpsc_ups_settings['intl_rate']) && !empty($wpsc_ups_settings['intl_rate']) ? FALSE : TRUE;
if (!$args['intl_rate'] && $args['dest_ccode'] != get_option('base_country')) {
return array();
}
// Destination zip code
$args['dest_pcode'] = (string) wpsc_get_customer_meta('shippingpostcode');
if (!is_object($wpec_ash_tools)) {
$wpec_ash_tools = new ASHTools();
}
if (empty($args['dest_pcode']) && $wpec_ash_tools->needs_post_code($args['dest_ccode'])) {
// We cannot get a quote without a zip code so might as well return!
return array();
}
// Get the total weight from the shopping cart
$args['weight'] = wpsc_cart_weight_total();
if (empty($args['weight'])) {
return array();
}
$args['dest_state'] = '';
$wpsc_country = new WPSC_Country(wpsc_get_customer_meta('shippingcountry'));
if ($wpsc_country->has_regions()) {
$wpsc_region = $wpsc_country->get_region(wpsc_get_customer_meta('shippingregion'));
if (is_a($wpsc_region, 'WPSC_Region')) {
$args['dest_state'] = $wpsc_region->get_code();
}
}
if (empty($args['dest_state'])) {
$args['dest_state'] = wpsc_get_customer_meta('shippingstate');
}
if (!is_object($wpec_ash)) {
$wpec_ash = new ASH();
}
$shipping_cache_check['state'] = $args['dest_state'];
//The destination is needed for cached shipment check.
$shipping_cache_check['country'] = $args['dest_ccode'];
$shipping_cache_check['zipcode'] = $args['dest_pcode'];
$this->shipment = $wpec_ash->get_shipment();
$this->shipment->set_destination($this->internal_name, $shipping_cache_check);
//Set this shipment's destination.
$this->shipment->rates_expire = date('Y-m-d');
$args['shipper'] = $this->internal_name;
$args['singular_shipping'] = array_key_exists('singular_shipping', $wpsc_ups_settings) ? $wpsc_ups_settings['singular_shipping'] : '0';
if ($args['weight'] > 150 && !(bool) $args['singular_shipping']) {
// This is where shipping breaks out of UPS if weight is higher than 150 LBS
$over_weight_txt = apply_filters('wpsc_shipment_over_weight', __('Your order exceeds the standard shipping weight limit. Please contact us to quote other shipping alternatives.', 'wpsc'), $args);
$shipping_quotes[$over_weight_txt] = 0;
// yes, a constant.
$wpec_ash->cache_results($this->internal_name, array($shipping_quotes), $this->shipment);
//Update shipment cache.
return array($shipping_quotes);
}
$cache = $wpec_ash->check_cache($this->internal_name, $this->shipment);
//And now, we're ready to check cache.
// We do not want to spam UPS (and slow down our process) if we already
// have a shipping quote!
if (count($cache['rate_table']) >= 1) {
return $cache['rate_table'];
}
// Final rate table
$rate_table = array();
// API Auth settings //
$args['username'] = array_key_exists('upsaccount', $wpsc_ups_settings) ? $wpsc_ups_settings['upsusername'] : '';
$args['password'] = array_key_exists('upspassword', $wpsc_ups_settings) ? $wpsc_ups_settings['upspassword'] : '';
$args['api_id'] = array_key_exists('upsid', $wpsc_ups_settings) ? $wpsc_ups_settings['upsid'] : '';
$args['account_number'] = array_key_exists('upsaccount', $wpsc_ups_settings) ? $wpsc_ups_settings['upsaccount'] : '';
$args['negotiated_rates'] = array_key_exists('ups_negotiated_rates', $wpsc_ups_settings) ? $wpsc_ups_settings['ups_negotiated_rates'] : '';
$args['residential'] = $wpsc_ups_settings['49_residential'];
$args['insured_shipment'] = array_key_exists('insured_shipment', $wpsc_ups_settings) ? $wpsc_ups_settings['insured_shipment'] : '0';
// What kind of pickup service do you use ?
$args['DropoffType'] = $wpsc_ups_settings['DropoffType'];
$args['packaging'] = $wpsc_ups_settings['48_container'];
// Preferred Currency to display
$currency_data = WPSC_Countries::get_currency_code(get_option('currency_type'));
if (!empty($currency_data)) {
$args['currency'] = $currency_data;
} else {
$args['currency'] = 'USD';
}
// Shipping billing / account address
$region = new WPSC_Region(get_option('base_country'), get_option('base_region'));
$args['shipr_state'] = $region->get_code();
$args['shipr_city'] = get_option('base_city');
$args['shipr_ccode'] = get_option('base_country');
$args['shipr_pcode'] = get_option('base_zipcode');
// Physical Shipping address being shipped from
$args['shipf_state'] = $args['shipr_state'];
$args['shipf_city'] = $args['shipr_city'];
$args['shipf_ccode'] = $args['shipr_ccode'];
$args['shipf_pcode'] = $args['shipr_pcode'];
$args['units'] = 'LBS';
$args['cart_total'] = $wpsc_cart->calculate_subtotal(true);
//.........这里部分代码省略.........
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:101,代码来源:ups_20.php
示例8: wpsc_checkout_form_name
?>
colspan='2'>
<h4><?php
echo wpsc_checkout_form_name();
?>
</h4>
</td>
</tr>
<?php
if (wpsc_is_shipping_details()) {
?>
<tr class='same_as_shipping_row'>
<td colspan ='2'>
<?php
$checked = '';
$shipping_same_as_billing = wpsc_get_customer_meta('shippingSameBilling');
if (isset($_POST['shippingSameBilling']) && $_POST['shippingSameBilling']) {
$shipping_same_as_billing = true;
} elseif (isset($_POST['submit']) && !isset($_POST['shippingSameBilling'])) {
$shipping_same_as_billing = false;
}
wpsc_update_customer_meta('shippingSameBilling', $shipping_same_as_billing);
if ($shipping_same_as_billing) {
$checked = 'checked="checked"';
}
?>
<label for='shippingSameBilling'><input type='checkbox' value='true' data-wpsc-meta-key="shippingSameBilling" class= "wpsc-visitor-meta" name='shippingSameBilling' id='shippingSameBilling' <?php
echo $checked;
?>
/><?php
_e('Same as billing address:', 'wp-e-commerce');
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:31,代码来源:wpsc-shopping_cart_page.php
示例9: _wpsc_shipping_error_messages
/**
* output shipping error messages
*
* @since 3.8.14.1
*
* @access private
*/
function _wpsc_shipping_error_messages()
{
$shipping_error_messages = wpsc_get_customer_meta('shipping_error_messages');
if (!empty($shipping_error_messages)) {
?>
<div class="wpsc-shipping-error_messages error">
<?php
foreach ($shipping_error_messages as $id => $message) {
?>
<div class="wpsc-shipping-error_message error" id="<?php
echo esc_attr($id);
?>
">
<?php
echo esc_html($message);
?>
</div>
<?php
}
?>
</div>
<?php
}
}
开发者ID:ashik968,项目名称:digiplot,代码行数:31,代码来源:shopping_cart_functions.php
示例10: wpsc_shipping_country_list
function wpsc_shipping_country_list($shippingdetails = false)
{
global $wpsc_shipping_modules;
$wpsc_checkout = new wpsc_checkout();
$wpsc_checkout->checkout_item = $shipping_country_checkout_item = $wpsc_checkout->get_checkout_item('shippingcountry');
$output = '';
if ($shipping_country_checkout_item && $shipping_country_checkout_item->active) {
if (!$shippingdetails) {
$output = "<input type='hidden' name='wpsc_ajax_action' value='update_location' />";
}
$acceptable_countries = wpsc_get_acceptable_countries();
// if there is only one country to choose from we are going to set that as the shipping country,
// later in the UI generation the same thing will happen to make the single country the current
// selection
$countries = WPSC_Countries::get_countries(false);
if (count($countries) == 1) {
reset($countries);
$id_of_only_country_available = key($countries);
$wpsc_country = new WPSC_Country($id_of_only_country_available);
wpsc_update_customer_meta('shippingcountry', $wpsc_country->get_isocode());
}
$selected_country = wpsc_get_customer_meta('shippingcountry');
$additional_attributes = 'data-wpsc-meta-key="shippingcountry" ';
$output .= wpsc_get_country_dropdown(array('id' => 'current_country', 'name' => 'country', 'class' => 'current_country wpsc-visitor-meta', 'acceptable_ids' => $acceptable_countries, 'selected' => $selected_country, 'additional_attributes' => $additional_attributes, 'placeholder' => __('Please select a country', 'wp-e-commerce')));
}
$output .= wpsc_checkout_shipping_state_and_region();
$zipvalue = (string) wpsc_get_customer_meta('shippingpostcode');
$zip_code_text = __('Your Zipcode', 'wp-e-commerce');
if ($zipvalue != '' && $zipvalue != $zip_code_text) {
$color = '#000';
wpsc_update_customer_meta('shipping_zip', $zipvalue);
} else {
$zipvalue = $zip_code_text;
$color = '#999';
}
$uses_zipcode = false;
$custom_shipping = get_option('custom_shipping_options');
foreach ((array) $custom_shipping as $shipping) {
if (isset($wpsc_shipping_modules[$shipping]->needs_zipcode) && $wpsc_shipping_modules[$shipping]->needs_zipcode == true) {
$uses_zipcode = true;
}
}
if ($uses_zipcode) {
$output .= " <input data-wpsc-meta-key='shippingpostcode' class='wpsc-visitor-meta' type='text' style='color:" . $color . ";' onclick='if (this.value==\"" . esc_js($zip_code_text) . "\") {this.value=\"\";this.style.color=\"#000\";}' onblur='if (this.value==\"\") {this.style.color=\"#999\"; this.value=\"" . esc_js($zip_code_text) . "\"; }' value='" . esc_attr($zipvalue) . "' size='10' name='zipcode' id='zipcode'>";
}
return $output;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:47,代码来源:checkout.php
示例11: filter_paypal_error_page
/**
* Error Page Template
*
* @since 3.9
*/
public function filter_paypal_error_page()
{
$errors = wpsc_get_customer_meta('paypal_express_checkout_errors');
ob_start();
?>
<p>
<?php
_e('Sorry, your transaction could not be processed by PayPal. Please contact the site administrator. The following errors are returned:', 'wp-e-commerce');
?>
</p>
<ul>
<?php
foreach ($errors as $error) {
?>
<li><?php
echo esc_html($error['details']);
?>
(<?php
echo esc_html($error['code']);
?>
)</li>
<?php
}
?>
</ul>
<p><a href="<?php
echo esc_url($this->get_shopping_cart_payment_url());
?>
"><?php
'Click here to go back to the checkout page.';
?>
</a></p>
<?php
$output = apply_filters('wpsc_paypal_express_checkout_gateway_error_message', ob_get_clean(), $errors);
return $output;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:41,代码来源:paypal-express-checkout.php
示例12: get_cache_key
/**
* Creates cache key for current cart and ZIP code for shipping rates.
* @since 3.8.9
* @return string
*/
public function get_cache_key()
{
global $wpsc_cart;
if (!is_object($wpsc_cart) || empty($wpsc_cart->cart_items)) {
return false;
}
$cached_object = array();
$products = $wpsc_cart->cart_items;
$zip = wpsc_get_customer_meta('shipping_zip');
$num = 0;
foreach ($products as $product) {
if (!$product->uses_shipping) {
continue;
}
$cached_object['products'][$num]['sku'] = $product->sku;
$cached_object['products'][$num]['qty'] = $product->quantity;
$num++;
}
$cached_object['zip'] = $zip;
return 'rates_' . hash('md5', json_encode($cached_object));
}
开发者ID:ashik968,项目名称:digiplot,代码行数:26,代码来源:shipwire_functions.php
示例13: _wpsc_add_customer_meta_to_response
/**
* Common routine to put the current customer meta values into an jax
* response in a format to be consumed by the wp-e-commerce.js ajax processings
*
* @since 3.8.14
* @access private
*
* @param array values being readied to send back to javascript in the json encoded AJAX response
* @param string|array|null meta keys to retrieve, if not specified all meta keys are retrieved
* @return JSON encoded array with results, results include original request parameters
*/
function _wpsc_add_customer_meta_to_response($response, $meta_keys = null, $meta_key = 'customer_meta')
{
if (!empty($meta_keys)) {
if (!is_array($meta_keys)) {
$meta_keys = array($meta_keys);
}
} else {
$meta_keys = wpsc_checkout_unique_names();
}
$customer_meta = array();
foreach ($meta_keys as $a_meta_key) {
$customer_meta[$a_meta_key] = wpsc_get_customer_meta($a_meta_key);
}
$response[$meta_key] = $customer_meta;
$response = apply_filters('wpsc_ajax_response_customer_meta', $response);
return $response;
}
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:28,代码来源:customer-ajax.php
示例14: wpec_taxes_calculate_total
/**
* @description: wpec_taxes_calculate_total - takes into account all tax logic
* settings and returns the calculated total tax.
* Expects wpsc_cart to be set.
*
* @param: void
* @return: array containing total tax and rate if applicable
* */
function wpec_taxes_calculate_total()
{
//get the cart - NOTE: billing country is selected_country and shipping country is delivery_country
global $wpsc_cart;
//initialize return variable
$returnable = array('total' => 0, 'rate' => 0);
//check if tax is enabled
if ($this->wpec_taxes->wpec_taxes_get_enabled()) {
//run tax logic and calculate tax
if ($this->wpec_taxes_run_logic()) {
//get selected country code
$wpec_selected_country = $this->wpec_taxes_retrieve_selected_country();
//set tax region
$region = $this->wpec_taxes_retrieve_region();
//get the rate for the country and region if set
$tax_rate = $this->wpec_taxes->wpec_taxes_get_rate($wpec_selected_country, $region);
//start the total_tax off at 0
$total_tax = 0;
foreach ($wpsc_cart->cart_items as $cart_item) {
//if the tax is inclusive calculate vat
if ($this->wpec_taxes_isincluded()) {
//run wpec_taxes_calculate_included_tax
$taxes = $this->wpec_taxes_calculate_included_tax($cart_item);
$total_tax += $taxes['tax'];
} else {
//run wpec_taxes_calculate_excluded_tax
$taxes = $this->wpec_taxes_calculate_excluded_tax($cart_item, $tax_rate);
$total_tax += $taxes['tax'];
}
// if
}
// foreach
$free_shipping = false;
$coupon_num = wpsc_get_customer_meta('coupon');
if ($coupon_num) {
$coupon = new wpsc_coupons($coupon_num);
$free_shipping = $coupon->is_percentage == '2';
}
// minus coupon tax if we are using coupons, but make sure the coupon is not a free shipping coupon
/* Iterative note: In a future implementation, we'll allow for coupons to either apply to taxes, or not */
/* The default logic to date has been that they do, which is generally improper, and there's a logic bug here as well */
/* @link: https://github.com/wp-e-commerce/WP-e-Commerce/issues/170 */
if ($wpsc_cart->coupons_amount > 0 && !$free_shipping) {
if ($this->wpec_taxes_isincluded()) {
$coupon_tax = $this->wpec_taxes_calculate_tax($wpsc_cart->coupons_amount, $tax_rate['rate'], false);
} else {
$coupon_tax = $this->wpec_taxes_calculate_tax($wpsc_cart->coupons_amount, $tax_rate['rate']);
}
/* Only subtract if coupons apply to tax. Likely in 4.0 */
/* $total_tax -= $coupon_tax; */
}
//add shipping tax if set
if ($tax_rate['shipping'] && !$free_shipping) {
if ($this->wpec_taxes_isincluded()) {
$total_tax += $this->wpec_taxes_calculate_tax($wpsc_cart->calculate_total_shipping(), $tax_rate['rate'], false);
} else {
$total_tax += $this->wpec_taxes_calculate_tax($wpsc_cart->calculate_total_shipping(), $tax_rate['rate']);
}
}
// if
$returnable = array('total' => $total_tax);
if (!$this->wpec_taxes_isincluded() && isset($tax_rate['rate'])) {
$returnable['rate'] = $tax_rate['rate'];
}
// if
}
// if
}
//if
return $returnable;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:79,代码来源:taxes_controller.class.php
示例15: _wpsc_merge_cart
/**
* Merge cart from anonymous user with cart from logged in user
*
* @since 3.8.13
* @access private
*/
function _wpsc_merge_cart()
{
$id_from_wp_user = get_user_meta(get_current_user_id(), _wpsc_get_visitor_meta_key('visitor_id'), true);
if (empty($id_from_wp_user)) {
return;
}
do_action('_wpsc_merge_cart', $id_from_wp_user);
$id_from_customer_meta = wpsc_get_customer_meta('merge_cart_vistor_id');
wpsc_delete_customer_meta('merge_cart_vistor_id');
$old_cart = wpsc_get_customer_cart($id_from_customer_meta);
$items = $old_cart->get_items();
$new_cart = wpsc_get_customer_cart($id_from_wp_user);
// first of all empty the old cart so that the claimed stock and related
// hooks are released
$old_cart->empty_cart();
// add each item to the new cart
foreach ($items as $item) {
$new_cart->set_item($item->product_id, array('quantity' => $item->quantity, 'variation_values' => $item->variation_values, 'custom_message' => $item->custom_message, 'provided_price' => $item->provided_price, 'time_requested' => $item->time_requested, 'custom_file' => $item->custom_file, 'is_customisable' => $item->is_customisable, 'meta' => $item->meta, 'item_meta' => $item->get_meta()));
}
wpsc_update_customer_cart($new_cart);
// The old profile is no longer needed
_wpsc_abandon_temporary_customer_profile($id_from_customer_meta);
}
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:29,代码来源:customer-private.php
示例16: getQuote
/**
* returns shipping quotes using this shipping module.
*
* @return array collection of rates applicable.
*/
function getQuote()
{
global $wpdb, $wpsc_cart;
if (wpsc_get_customer_meta('nzshpcart')) {
$shopping_cart = wpsc_get_customer_meta('nzshpcart');
}
if (is_object($wpsc_cart)) {
$price = $wpsc_cart->calculate_subtotal(true);
}
$layers = get_option('table_rate_layers');
if ($layers != '') {
// At some point we should probably remove this as the sorting should be
// done when we save the data to the database. But need to leave it here
// for people who have non-sorted settings in their database
krsort($layers);
foreach ($layers as $key => $shipping) {
if ($price >= (double) $key) {
if (stristr($shipping, '%')) {
// Shipping should be a % of the cart total
$shipping = str_replace('%', '', $shipping);
$shipping_amount = $price * ($shipping / 100);
} else {
// Shipping is an absolute value
$shipping_amount = $shipping;
}
return array(__("Table Rate", 'wpsc') => $shipping_amount);
}
}
$shipping = array_shift($layers);
if (stristr($shipping, '%')) {
$shipping = str_replace('%', '', $shipping);
$shipping_amount = $price * ($shipping / 100);
} else {
$shipping_amount = $shipping;
}
return array(__("Table Rate", 'wpsc') => $shipping_amount);
}
}
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:43,代码来源:tablerate.php
示例17: submit
/**
* submit method, sends the received data to the payment gateway
* @access public
*/
function submit()
{
$paymentAmount = $this->cart_data['total_price'];
wpsc_update_customer_meta('paypal_express_converted_amount', $this->convert($paymentAmount));
wpsc_update_customer_meta('paypal_express_original_amount', $paymentAmount);
wpsc_update_customer_meta('paypal_express_sessionid', $this->cart_data['session_id']);
$currencyCodeType = $this->get_paypal_currency_code();
$paymentType = "Sale";
if (get_option('permalink_structure') != '') {
$separator = "?";
} else {
$separator = "&";
}
$transact_url = get_option('transact_url');
$returnURL = $transact_url . $separator . "sessionid=" . $this->cart_data['session_id'] . "&gateway=paypal";
$cancelURL = get_option('shopping_cart_url');
$resArray = $this->CallShortcutExpressCheckout(wpsc_get_customer_meta('paypal_express_converted_amount'), $currencyCodeType, $paymentType, $returnURL, $cancelURL);
$ack = strtoupper($resArray["ACK"]);
if ($ack == "SUCCESS") {
$this->RedirectToPayPal($resArray["TOKEN"]);
} else {
//Display a user friendly Error on the page using any of the following error information returned by PayPal
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
$ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
$ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
echo "SetExpressCheckout API call failed. ";
echo "<br />Detailed Error Message: " . $ErrorLongMsg;
echo "<br />Short Error Message: " . $ErrorShortMsg;
echo "<br />Error Code: " . $ErrorCode;
echo "<br />Error Severity Code: " . $ErrorSeverityCode;
}
exit;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:38,代码来源:paypal-express.merchant.php
示例18: _wpsc_get_checkout_meta
/**
* Get the current values for checkout meta
*
* @since 3.8.14
* @access private
*
* @param array values being readied to send back to javascript in the json encoded AJAX response
* @param string|array|null meta keys to retrieve, if not specified all meta keys are retrieved
* @return JSON encoded array with results, results include original request parameters
*/
function _wpsc_get_checkout_meta($meta_keys = null)
{
if (!empty($meta_keys)) {
if (!is_array($meta_keys)) {
$meta_keys = array($meta_keys);
}
} else {
$meta_keys = wpsc_checkout_unique_names();
}
$checkout_meta = array();
foreach ($meta_keys as $a_meta_key) {
$checkout_meta[$a_meta_key] = wpsc_get_customer_meta($a_meta_key);
}
return $checkout_meta;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:25,代码来源:wpsc-checkout-ajax.php
示例19: wpsc_deprecated_vars_for_shipping
/**
* function to provide deprecated variables to older shipping modules
*
* @since 3.8.14
*/
function wpsc_deprecated_vars_for_shipping($wpsc_cart)
{
// extracted from the Instinct fedex module
$_POST['country'] = wpsc_get_customer_meta('shippingcountry');
$_POST['region'] = wpsc_get_customer_meta('shippingregion');
$_POST['zipcode'] = wpsc_get_customer_meta('shippingpostcode');
}
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:12,代码来源:wpsc-deprecated.php
示例20: getQuote
/**
* General entry point for WPEC external shipping calculator
* This function expects no arguments but requires POST data
* and configuration from the plugin settings
* @return array $rate_table List of rates in "Service"=>"Rate" format
*/
function getQuote()
{
global $wpdb, $wpec_ash, $wpec_ash_tools, $wpsc_cart;
$data = array();
//************** These values are common to all entry points **************
//*** User/Customer Entered Values ***\\
//*** Set up the destination country ***\
$data["dest_country"] = wpsc_get_customer_meta('shi
|
请发表评论