本文整理汇总了PHP中wpsc_uses_shipping函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_uses_shipping函数的具体用法?PHP wpsc_uses_shipping怎么用?PHP wpsc_uses_shipping使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_uses_shipping函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpsc_buy_now_button
/**
* wpsc buy now button code products function
* Sorry about the ugly code, this is just to get the functionality back, buy now will soon be overhauled, and this function will then be completely different
* @return string - html displaying one or more products
*/
function wpsc_buy_now_button($product_id, $replaced_shortcode = false)
{
$product = get_post($product_id);
$supported_gateways = array('wpsc_merchant_paypal_standard', 'paypal_multiple');
$selected_gateways = get_option('custom_gateway_options');
if (in_array('wpsc_merchant_paypal_standard', (array) $selected_gateways)) {
if ($product_id > 0) {
$post_meta = get_post_meta($product_id, '_wpsc_product_metadata', true);
$shipping = $post_meta['shipping']['local'];
$price = get_post_meta($product_id, '_wpsc_price', true);
$special_price = get_post_meta($product_id, '_wpsc_special_price', true);
if ($special_price) {
$price = $special_price;
}
if (wpsc_uses_shipping()) {
$handling = get_option('base_local_shipping');
} else {
$handling = $shipping;
}
$output .= "<form onsubmit='log_paypal_buynow(this)' target='paypal' action='" . get_option('paypal_multiple_url') . "' method='post' />\n\t\t\t\t<input type='hidden' name='business' value='" . get_option('paypal_multiple_business') . "' />\n\t\t\t\t<input type='hidden' name='cmd' value='_xclick' />\n\t\t\t\t<input type='hidden' name='item_name' value='" . $product->post_title . "' />\n\t\t\t\t<input type='hidden' id='item_number' name='item_number' value='" . $product_id . "' />\n\t\t\t\t<input type='hidden' id='amount' name='amount' value='" . $price . "' />\n\t\t\t\t<input type='hidden' id='unit' name='unit' value='" . $price . "' />\n\t\t\t\t<input type='hidden' id='shipping' name='ship11' value='" . $shipping . "' />\n\t\t\t\t<input type='hidden' name='handling' value='" . $handling . "' />\n\t\t\t\t<input type='hidden' name='currency_code' value='" . get_option('paypal_curcode') . "' />";
if (get_option('multi_add') == 1) {
$output .= "<label for='quantity'>" . __('Quantity', 'wpsc') . "</label>";
$output .= "<input type='text' size='4' id='quantity' name='quantity' value='' /><br />";
} else {
$output .= "<input type='hidden' name='undefined_quantity' value='0' />";
}
$output .= "<input type='image' name='submit' border='0' src='https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif' alt='PayPal - The safer, easier way to pay online' />\n\t\t\t\t<img alt='' border='0' width='1' height='1' src='https://www.paypal.com/en_US/i/scr/pixel.gif' />\n\t\t\t</form>\n\r";
}
}
if ($replaced_shortcode == true) {
return $output;
} else {
echo $output;
}
}
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:40,代码来源:display.functions.php
示例2: add_ecs_button
/**
* Insert the ExpessCheckout Shortcut Button
*
* @return void
*/
public function add_ecs_button($cart_table, $context)
{
if (wpsc_uses_shipping() || !wpsc_is_gateway_active('paypal-digital-goods')) {
return;
}
if ('bottom' == $context) {
return;
}
if (_wpsc_get_current_controller_name() === 'cart') {
$url = $this->get_shortcut_url();
echo '<a class="express-checkout-button" id="pp-ecs-dg" href="' . esc_url($url) . '"><img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="' . __('Check out with PayPal', 'wp-e-commerce') . '" /></a>';
}
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:18,代码来源:paypal-digital-goods.php
示例3: wpsc_buy_now_button
/**
* wpsc buy now button code products function
* Sorry about the ugly code, this is just to get the functionality back, buy now will soon be overhauled, and this function will then be completely different
* @return string - html displaying one or more products
*/
function wpsc_buy_now_button($product_id, $replaced_shortcode = false)
{
global $wpdb, $wpsc_query, $wpsc_cart;
$temp_wpsc_query = new WPSC_query(array('product_id' => $product_id));
list($wpsc_query, $temp_wpsc_query) = array($temp_wpsc_query, $wpsc_query);
// swap the wpsc_query objects
// exit('<pre>'.print_r($temp_wpsc_query, true).'</pre>');
$selected_gateways = get_option('custom_gateway_options');
if (in_array('google', (array) $selected_gateways)) {
$output .= google_buynow($product['id']);
} else {
if (in_array('paypal_multiple', (array) $selected_gateways)) {
if ($product_id > 0) {
//$output .= "<pre>".print_r($wpsc_query,true)."</pre>";
while (wpsc_have_products()) {
wpsc_the_product();
$price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations);
$shipping = $wpsc_query->product['pnp'];
if (wpsc_uses_shipping()) {
$handling = get_option('base_local_shipping');
} else {
$handling = $shipping;
}
$output .= "<form onsubmit='log_paypal_buynow(this)' target='paypal' action='" . get_option('paypal_multiple_url') . "' method='post' />\r\n\t\t\t\t\t<input type='hidden' name='business' value='" . get_option('paypal_multiple_business') . "' />\r\n\t\t\t\t\t<input type='hidden' name='cmd' value='_xclick' />\r\n\t\t\t\t\t<input type='hidden' name='item_name' value='" . wpsc_the_product_title() . "' />\r\n\t\t\t\t\t<input type='hidden' id='item_number' name='item_number' value='" . wpsc_the_product_id() . "' />\r\n\t\t\t\t\t<input type='hidden' id='amount' name='amount' value='" . ($price + $pnp) . "' />\r\n\t\t\t\t\t<input type='hidden' id='unit' name='unit' value='" . $price . "' />\r\n\t\t\t\t\t<input type='hidden' id='shipping' name='ship11' value='" . $shipping . "' />\r\n\t\t\t\t\t<input type='hidden' name='handling' value='" . $handling . "' />\r\n\t\t\t\t\t<input type='hidden' name='currency_code' value='" . get_option('paypal_curcode') . "' />";
if (get_option('multi_add') == 1) {
$output .= "<label for='quantity'>" . __('Quantity', 'wpsc') . "</label>";
$output .= "<input type='text' size='4' id='quantity' name='quantity' value='' /><br />";
} else {
$output .= "<input type='hidden' name='undefined_quantity' value='0' />";
}
$output .= "<input type='image' name='submit' border='0' src='https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif' alt='PayPal - The safer, easier way to pay online' />\r\n\t\t\t\t\t<img alt='' border='0' width='1' height='1' src='https://www.paypal.com/en_US/i/scr/pixel.gif' />\r\n\t\t\t\t</form>\n\r";
}
}
}
}
list($temp_wpsc_query, $wpsc_query) = array($wpsc_query, $temp_wpsc_query);
// swap the wpsc_query objects back
if ($replaced_shortcode == true) {
return $output;
} else {
echo $output;
}
}
开发者ID:BGCX261,项目名称:zombie-craft-svn-to-git,代码行数:48,代码来源:display.functions.php
示例4: Usecase
function Usecase($seperator, $sessionid, $fromcheckout)
{
global $wpdb, $wpsc_cart;
$purchase_log_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= " . $sessionid . " LIMIT 1";
$purchase_log = $wpdb->get_results($purchase_log_sql, ARRAY_A);
$cart_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='" . $purchase_log[0]['id'] . "'";
$wp_cart = $wpdb->get_results($cart_sql, ARRAY_A);
$merchant_id = get_option('google_id');
$merchant_key = get_option('google_key');
$server_type = get_option('google_server_type');
$currency = get_option('google_cur');
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
$transact_url = get_option('transact_url');
$returnURL = $transact_url . $seperator . "sessionid=" . $sessionid . "&gateway=google";
$cart->SetContinueShoppingUrl($returnURL);
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
$no = 1;
//exit("<pre>".print_r($wpsc_cart,true)."</pre>");
//new item code
$no = 0;
// $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
// foreach($wpsc_cart->cart_items as $item){
//google prohibited items not implemented
$curr = new CURRENCYCONVERTER();
$currency_code = $wpdb->get_results("SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . get_option('currency_type') . "' LIMIT 1", ARRAY_A);
$local_currency_code = $currency_code[0]['code'];
// exit('<pre>'.print_r($_REQUEST,true).'</pre>');
$google_curr = get_option('google_cur');
while (wpsc_have_cart_items()) {
wpsc_the_cart_item();
if ($google_curr != $local_currency_code) {
$google_currency_productprice = $curr->convert(wpsc_cart_item_price(false) / wpsc_cart_item_quantity(), $google_curr, $local_currency_code);
$google_currency_shipping = $curr->convert($wpsc_cart->selected_shipping_amount, $google_curr, $local_currency_code);
} else {
$google_currency_productprice = wpsc_cart_item_price(false) / wpsc_cart_item_quantity() + wpsc_cart_item_shipping(false);
$google_currency_shipping = $wpsc_cart->selected_shipping_amount;
}
// exit('<pre>'.print_r(wpsc_cart_item_name(),true).'</pre>');
$cartitem["{$no}"] = new GoogleItem(wpsc_cart_item_name(), '', wpsc_cart_item_quantity(), $google_currency_productprice);
$cart->AddItem($cartitem["{$no}"]);
$no++;
}
//If there are coupons applied add coupon as a product with negative price
if ($wpsc_cart->coupons_amount > 0) {
if ($google_curr != $local_currency_code) {
$google_currency_productprice = $curr->convert($wpsc_cart->coupons_amount, $google_curr, $local_currency_code);
} else {
$google_currency_productprice = $wpsc_cart->coupons_amount;
}
$cartitem[$no] = new GoogleItem('Discount', 'Discount Price', 1, '-' . $google_currency_productprice);
// Unit price
$cart->AddItem($cartitem[$no]);
}
// }
// Add shipping options
if (wpsc_uses_shipping() && $google_currency_shipping > 0) {
$Gfilter = new GoogleShippingFilters();
$google_checkout_shipping = get_option("google_shipping_country");
$googleshippingcountries = count($google_checkout_shipping);
//exit('<pre>'.print_r($googleshipping, true).'</pre>');
if ($googleshippingcountries == 242) {
$Gfilter->SetAllowedWorldArea(true);
} else {
if (is_array($google_checkout_shipping)) {
$google_shipping_country_ids = implode(",", $google_checkout_shipping);
}
$google_shipping_country = $wpdb->get_col("SELECT `isocode` FROM " . WPSC_TABLE_CURRENCY_LIST . " WHERE id IN (" . $google_shipping_country_ids . ")");
foreach ($google_shipping_country as $isocode) {
//exit($isocode);
$Gfilter->AddAllowedPostalArea($isocode);
if ($isocode == 'US') {
$Gfilter->SetAllowedCountryArea('ALL');
}
}
}
$Gfilter->SetAllowUsPoBox(false);
$ship_1 = new GoogleFlatRateShipping('Flat Rate Shipping', $google_currency_shipping);
$ship_1->AddShippingRestrictions($Gfilter);
$cart->AddShipping($ship_1);
}
//wpsc_google_shipping_quotes();
// Add tax rules
//if ($_SESSION['wpsc_selected_country']=='US'){
//set default tax
//exit('<pre>'.print_r($_SESSION,true).'</pre>');
$sql = "SELECT `name`, `tax` FROM " . WPSC_TABLE_REGION_TAX . " WHERE id='" . $_SESSION['wpsc_selected_region'] . "'";
//exit('<pre>'.print_r($sql, true).'</pre>');
$state_name = $wpdb->get_row($sql, ARRAY_A);
//exit('<pre>'.print_r($state_name, true).'</pre>');
$defaultTax = $state_name['tax'] / 100;
$tax_rule = new GoogleDefaultTaxRule($defaultTax);
$sql = "SELECT `code` FROM " . WPSC_TABLE_REGION_TAX . " WHERE `country_id`='136' AND `tax` = " . $state_name['tax'];
$states = $wpdb->get_col($sql);
//exit('<pre>'.print_r($states, true).'</pre>');
$tax_rule->SetStateAreas((array) $states);
$cart->AddDefaultTaxRules($tax_rule);
//get alternative tax rates
$sql = "SELECT DISTINCT `tax` FROM " . WPSC_TABLE_REGION_TAX . " WHERE `tax` != 0 AND `tax` !=" . $state_name['tax'] . " AND `country_id`='136' ORDER BY `tax`";
$othertax = $wpdb->get_col($sql);
$i = 1;
//.........这里部分代码省略.........
开发者ID:Jonathonbyrd,项目名称:wp-ecommerce,代码行数:101,代码来源:GoogleCheckout-XML.php
示例5: form_field
/**
* form_field method, returns the form html
* @access public
*/
function form_field()
{
global $wpdb, $user_ID;
if ($user_ID > 0) {
if (!isset($_SESSION['wpsc_checkout_saved_values'])) {
$_SESSION['wpsc_checkout_saved_values'] = get_user_meta($user_ID, 'wpshpcrt_usr_profile', 1);
}
$delivery_country_id = wpsc_get_country_form_id_by_type('delivery_country');
$billing_country_id = wpsc_get_country_form_id_by_type('country');
}
$saved_form_data = @htmlentities(stripslashes((string) $_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id]), ENT_QUOTES, 'UTF-8');
$an_array = '';
if (function_exists('wpsc_get_ticket_checkout_set')) {
if ($this->checkout_item->checkout_set == wpsc_get_ticket_checkout_set()) {
$an_array = '[]';
}
}
switch ($this->checkout_item->type) {
case "address":
case "delivery_address":
case "textarea":
$output = "<textarea title='" . $this->checkout_item->unique_name . "' class='text' id='" . $this->form_element_id() . "' name='collected_data[{$this->checkout_item->id}]" . $an_array . "' rows='3' cols='40' >" . $saved_form_data . "</textarea>";
break;
case "checkbox":
$options = $this->get_checkout_options($this->checkout_item->id);
if ($options != '') {
$i = mt_rand();
foreach ($options as $label => $value) {
$output .= "<input type='hidden' title='" . $this->checkout_item->unique_name . "' id='" . $this->form_element_id() . "' value='-1' name='collected_data[{$this->checkout_item->id}][" . $i . "]'/><input type='checkbox' title='" . $this->checkout_item->unique_name . "' id='" . $this->form_element_id() . "' value='" . esc_attr($value) . "' name='collected_data[{$this->checkout_item->id}][" . $i . "]'/> ";
$output .= "<label for='" . $this->form_element_id() . "'>" . $label . "</label>";
}
}
break;
case "country":
$output = wpsc_country_region_list($this->checkout_item->id, false, $_SESSION['wpsc_selected_country'], $_SESSION['wpsc_selected_region'], $this->form_element_id());
break;
case "delivery_country":
if (wpsc_uses_shipping()) {
$country_name = $wpdb->get_var("SELECT `country` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `isocode`='" . $_SESSION['wpsc_delivery_country'] . "' LIMIT 1");
$output = "<input title='" . $this->checkout_item->unique_name . "' type='hidden' id='" . $this->form_element_id() . "' class='shipping_country' name='collected_data[{$this->checkout_item->id}]' value='" . esc_attr($_SESSION['wpsc_delivery_country']) . "' size='4' /><span class='shipping_country_name'>" . $country_name . "</span> ";
} else {
$checkoutfields = true;
$output = wpsc_country_region_list($this->checkout_item->id, false, $_SESSION['wpsc_delivery_country'], $_SESSION['wpsc_delivery_region'], $this->form_element_id(), $checkoutfields);
}
break;
case "select":
$options = $this->get_checkout_options($this->checkout_item->id);
if ($options != '') {
$output = "<select name='collected_data[{$this->checkout_item->id}]" . $an_array . "'>";
$output .= "<option value='-1'>Select an Option</option>";
foreach ((array) $options as $label => $value) {
$value = esc_attr(str_replace(' ', '', $value));
$output .= "<option value='" . esc_attr($value) . "'>" . esc_html($label) . "</option>\n\r";
}
$output .= "</select>";
}
break;
case "radio":
$options = $this->get_checkout_options($this->checkout_item->id);
if ($options != '') {
$i = mt_rand();
foreach ((array) $options as $label => $value) {
$output .= "<input type='radio' title='" . $this->checkout_item->unique_name . "' id='" . $this->form_element_id() . "'value='" . esc_attr($value) . "' name='collected_data[{$this->checkout_item->id}][" . $i . "]'/> ";
$output .= "<label for='" . $this->form_element_id() . "'>" . $label . "</label>";
}
}
break;
case "text":
case "city":
case "delivery_city":
case "email":
case "coupon":
default:
if ($this->checkout_item->unique_name == 'shippingstate') {
if (wpsc_uses_shipping() && wpsc_has_regions($_SESSION['wpsc_delivery_country'])) {
$region_name = $wpdb->get_var("SELECT `name` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id`='" . $_SESSION['wpsc_delivery_region'] . "' LIMIT 1");
$output = "<input title='" . $this->checkout_item->unique_name . "' type='hidden' id='" . $this->form_element_id() . "' class='shipping_region' name='collected_data[{$this->checkout_item->id}]' value='" . $_SESSION['wpsc_delivery_region'] . "' size='4' /><span class='shipping_region_name'>" . $region_name . "</span> ";
} else {
$disabled = '';
if (wpsc_disregard_shipping_state_fields()) {
$disabled = 'disabled = "disabled"';
}
$output = "<input class='shipping_region text' title='" . $this->checkout_item->unique_name . "' type='text' id='" . $this->form_element_id() . "' value='" . $saved_form_data . "' name='collected_data[{$this->checkout_item->id}]" . $an_array . "' " . $disabled . " />";
}
} elseif ($this->checkout_item->unique_name == 'billingstate') {
if (wpsc_uses_shipping() && wpsc_has_regions($_SESSION['wpsc_selected_country'])) {
$output = '';
} else {
$disabled = '';
if (wpsc_disregard_billing_state_fields()) {
$disabled = 'disabled = "disabled"';
}
$output = "<input class='billing_region text' title='" . $this->checkout_item->unique_name . "' type='text' id='" . $this->form_element_id() . "' value='" . $saved_form_data . "' name='collected_data[{$this->checkout_item->id}]" . $an_array . "' " . $disabled . " />";
}
} else {
$output = "<input title='" . $this->checkout_item->unique_name . "' type='text' id='" . $this->form_element_id() . "' class='text' value='" . $saved_form_data . "' name='collected_data[{$this->checkout_item->id}]" . $an_array . "' />";
//.........这里部分代码省略.........
开发者ID:hornet9,项目名称:Morato,代码行数:101,代码来源:checkout.class.php
示例6: wpsc_buy_now_button
/**
* wpsc buy now button code products function
* Sorry about the ugly code, this is just to get the functionality back, buy now will soon be overhauled, and this function will then be completely different
* @return string - html displaying one or more products
*/
function wpsc_buy_now_button($product_id, $replaced_shortcode = false)
{
$product_id = absint($product_id);
$product = get_post($product_id);
$supported_gateways = array('wpsc_merchant_paypal_standard', 'paypal_multiple');
$selected_gateways = get_option('custom_gateway_options');
if ($replaced_shortcode) {
ob_start();
}
if (in_array('wpsc_merchant_paypal_standard', (array) $selected_gateways)) {
if ($product_id > 0) {
$post_meta = get_post_meta($product_id, '_wpsc_product_metadata', true);
$shipping = isset($post_meta['shipping']) ? $post_meta['shipping']['local'] : '';
$price = get_post_meta($product_id, '_wpsc_price', true);
$special_price = get_post_meta($product_id, '_wpsc_special_price', true);
if ($special_price) {
$price = $special_price;
}
if (wpsc_uses_shipping()) {
$handling = get_option('base_local_shipping');
} else {
$handling = $shipping;
}
$has_variants = wpsc_product_has_variations($product_id);
$src = apply_filters('wpsc_buy_now_button_src', _x('https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif', 'PayPal Buy Now Button', 'wpsc'));
$classes = apply_filters('wpsc_buy_now_button_class', "wpsc-buy-now-form wpsc-buy-now-form-{$product_id}");
$classes_array = array_map('sanitize_html_class', explode(' ', $classes));
$classes = implode(' ', $classes_array);
$button_html = sprintf('<input%1$s class="wpsc-buy-now-button wpsc-buy-now-button-%2$s" type="image" name="submit" border="0" src="%3$s" alt="%4$s" />', disabled($has_variants, true, false), esc_attr($product_id), esc_url($src), esc_attr__('PayPal - The safer, easier way to pay online', 'wpsc'));
$button_html = apply_filters('wpsc_buy_now_button_html', $button_html, $product_id);
?>
<form class="<?php
echo $classes;
?>
" id="buy-now-product_<?php
echo $product_id;
?>
" target="paypal" action="<?php
echo esc_url(home_url());
?>
" method="post">
<input type="hidden" name="wpsc_buy_now_callback" value="1" />
<input type="hidden" name="product_id" value="<?php
echo esc_attr($product_id);
?>
" />
<?php
if ($has_variants) {
// grab the variation form fields here
$wpsc_variations = new wpsc_variations($product_id);
while (wpsc_have_variation_groups()) {
wpsc_the_variation_group();
printf('<input type="hidden" class="variation-value" name="variation[%1$d]" id="%2$s" value="0"/>', wpsc_vargrp_id(), wpsc_vargrp_form_id());
}
}
/* END wpsc_product_has_variations */
?>
<?php
if (get_option('multi_add')) {
?>
<label for="quantity"><?php
esc_html_e('Quantity', 'wpsc');
?>
</label>
<input type="text" size="4" id="quantity" name="quantity" value="" /><br />
<?php
} else {
?>
<input type="hidden" name="quantity" value="1" />
<?php
}
?>
<?php
echo $button_html;
?>
<img alt='' border='0' width='1' height='1' src='<?php
echo esc_url(_x('https://www.paypal.com/en_US/i/scr/pixel.gif', 'PayPal Pixel', 'wpsc'));
?>
' />
</form>
<?php
}
}
if ($replaced_shortcode) {
return ob_get_clean();
}
}
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:92,代码来源:product.php
示例7: calculate_total_shipping
/**
* calculate_total_shipping method, gets the shipping option from the selected method and associated quotes
* @access public
* @return float returns the shipping as a floating point value
*/
function calculate_total_shipping()
{
if (!(get_option('shipping_discount') == 1 && get_option('shipping_discount_value') <= $this->calculate_subtotal()) && wpsc_uses_shipping()) {
$total = $this->calculate_base_shipping();
$total += $this->calculate_per_item_shipping();
} else {
$total = 0;
}
return $total;
}
开发者ID:hornet9,项目名称:Morato,代码行数:15,代码来源:cart.class.php
示例8: array
<?php
$args = array('remember' => false, 'redirect' => get_option('shopping_cart_url'));
wp_login_form($args);
?>
<div class="wpsc_signup_text"><?php
_e('If you have bought from us before, please sign in here to purchase.', 'wp-e-commerce');
?>
</div>
</fieldset>
</div>
<?php
}
?>
<table class='wpsc_checkout_table wpsc_checkout_table_totals'>
<?php
if (wpsc_uses_shipping()) {
?>
<tr class="total_price total_shipping">
<td class='wpsc_totals'>
<?php
_e('Total Shipping:', 'wp-e-commerce');
?>
</td>
<td class='wpsc_totals'>
<span id="checkout_shipping" class="pricedisplay checkout-shipping"><?php
echo wpsc_cart_shipping();
?>
</span>
</td>
</tr>
<?php
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:31,代码来源:wpsc-shopping_cart_page.php
示例9: wpsc_disregard_shipping_state_fields
/**
* disregard state fields - checks to see whether selected country has regions or not,
* depending on the scenario will return wither a true or false
* @access public
*
* @since 3.8
* @return (boolean) true or false
*/
function wpsc_disregard_shipping_state_fields()
{
global $wpsc_checkout;
if (!wpsc_uses_shipping()) {
$delivery_country = wpsc_get_customer_meta('shipping_country');
if ('shippingstate' == $wpsc_checkout->checkout_item->unique_name && wpsc_has_regions($delivery_country)) {
return true;
} else {
return false;
}
} elseif ('billingstate' == $wpsc_checkout->checkout_item->unique_name && wpsc_has_regions(wpsc_get_customer_meta('billingcountry'))) {
return true;
}
return false;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:23,代码来源:checkout.php
示例10: init_shipping_calculator
private function init_shipping_calculator()
{
if (!wpsc_uses_shipping()) {
return;
}
$current_log_id = $this->get_purchase_log();
require_once WPSC_TE_V2_CLASSES_PATH . '/shipping-calculator.php';
$this->shipping_calculator = new WPSC_Shipping_Calculator($current_log_id);
}
开发者ID:androidprojectwork,项目名称:WP-e-Commerce,代码行数:9,代码来源:checkout.php
示例11: wpsc_buy_now_button
/**
* wpsc buy now button code products function
* Sorry about the ugly code, this is just to get the functionality back, buy now will soon be overhauled, and this function will then be completely different
* @return string - html displaying one or more products
*/
function wpsc_buy_now_button($product_id, $replaced_shortcode = false)
{
$product = get_post($product_id);
$supported_gateways = array('wpsc_merchant_paypal_standard', 'paypal_multiple');
$selected_gateways = get_option('custom_gateway_options');
if ($replaced_shortcode) {
ob_start();
}
if (in_array('wpsc_merchant_paypal_standard', (array) $selected_gateways)) {
if ($product_id > 0) {
$post_meta = get_post_meta($product_id, '_wpsc_product_metadata', true);
$shipping = isset($post_meta['shipping']) ? $post_meta['shipping']['local'] : '';
$price = get_post_meta($product_id, '_wpsc_price', true);
$special_price = get_post_meta($product_id, '_wpsc_special_price', true);
if ($special_price) {
$price = $special_price;
}
if (wpsc_uses_shipping()) {
$handling = get_option('base_local_shipping');
} else {
$handling = $shipping;
}
$src = _x('https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif', 'PayPal Buy Now Button', 'wpsc');
$src = apply_filters('wpsc_buy_now_button_src', $src);
$classes = "wpsc-buy-now-form wpsc-buy-now-form-{$product_id}";
$button_html = '<input class="wpsc-buy-now-button wpsc-buy-now-button-' . esc_attr($product_id) . '" type="image" name="submit" border="0" src=' . esc_url($src) . ' alt="' . esc_attr('PayPal - The safer, easier way to pay online', 'wpsc') . '" />';
$button_html = apply_filters('wpsc_buy_now_button_html', $button_html, $product_id);
?>
<form class="<?php
echo esc_attr($classes);
?>
" target="paypal" action="<?php
echo esc_url(home_url());
?>
" method="post">
<input type="hidden" name="wpsc_buy_now_callback" value="1" />
<input type="hidden" name="product_id" value="<?php
echo esc_attr($product_id);
?>
" />
<?php
if (get_option('multi_add')) {
?>
<label for="quantity"><?php
esc_html_e('Quantity', 'wpsc');
?>
</label>
<input type="text" size="4" id="quantity" name="quantity" value="" /><br />
<?php
} else {
?>
<input type="hidden" name="quantity" value="1" />
<?php
}
?>
<?php
echo $button_html;
?>
<img alt='' border='0' width='1' height='1' src='<?php
echo esc_url(_x('https://www.paypal.com/en_US/i/scr/pixel.gif', 'PayPal Pixel', 'wpsc'));
?>
' />
</form>
<?php
}
}
if ($replaced_shortcode) {
return ob_get_clean();
}
}
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:75,代码来源:display.functions.php
示例12: transaction_results
//.........这里部分代码省略.........
', 'wpsc'), $shipping_price);
}
}
//add tax if included
if ($wpec_taxes_controller->wpec_taxes_isenabled() && $wpec_taxes_controller->wpec_taxes_isincluded()) {
$taxes_text = ' - - ' . __('Tax Included', 'wpsc') . ': ' . wpsc_currency_display($row['tax_charged'], array('display_as_html' => false)) . "\n\r";
$taxes_text_html = ' - - ' . __('Tax Included', 'wpsc') . ': ' . wpsc_currency_display($row['tax_charged']);
$product_list .= $taxes_text;
$product_list_html .= $taxes_text_html;
}
// if
$report = get_option('wpsc_email_admin');
$report_product_list .= " - " . $row['quantity'] . " " . $row['name'] . " " . $message_price . "\n\r";
}
// closes foreach cart as row
// Decrement the stock here
if ($is_transaction) {
wpsc_decrement_claimed_stock($purchase_log['id']);
}
if (!empty($purchase_log['discount_data'])) {
$coupon_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE coupon_code = %s LIMIT 1", $purchase_log['discount_data']), ARRAY_A);
if ($coupon_data['use-once'] == 1) {
$wpdb->update(WPSC_TABLE_COUPON_CODES, array('active' => '0', 'is-used' => '1'), array('id' => $coupon_data['id']));
}
}
$total_shipping = wpsc_get_total_shipping($purchase_log['id']);
$total = $purchase_log['totalprice'];
$total_price_email = '';
$total_price_html = '';
$total_tax_html = '';
$total_tax = '';
$total_shipping_html = '';
$total_shipping_email = '';
if (wpsc_uses_shipping() || !empty($purchase_log['base_shipping'])) {
$total_shipping_email .= sprintf(__('Total Shipping: %s
', 'wpsc'), wpsc_currency_display($total_shipping, array('display_as_html' => false)));
}
$total_price_email .= sprintf(__('Total: %s
', 'wpsc'), wpsc_currency_display($total, array('display_as_html' => false)));
if ($purchase_log['discount_value'] > 0) {
$discount_email = __('Discount', 'wpsc') . "\n\r: ";
$discount_email .= $purchase_log['discount_data'] . ' : ' . wpsc_currency_display($purchase_log['discount_value'], array('display_as_html' => false)) . "\n\r";
$report .= $discount_email . "\n\r";
$total_shipping_email .= $discount_email;
$total_shipping_html .= __('Discount', 'wpsc') . ": " . wpsc_currency_display($purchase_log['discount_value']) . "\n\r";
}
//only show total tax if tax is not included
if ($wpec_taxes_controller->wpec_taxes_isenabled() && !$wpec_taxes_controller->wpec_taxes_isincluded()) {
$total_tax_html .= __('Total Tax', 'wpsc') . ': ' . wpsc_currency_display($purchase_log['wpec_taxes_total']) . "\n\r";
$total_tax .= __('Total Tax', 'wpsc') . ': ' . wpsc_currency_display($purchase_log['wpec_taxes_total'], array('display_as_html' => false)) . "\n\r";
}
if (wpsc_uses_shipping() || !empty($purchase_log['base_shipping'])) {
$total_shipping_html .= '<hr>' . sprintf(__('Total Shipping: %s
', '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);
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:67,代码来源:wpsc-transaction_results_functions.php
示例13: gateway_authorize
//.........这里部分代码省略.........
$authorize_data['x_Last_Name'] = urlencode($_POST['collected_data'][get_option('authorize_form_last_name')]);
$authorize_data['x_Card_Num'] = urlencode($_POST['card_number']);
$authorize_data['x_Exp_Date'] = urlencode($_POST['expiry']['month'] . $_POST['expiry']['year']);
$authorize_data['x_Card_Code'] = urlencode($_POST['card_code']);
$authorize_data['x_Address'] = urlencode($_POST['collected_data'][get_option('authorize_form_address')]);
$authorize_data['x_City'] = urlencode($_POST['collected_data'][get_option('authorize_form_city')]);
$authorize_data['x_Zip'] = urlencode($_POST['collected_data'][get_option('authorize_form_post_code')]);
$authorize_data['x_State'] = urlencode($billing_region);
$authorize_data['x_Country'] = urlencode($billing_country);
$authorize_data['x_Phone'] = urlencode($_POST['collected_data'][get_option('authorize_form_phone')]);
$authorize_data['x_Email'] = urlencode($_POST['collected_data'][get_option('authorize_form_email')]);
$authorize_data['x_Email_Customer'] = urlencode("TRUE");
$authorize_data['x_Merchant_Email'] = urlencode(get_option('purch_log_email'));
// MY ADDITIONS HERE
$authorize_data['x_Description'] = urlencode(get_option('authorize_form_description'));
$authorize_data['x_invoice_num'] = $cart[0]['purchaseid'];
$authorize_data['x_cust_id'] = $cart[0]['purchaseid'];
$setstate = $_POST['collected_data'][get_option('authorize_form_country')][1];
$setstate = $wpdb->get_var("SELECT code FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE id='" . $setstate . "'");
// $authorize_data['x_State'] = urlencode($setstate);
$setcountry = $_POST['collected_data'][get_option('authorize_form_country')][0];
// $authorize_data['x_Country'] = urlencode($setcountry);
$authorize_data['x_ship_to_First_Name'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_first_name')]);
$authorize_data['x_ship_to_Last_Name'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_last_name')]);
$authorize_data['x_ship_to_Address'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_address')]);
$authorize_data['x_ship_to_City'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_city')]);
$authorize_data['x_ship_to_Zip'] = urlencode($_POST['collected_data'][get_option('authorize_form_ship_post_code')]);
$setstate = $_POST['collected_data'][get_option('authorize_form_ship_state')];
$shipping_region = $wpdb->get_var("SELECT code FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE id='" . $shipping_region . "'");
$authorize_data['x_ship_to_State'] = urlencode($shipping_region);
// $setcountry=$_POST['collected_data'][get_option('authorize_form_ship_country')];
$authorize_data['x_ship_to_Country'] = urlencode($shipping_country);
$authorize_data['x_tax'] = urlencode($wpsc_cart->total_tax);
if (wpsc_uses_shipping()) {
$authorize_data['x_freight'] = urlencode($wpsc_cart->selected_shipping_method . '<|>' . $wpsc_cart->selected_shipping_option . '<|>' . $wpsc_cart->base_shipping);
}
// Extra shopping cart data for credit card receipt
if (isset($cart[0])) {
foreach ($cart as $k => $v) {
$authorize_data['item_' . $k . '_name'] = $v['name'];
$authorize_data['item_' . $k . '_qty'] = $v['quantity'];
$authorize_data['item_' . $k . '_price'] = $v['price'];
}
}
if ($x_Password != '') {
$authorize_data['x_Password'] = $x_Password;
}
#
# Build fields string to post, nicer than the old code
#
$num = 0;
foreach ($authorize_data as $key => $value) {
if ($num > 0) {
$fields .= "&";
}
$fields .= $key . "=" . $value;
$num++;
}
#
# Start CURL session
#
$user_agent = "WP eCommerce plugin for Wordpress";
$referrer = get_option('transact_url');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://secure.authorize.net/gateway/transact.dll");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
开发者ID:hornet9,项目名称:Morato,代码行数:67,代码来源:authorize.php
示例14: form_field
/**
* form_field method, returns the form html
* @access public
*/
function form_field()
{
global $wpdb, $user_ID;
// exit('<pre>'.print_r($_SESSION['wpsc_checkout_saved_values'], true).'</pre>');
if (count($_SESSION['wpsc_checkout_saved_values']) <= 0 && $user_ID > 0) {
//$_SESSION['wpsc_checkout_saved_values'] = get_usermeta($user_ID, 'wpshpcrt_usr_profile');
}
if (is_array($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id])) {
if (function_exists('wpsc_get_ticket_checkout_set')) {
if ($this->checkout_item->checkout_set == wpsc_get_ticket_checkout_set()) {
if (!isset($_SESSION['wpsc_tickets_saved_values_count'])) {
$_SESSION['wpsc_tickets_saved_values_count'] = 0;
$count = $_SESSION['wpsc_tickets_saved_values_count'];
} else {
$count = $_SESSION['wpsc_tickets_saved_values_count'] - 1;
}
$saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id][$count]), ENT_QUOTES, 'UTF-8');
}
}
} else {
$saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id]), ENT_QUOTES, 'UTF-8');
}
//make sure tickets are arrays for multiple ticket holders
$an_array = '';
if (function_exists('wpsc_get_ticket_checkout_set')) {
if ($this->checkout_item->checkout_set == wpsc_get_ticket_checkout_set()) {
$an_array = '[]';
}
}
switch ($this->checkout_item->type) {
case "address":
case "delivery_address":
case "textarea":
$output = "<textarea title='" . $this->checkout_item->unique_name . "' class='text' id='" . $this->form_element_id() . "' name='collected_data[{$this->checkout_item->id}]" . $an_array . "' rows='3' cols='40' >" . $saved_form_data . "</textarea>";
break;
case "checkbox":
$options = $this->get_checkout_options($this->checkout_item->id);
if ($options != '') {
$i = mt_rand();
$j = 0;
foreach ($options as $label => $value) {
$output .= "<input type='hidden' title='" . $this->checkout_item->unique_name . "' id='" . $this->form_element_id() . $j . "' value='-1' name='collected_data[{$this->checkout_item->id}][" . $i . "][" . $j . "]'/><input type='checkbox' title='" . $this->checkout_item->unique_name . "' id='" . $this->form_element_id() . "' value='" . $value . "' name='collected_data[{$this->checkout_item->id}][" . $i . "][" . $j . "]'/> ";
$output .= "<label for='" . $this->form_element_id() . $j . "'>" . $label . "</label><br />";
|
请发表评论