本文整理汇总了PHP中wpsc_delete_customer_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_delete_customer_meta函数的具体用法?PHP wpsc_delete_customer_meta怎么用?PHP wpsc_delete_customer_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_delete_customer_meta函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: __construct
/**
* Coupons constructor
*
* Instantiate a coupons object with optional variable $code;
*
* @param string code (optional) the coupon code you would like to use.
* @return bool True if coupon code exists, False otherwise.
*/
public function __construct($code = '')
{
global $wpdb;
if (empty($code)) {
return false;
}
$this->code = $code;
$coupon_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE coupon_code = %s LIMIT 1", $code), ARRAY_A);
if (empty($coupon_data)) {
$this->errormsg = true;
wpsc_delete_customer_meta('coupon');
return false;
} else {
$this->coupon = new WPSC_Coupon($coupon_data['id']);
// Store these values for back-compatibiilty pre 4.0?
$this->value = $this->coupon->get('value');
$this->is_percentage = $this->coupon->get('is-percentage');
$this->conditions = $this->coupon->get('condition');
$this->is_used = $this->coupon->get('is-used');
$this->active = $this->coupon->get('active');
$this->use_once = $this->coupon->get('use-once');
$this->start_date = $this->coupon->get('start');
$this->end_date = $this->coupon->get('expiry');
$this->every_product = $this->coupon->get('every_product');
$this->errormsg = false;
return $this->validate_coupon();
}
}
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:36,代码来源:coupons.class.php
示例3: wpsc_coupons
/**
* Coupons constructor
*
* Instantiate a coupons object with optional variable $code;
*
* @param string code (optional) the coupon code you would like to use.
* @return bool True if coupon code exists, False otherwise.
*/
function wpsc_coupons($code = '')
{
global $wpdb;
if (empty($code)) {
return false;
}
$this->code = $code;
$coupon_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE coupon_code = %s LIMIT 1", $code), ARRAY_A);
if (empty($coupon_data)) {
$this->errormsg = true;
wpsc_delete_customer_meta('coupon');
return false;
} else {
$coupon_data = array_merge(array('value' => '', 'is-percentage' => '', 'condition' => '', 'is-used' => '', 'active' => '', 'use-once' => '', 'start' => '', 'expiry' => '', 'every_product' => ''), $coupon_data);
$this->value = (double) $coupon_data['value'];
$this->is_percentage = $coupon_data['is-percentage'];
$this->conditions = unserialize($coupon_data['condition']);
$this->is_used = $coupon_data['is-used'];
$this->active = $coupon_data['active'];
$this->use_once = $coupon_data['use-once'];
$this->start_date = $coupon_data['start'];
$this->end_date = $coupon_data['expiry'];
$this->every_product = $coupon_data['every_product'];
$this->errormsg = false;
return $this->validate_coupon();
}
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:35,代码来源:coupons.class.php
示例4: wpsc_delete_customer_meta_ajax
/**
* Delete a customer meta
* @param string
* @return JSON encoded array with results, results include original request parameters
* @since 3.8.14
*/
function wpsc_delete_customer_meta_ajax()
{
$meta_key = isset($_POST['meta_key']) ? $_REQUEST['meta_key'] : '';
$response = array('request' => $_REQUEST);
if (!empty($meta_key)) {
$response['old_value'] = wpsc_get_customer_meta($meta_key);
$response['type'] = __('success', 'wpsc');
$response['error'] = '';
wpsc_delete_customer_meta($meta_key);
} else {
$response['old_value'] = '';
$response['type'] = __('error', 'wpsc');
$response['error'] = __('no meta key', 'wpsc');
_wpsc_doing_it_wrong(__FUNCTION__, __('missing meta key', 'wpsc'), '3.8.14');
}
$response = _wpsc_add_customer_meta_to_response($response);
wp_send_json_success($response);
}
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:24,代码来源:customer-ajax.php
示例5: callback_return_url_redirect
/**
* PayPal Lightbox Form redirection for the Return URL
*
* @return void
*
* @since 3.9
*/
public function callback_return_url_redirect()
{
// Session id
if (!isset($_GET['sessionid'])) {
return;
} else {
$sessionid = $_GET['sessionid'];
}
// Page Styles
wp_register_style('ppdg-iframe', plugins_url('dg.css', __FILE__));
// Apply any filters
if (wpsc_get_customer_meta('ecs-' . $sessionid)) {
add_filter('wpsc_paypal_express_checkout_transact_url', array(&$this, 'review_order_url'));
add_filter('wpsc_paypal_express_checkout_return_url', array(&$this, 'review_order_callback'));
wpsc_delete_customer_meta('esc-' . $sessionid);
}
// Return a redirection page
?>
<html>
<head>
<title><?php
_e('Processing...', 'wp-e-commerce');
?>
</title>
<?php
wp_print_styles('ppdg-iframe');
?>
</head>
<body>
<div id="left_frame">
<div id="right_frame">
<p id="message">
<?php
_e('Processing Order', 'wp-e-commerce');
?>
</p>
<img src="https://www.paypal.com/en_US/i/icon/icon_animated_prog_42wx42h.gif" alt="Processing..." />
<div id="right_bottom">
<div id="left_bottom">
</div>
</div>
</div>
</div>
<script type="text/javascript">
<?php
$location = $this->get_original_return_url($sessionid);
?>
setTimeout('if (window!=top) {top.location.replace("<?php
echo $location;
?>
");}else{location.replace("<?php
echo $location;
?>
");}', 1500);
</script>
</body>
</html>
<?php
exit;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:68,代码来源:paypal-digital-goods.php
示例6: _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
示例7: reset
public function reset()
{
wpsc_delete_customer_meta('checkout_wizard_completed_steps');
$this->completed = array();
$this->get_disabled();
}
开发者ID:ashik968,项目名称:digiplot,代码行数:6,代码来源:checkout-wizard.php
示例8: getQuote
/**
* returns shipping quotes using this shipping module.
*
* @param boolean $for_display (optional) (unused)
* @return array collection of rates applicable.
*/
function getQuote($for_display = false)
{
global $wpdb, $wpsc_cart;
$quote_shipping_method = wpsc_get_customer_meta('quote_shipping_method');
$quote_shipping_option = wpsc_get_customer_meta('quote_shipping_option');
$country = '';
if (isset($_POST['country'])) {
$country = sanitize_text_field($_POST['country']);
wpsc_update_customer_meta('shipping_country', $country);
} else {
$country = (string) wpsc_get_customer_meta('shipping_country');
}
if (is_object($wpsc_cart)) {
$cart_total = $wpsc_cart->calculate_subtotal(true);
}
if (get_option('base_country') != $country) {
$results = WPSC_Countries::get_continent($country);
$flatrates = get_option('flat_rates');
if ($flatrates != '') {
if ($quote_shipping_method == $this->internal_name && $quote_shipping_option != __("Flat Rate", 'wp-e-commerce')) {
wpsc_delete_customer_meta('quote_shipping_option');
}
if (isset($flatrates[$results])) {
if (stristr($flatrates[$results], '%')) {
$shipping_percent = str_replace('%', '', $flatrates[$results]);
$shipping_amount = $cart_total * ($shipping_percent / 100);
$flatrates[$results] = (double) $shipping_amount;
}
return array(__("Flat Rate", 'wp-e-commerce') => (double) $flatrates[$results]);
}
}
} else {
$flatrates = get_option('flat_rates');
$shipping_quotes = array();
switch ($country) {
case 'NZ':
if (isset($flatrates['northisland']) && strlen($flatrates['northisland']) > 0) {
$shipping_quotes[__('North Island', 'wp-e-commerce')] = esc_attr($flatrates['northisland']);
}
if (isset($flatrates['southisland']) && strlen($flatrates['southisland']) > 0) {
$shipping_quotes[__('South Island', 'wp-e-commerce')] = esc_attr($flatrates['southisland']);
}
break;
case 'US':
if (isset($flatrates['continental']) && strlen($flatrates['continental']) > 0) {
$shipping_quotes[__('Continental 48 States', 'wp-e-commerce')] = esc_attr($flatrates['continental']);
}
if (isset($flatrates['all']) && strlen($flatrates['all']) > 0) {
$shipping_quotes[__('All 50 States', 'wp-e-commerce')] = esc_attr($flatrates['all']);
}
break;
default:
if (isset($flatrates['local']) && strlen($flatrates['local']) > 0) {
$shipping_quotes[__('Local Shipping', 'wp-e-commerce')] = esc_attr($flatrates['local']);
}
break;
}
// Deal with % shipping rates
foreach (array_keys($shipping_quotes) as $quote_name) {
if (stristr($shipping_quotes[$quote_name], '%')) {
$shipping_percent = str_replace('%', '', $shipping_quotes[$quote_name]);
$shipping_amount = $cart_total * ($shipping_percent / 100);
$shipping_quotes[$quote_name] = (double) $shipping_amount;
} else {
$shipping_quotes[$quote_name] = (double) $shipping_quotes[$quote_name];
}
}
if ($quote_shipping_method == $this->internal_name) {
$shipping_options = array_keys($shipping_quotes);
if (array_search($quote_shipping_option, $shipping_options) === false) {
wpsc_delete_customer_meta('quote_shipping_option');
}
}
return $shipping_quotes;
}
}
开发者ID:ashik968,项目名称:digiplot,代码行数:82,代码来源:flatrate.php
示例9: wpsc_empty_google_logs
/**
* Google checkout not longer available or supported, so we are deprecating this function
*
* @access public
* @deprecated since 3.8.14
*/
function wpsc_empty_google_logs()
{
global $wpdb;
_wpsc_deprecated_function(__FUNCTION__, '3.8.14', 'wpsc_empty_google_logs');
$sql = $wpdb->prepare("DELETE FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid` = '%s'", wpsc_get_customer_meta('checkout_session_id'));
$wpdb->query($sql);
wpsc_delete_customer_meta('checkout_session_id');
}
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:14,代码来源:wpsc-deprecated.php
示例10: paypal_processingfunctions
//.........这里部分代码省略.........
$tax = wpsc_paypal_express_convert($purchase_log['wpec_taxes_total']);
$nvpstr .= '&PAYMENTREQUEST_0_TAXAMT=' . $tax;
$total += $tax;
}
// adjust total amount in case we had to round up after converting currency
if ($total != $paymentAmount) {
$paymentAmount = $total;
}
$nvpstr .= "&PAYMENTREQUEST_0_AMT={$paymentAmount}";
$resArray = paypal_hash_call("DoExpressCheckoutPayment", $nvpstr);
/* Display the API response back to the browser.
If the response from PayPal was a success, display the response parameters'
If the response was an error, display the errors received using APIError.php. */
$ack = strtoupper($resArray["ACK"]);
wpsc_update_customer_meta('paypal_express_reshash', $resArray);
if ($ack != "SUCCESS") {
$location = get_option('transact_url') . "&act=error";
} else {
$transaction_id = $resArray['PAYMENTINFO_0_TRANSACTIONID'];
switch ($resArray['PAYMENTINFO_0_PAYMENTSTATUS']) {
case 'Processed':
// I think this is mostly equivalent to Completed
// I think this is mostly equivalent to Completed
case 'Completed':
wpsc_update_purchase_log_status($sessionid, 3, 'sessionid');
transaction_results($sessionid, false);
break;
case 'Pending':
// need to wait for "Completed" before processing
wpsc_update_purchase_log_details($sessionid, array('processed' => 2, 'date' => time(), 'transactid' => $transaction_id), 'sessionid');
break;
}
$location = add_query_arg('sessionid', $sessionid, get_option('transact_url'));
wpsc_delete_customer_meta('paypal_express_message');
wp_redirect($location);
exit;
}
wpsc_delete_customer_meta('nzshpcrt_serialized_cart');
wpsc_delete_customer_meta('nzshpcart');
$wpsc_cart->empty_cart();
} else {
if (isset($_REQUEST['paymentType']) || isset($_REQUEST['token'])) {
$token = $_REQUEST['token'];
if (!isset($token)) {
$paymentAmount = wpsc_get_customer_meta('paypal_express_converted_amount');
$currencyCodeType = wpsc_get_paypal_currency_code();
$paymentType = 'Sale';
if (get_option('permalink_structure') != '') {
$separator = "?";
} else {
$separator = "&";
}
$returnURL = urlencode(get_option('transact_url') . $separator . 'currencyCodeType=' . $currencyCodeType . '&paymentType=' . $paymentType . '&paymentAmount=' . $paymentAmount);
$cancelURL = urlencode(get_option('transact_url') . $separator . 'paymentType=$paymentType');
/* Construct the parameter string that describes the PayPal payment
the varialbes were set in the web form, and the resulting string
is stored in $nvpstr */
$nvpstr = "&PAYMENTREQUEST_0_AMT=" . $paymentAmount . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType . "&ReturnUrl=" . $returnURL . "&CANCELURL=" . $cancelURL . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
/* Make the call to PayPal to set the Express Checkout token
If the API call succeded, then redirect the buyer to PayPal
to begin to authorize payment. If an error occured, show the
resulting errors
*/
$resArray = paypal_hash_call("SetExpressCheckout", $nvpstr);
wpsc_update_customer_meta('paypal_express_reshash', $resArray);
$ack = strtoupper($resArray["ACK"]);
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:67,代码来源:paypal-express.merchant.php
示例11: wpsc_place_shopping_cart
function wpsc_place_shopping_cart($content = '')
{
if (!in_the_loop()) {
return $content;
}
if (preg_match("/\\[shoppingcart\\]/", $content)) {
// BEGIN: compatibility fix for outdated theme files still relying on sessions
$_SESSION['coupon_numbers'] = wpsc_get_customer_meta('coupon');
$_SESSION['wpsc_checkout_misc_error_messages'] = wpsc_get_customer_meta('checkout_misc_error_messages');
$_SESSION['categoryAndShippingCountryConflict'] = wpsc_get_customer_meta('category_shipping_conflict');
$_SESSION['shippingSameBilling'] = wpsc_get_customer_meta('shippingSameBilling');
$_SESSION['wpsc_checkout_user_error_messages'] = wpsc_get_customer_meta('registration_error_messages');
// END: compatibility fix
$GLOBALS['nzshpcrt_activateshpcrt'] = true;
if (!defined('DONOTCACHEPAGE')) {
define('DONOTCACHEPAGE', true);
}
// call this function to detect conflicts when the cart page is first loaded, otherwise
// any conflict messages will only be displayed on the next page load
wpsc_get_acceptable_countries();
ob_start();
do_action('wpsc_before_shopping_cart_page');
include wpsc_get_template_file_path('wpsc-shopping_cart_page.php');
do_action('wpsc_after_shopping_cart_page');
$output = ob_get_contents();
ob_end_clean();
$output = str_replace('$', '\\$', $output);
wpsc_delete_customer_meta('checkout_misc_error_messages');
wpsc_delete_customer_meta('category_shipping_conflict');
wpsc_delete_customer_meta('registration_error_messages');
wpsc_delete_customer_meta('checkout_error_messages');
wpsc_delete_customer_meta('gateway_error_messages');
return preg_replace("/(<p>)*\\[shoppingcart\\](<\\/p>)*/", $output, $content);
} else {
return $content;
}
}
开发者ID:androidprojectwork,项目名称:WP-e-Commerce,代码行数:37,代码来源:page.php
示例12: wpsc_submit_checkout
/**
* submit checkout function, used through ajax and in normal page loading.
* No parameters, returns nothing
*/
function wpsc_submit_checkout($collected_data = true)
{
global $wpdb, $wpsc_cart, $user_ID, $nzshpcrt_gateways, $wpsc_shipping_modules, $wpsc_gateways;
if ($collected_data && isset($_POST['collected_data']) && is_array($_POST['collected_data'])) {
_wpsc_checkout_customer_meta_update($_POST['collected_data']);
}
// initialize our checkout status variab;e, we start be assuming
// checkout is falid, until we find a reason otherwise
$is_valid = true;
$num_items = 0;
$use_shipping = 0;
$disregard_shipping = 0;
do_action('wpsc_before_submit_checkout');
$error_messages = wpsc_get_customer_meta('checkout_misc_error_messages');
if (!is_array($error_messages)) {
$error_messages = array();
}
$wpsc_checkout = new wpsc_checkout();
$selected_gateways = get_option('custom_gateway_options');
$submitted_gateway = isset($_POST['custom_gateway']) ? $_POST['custom_gateway'] : '';
if ($collected_data) {
$form_validity = $wpsc_checkout->validate_forms();
extract($form_validity);
// extracts $is_valid and $error_messages
if (wpsc_has_tnc() && (!isset($_POST['agree']) || $_POST['agree'] != 'yes')) {
$error_messages[] = __('Please agree to the terms and conditions, otherwise we cannot process your order.', 'wpsc');
$is_valid = false;
}
} else {
$is_valid = true;
$error_messages = array();
}
$wpsc_country = new WPSC_Country(wpsc_get_customer_meta('shippingcountry'));
$country_id = $wpsc_country->get_id();
$country_name = $wpsc_country->get_name();
foreach ($wpsc_cart->cart_items as $cartitem) {
if (!empty($cartitem->meta[0]['no_shipping'])) {
continue;
}
$categoriesIDs = $cartitem->category_id_list;
foreach ((array) $categoriesIDs as $catid) {
if (is_array($catid)) {
$countries = wpsc_get_meta($catid[0], 'target_market', 'wpsc_category');
} else {
$countries = wpsc_get_meta($catid, 'target_market', 'wpsc_category');
}
if (!empty($countries) && !in_array($country_id, (array) $countries)) {
$errormessage = sprintf(__('%s cannot be shipped to %s. To continue with your transaction please remove this product from the list below.', 'wpsc'), $cartitem->get_title(), $country_name);
wpsc_update_customer_meta('category_shipping_conflict', $errormessage);
$is_valid = false;
}
}
//count number of items, and number of items using shipping
$num_items++;
if ($cartitem->uses_shipping != 1) {
$disregard_shipping++;
} else {
$use_shipping++;
}
}
// check to see if the current gateway is in the list of available gateways
if (array_search($submitted_gateway, $selected_gateways) !== false) {
wpsc_update_customer_meta('selected_gateway', $submitted_gateway);
} else {
$is_valid = false;
}
if ($collected_data) {
// Test for required shipping information
if (wpsc_core_shipping_enabled() && $num_items != $disregard_shipping) {
// for shipping to work we need a method, option and a quote
if (!$wpsc_cart->shipping_method_selected() || !$wpsc_cart->shipping_quote_selected()) {
$error_messages[] = __('Please select one of the available shipping options, then we can process your order.', 'wpsc');
$is_valid = false;
}
// if we don't have a valid zip code ( the function also checks if we need it ) we have an error
if (!wpsc_have_valid_shipping_zipcode()) {
wpsc_update_customer_meta('category_shipping_conflict', __('Please enter a Zipcode and click calculate to proceed', 'wpsc'));
$is_valid = false;
}
}
}
wpsc_update_customer_meta('checkout_misc_error_messages', $error_messages);
if ($is_valid == true) {
wpsc_delete_customer_meta('category_shipping_conflict');
// check that the submitted gateway is in the list of selected ones
$sessionid = mt_rand(100, 999) . time();
wpsc_update_customer_meta('checkout_session_id', $sessionid);
$subtotal = $wpsc_cart->calculate_subtotal();
if ($wpsc_cart->has_total_shipping_discount() == false) {
$base_shipping = $wpsc_cart->calculate_base_shipping();
} else {
$base_shipping = 0;
}
$delivery_country = $wpsc_cart->delivery_country;
$delivery_region = $wpsc_cart->delivery_region;
if (wpsc_uses_shipping()) {
//.........这里部分代码省略.........
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:101,代码来源:ajax.php
示例13: wpsc_coupon_price
/**
* coupons price, used through ajax and in normal page loading.
* No parameters, returns nothing
*/
function wpsc_coupon_price($currCoupon = '')
{
global $wpsc_cart, $wpsc_coupons;
if (isset($_POST['coupon_num']) && $_POST['coupon_num'] != '') {
$coupon = esc_sql($_POST['coupon_num']);
wpsc_update_customer_meta('coupon', $coupon);
$wpsc_coupons = new wpsc_coupons($coupon);
if ($wpsc_coupons->validate_coupon()) {
$discountAmount = $wpsc_coupons->calculate_discount();
$wpsc_cart->apply_coupons($discountAmount, $coupon);
$wpsc_coupons->errormsg = false;
} else {
$wpsc_coupons->errormsg = true;
$wpsc_cart->coupons_amount = 0;
$wpsc_cart->coupons_name = '';
wpsc_delete_customer_meta('coupon');
}
} else {
if ((!isset($_POST['coupon_num']) || $_POST['coupon_num'] == '') && $currCoupon == '') {
$wpsc_cart->coupons_amount = 0;
$wpsc_cart->coupons_name = '';
} else {
if ($currCoupon != '') {
$coupon = esc_sql($currCoupon);
wpsc_update_customer_meta('coupon', $coupon);
$wpsc_coupons = new wpsc_coupons($coupon);
if ($wpsc_coupons->validate_coupon()) {
$discountAmount = $wpsc_coupons->calculate_discount();
$wpsc_cart->apply_coupons($discountAmount, $coupon);
$wpsc_coupons->errormsg = false;
}
}
}
}
}
开发者ID:parkesma,项目名称:WP-e-Commerce,代码行数:39,代码来源:cart-template-api.php
示例14: validate
/**
* Validate
* Checks to make sure the current user can use this gateway.
* @since 1.3
* @version 1.1
*/
function validate($purchase_log)
{
$error = false;
$user_id = get_current_user_id();
// Get cost
$cart_total = $this->cart_data['total_price'];
if ($this->prefs['rate'] != 1) {
$cart_total = $this->prefs['rate'] * $cart_total;
}
$cart_total = $this->core->number($cart_total);
$this->cost = $cart_total;
// User is not logged in
if (!is_user_logged_in()) {
$error = $this->core->template_tags_general($this->prefs['visitor']);
} elseif ($this->core->exclude_user($user_id)) {
$error = __('You can not use this gateway.', 'mycred');
} else {
// Rate
$balance = $this->core->get_users_cred($user_id, $this->mycred_type);
if ($balance < $this->cost) {
$error = $this->core->template_tags_general($this->prefs['low_funds']);
}
}
// Let others decline a store order
$decline = apply_filters('mycred_decline_store_purchase', $error, $purchase_log, $this);
if ($decline !== false) {
wpsc_delete_customer_meta('selected_gateway');
$this->set_error_message($decline);
$purchase_log->delete($this->purchase_id);
unset($_SESSION['WpscGatewayErrorMessage']);
$this->return_to_checkout();
exit;
}
// Prep for payment
$this->user_id = $user_id;
$this->transaction_id = 'MYCRED' . $user_id . time();
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:43,代码来源:mycred-wpecommerce.php
示例15: wpsc_transaction_theme
function wpsc_transaction_theme()
{
global $wpdb, $user_ID, $nzshpcrt_gateways, $sessionid, $cart_log_id, $errorcode;
$errorcode = '';
$transactid = '';
$dont_show_transaction_results = false;
if (isset($_GET['sessionid'])) {
$sessionid = $_GET['sessionid'];
}
if (!isset($_GET['sessionid']) && isset($_GET['ms'])) {
$sessionid = $_GET['ms'];
}
$selected_gateway = wpsc_get_customer_meta('selected_gateway');
if ($selected_gateway && in_array($selected_gateway, array('paypal_certified', 'wpsc_merchant_paypal_express'))) {
$sessionid = wpsc_get_customer_meta('paypal_express_sessionid');
}
if (isset($_REQUEST['eway']) && '1' == $_REQUEST['eway']) {
$sessionid = $_GET['result'];
} elseif (isset($_REQUEST['eway']) && '0' == $_REQUEST['eway']) {
echo wpsc_get_customer_meta('eway_message');
} elseif (isset($_REQUEST['payflow']) && '1' == $_REQUEST['payflow']) {
echo wpsc_get_customer_meta('payflow_message');
wpsc_delete_customer_meta('payflow_message');
}
$dont_show_transaction_results = false;
if ($selected_gateway) {
// Replaces the ugly if else for gateways
switch ($selected_gateway) {
case 'paypal_certified':
case 'wpsc_merchant_paypal_express':
echo wpsc_get_customer_meta('paypal_express_message');
$reshash = wpsc_get_customer_meta('paypal_express_reshash');
if (isset($reshash['PAYMENTINFO_0_TRANSACTIONTYPE']) && in_array($reshash['PAYMENTINFO_0_TRANSACTIONTYPE'], array('expresscheckout', 'cart'))) {
$dont_show_transaction_results = false;
} else {
$dont_show_transaction_results = true;
}
break;
case 'dps':
$sessionid = decrypt_dps_response();
break;
//paystation was not updating the purchase logs for successful payment - this is ugly as need to have the databse update done in one place by all gatways on a sucsessful transaction hook not some within the gateway and some within here and some not at all??? This is getting a major overhaul but for here and now it just needs to work for the gold cart people!
//paystation was not updating the purchase logs for successful payment - this is ugly as need to have the databse update done in one place by all gatways on a sucsessful transaction hook not some within the gateway and some within here and some not at all??? This is getting a major overhaul but for here and now it just needs to work for the gold cart people!
case 'paystation':
$ec = $_GET['ec'];
$result = $_GET['em'];
if ($result == 'Transaction successful' && $ec == 0) {
$processed_id = '3';
}
if ($result == 'Insufficient Funds' && $ec == 5) {
$processed_id = '6';
}
if ($processed_id) {
wpsc_update_purchase_log_status($sessionid, $processed_id, 'sessionid');
}
break;
case 'wpsc_merchant_paymentexpress':
// Payment Express sends back there own session id, which is temporarily stored in the Auth field
// so just swapping that over here
$query = "SELECT `sessionid` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `authcode` ='" . $sessionid . "'";
$result = $wpdb->get_var($query);
if ($result != null) {
// just in case they are using an older version old gold cart (pre 2.9.5)
$sessionid = $result;
$dont_show_transaction_results = true;
}
break;
case 'eway_hosted':
$sessionid = decrypt_eway_uk_response();
break;
//default filter for other payment gateways to use
//default filter for other payment gateways to use
default:
$sessionid = apply_filters('wpsc_previous_selected_gateway_' . $selected_gateway, $sessionid);
break;
}
}
if (!$dont_show_transaction_results) {
if (!empty($sessionid)) {
$cart_log_id = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= %s LIMIT 1", $sessionid));
echo transaction_results($sessionid, true);
} else {
printf(__('Sorry your transaction was not accepted.<br /><a href="%1$s">Click here to go back to checkout page</a>.', 'wp-e-commerce'), wpsc_get_checkout_url());
}
}
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:86,代码来源:checkout-results.php
示例16: wpec_auth_net_user_profile_display
function wpec_auth_net_user_profile_display()
{
$myGateway = new wpec_auth_net();
$creditcards = $myGateway->getCreditCardProfiles();
$bankaccounts = $myGateway->getBankAccountProfiles();
$shipaddress = $myGateway->getShippingProfiles();
$auth_net_message = wpsc_get_customer_meta('auth_net_message');
?>
<div id='wpec_auth_net_user_profile_manager'>
<h2><?php
_e('Saved Credit Card, Bank and Shipping Information', 'wpsc_gold_cart');
?>
</h2>
<?php
if (isGood($auth_net_message)) {
?>
<div class='notice'><?php
echo $auth_net_message;
?>
</div>
<?php
wpsc_delete_customer_meta('auth_net_message');
}
if ($bankaccounts) {
?>
<form action="<?php
echo $wpec_auth_net_user_profile_url;
?>
" method="post">
<div id='bankaccounts'class='sectionBox'>
<span class="sectionHeader"><?php
_e("Bank Accounts You've Saved For Easy Checkout.", 'wpsc_gold_cart');
?>
</span>
<div class="displayList"><?php
echo $bankaccounts;
?>
</div>
<input type='hidden' name='type' value='bankaccounts'>
<input type='submit' name='submit' class='btn' value='Delete'>
</div>
</form>
<?php
}
?>
<?php
if ($creditcards) {
?>
<form action="<?php
echo $wpec_auth_net_user_profile_url;
?>
" method="post">
<div id='creditcards'class='sectionBox'>
<span class="sectionHeader"><?php
_e("Credit Cards You've Saved For Easy Checkout.", 'wpsc_gold_cart');
?>
</span>
<div class="displayList"><?php
echo $creditcards;
?>
</div>
<input type='hidden' name='type' value='creditcards'>
<input type='submit' name='submit' class='btn' value='Delete'>
</div>
</form>
<?php
}
?>
<?php
if ($shipaddress) {
?>
<form action="<?php
echo $wpec_auth_net_user_profile_url;
?>
" method="post">
<div id='shipaddress'class='sectionBox'>
<span class="sectionHeader"><?php
_e("Shipping Addresses You've Saved For Easy Checkout.", 'wpsc_gold_cart');
?>
</span>
<div class="displayList"><?php
echo $shipaddress;
?>
</div>
<input type='hidden' name='type' value='shippingaddress'>
<input type='submit' class='btn' name='submit' value='Delete'>
</div>
</form>
<?php
}
?>
</div>
<?php
}
开发者ID:benhuson,项目名称:Gold-Cart,代码行数:94,代码来源:user_profile.php
示例17: _action_shutdown
public function _action_shutdown()
{
$this->wizard->reset();
wpsc_delete_customer_meta('current_purchase_log_id');
}
开发者ID:androidprojectwork,项目名称:WP-e-Commerce,代码行数:5,代码来源:checkout.php
示例18: rewind_checkout_items
function rewind_checkout_items()
{
global $wpsc_checkout_error_messages;
$wpsc_checkout_error_messages = array();
wpsc_delete_customer_meta('checkout_error_messages');
$this->current_checkout_item = -1;
if ($this->checkout_item_count > 0) {
$this->checkout_item = $this->checkout_items[0];
}
}
开发者ID:ashik968,项目名称:digiplot,代码行数:10,代码来源:checkout.class.php
示例19: callback_confirm_transaction
/**
* Confirm Transaction Callback
*
* @return bool
*
* @since 3.9
*/
public function callback_confirm_transaction()
{
if (!isset($_REQUEST['sessionid']) || !isset($_REQUEST['token']) || !isset($_REQUEST['PayerID'])) {
return false;
}
// Set the Purchase Log
$this->set_purchase_log_for_callbacks();
// Display the Confirmation Page
$this->do_transaction();
// Remove Shortcut option if it exists
$sessionid = $_REQUEST['sessionid'];
wpsc_delete_customer_meta('esc-' . $sessionid);
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:20,代码来源:paypal-express-checkout.php
|
请发表评论