本文整理汇总了PHP中wpsc_tax_isincluded函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_tax_isincluded函数的具体用法?PHP wpsc_tax_isincluded怎么用?PHP wpsc_tax_isincluded使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_tax_isincluded函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpsc_display_tax_label
/**
* returns the tax label
* @access public
*
* @since 3.7
* @param $checkout (unused)
* @return string Tax Included or Tax
*/
function wpsc_display_tax_label($checkout = false)
{
global $wpsc_cart;
if (wpsc_tax_isincluded()) {
return __('Tax Included', 'wp-e-commerce');
} else {
return __('Tax', 'wp-e-commerce');
}
}
示例2: wpsc_display_tax_label
function wpsc_display_tax_label($checkout = false)
{
global $wpsc_cart;
if (wpsc_tax_isincluded()) {
if ($checkout) {
return sprintf(__('Tax Included (%s%%)', 'wpsc'), $wpsc_cart->tax_percentage);
} else {
return __('Tax Included', 'wpsc');
}
} else {
return __('Tax', 'wpsc');
}
}
示例3: wpsc_cart_total_widget
/**
* Cart Total Widget
*
* Can be used to display the cart total excluding shipping, tax or coupons.
*
* @since 3.7.6.2
*
* @return string The subtotal price of the cart, with a currency sign.
*/
function wpsc_cart_total_widget($shipping = true, $tax = true, $coupons = true)
{
global $wpsc_cart;
$total = $wpsc_cart->calculate_subtotal();
if ($shipping) {
$total += $wpsc_cart->calculate_total_shipping();
}
if ($tax && wpsc_tax_isincluded() == false) {
$total += $wpsc_cart->calculate_total_tax();
}
if ($coupons) {
$total -= $wpsc_cart->coupons_amount;
}
if (get_option('add_plustax') == 1) {
return wpsc_currency_display($wpsc_cart->calculate_subtotal());
} else {
return wpsc_currency_display($total);
}
}
示例4: construct_value_array
/**
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
* @access public
*/
function construct_value_array()
{
//$collected_gateway_data
$paypal_vars = array();
// Store settings to be sent to paypal
$data = array();
$data['USER'] = get_option('paypal_pro_username');
$data['PWD'] = get_option('paypal_pro_password');
$data['SIGNATURE'] = get_option('paypal_pro_signature');
$data['VERSION'] = "52.0";
$data['METHOD'] = "DoDirectPayment";
$data['PAYMENTACTION'] = "Sale";
$data['RETURNFMFDETAILS'] = "1";
// optional - return fraud management filter data
$data['CURRENCYCODE'] = $this->get_paypal_currency_code();
// Basic Cart Data
$data['INVNUM'] = $this->cart_data['session_id'];
$data['NOTIFYURL'] = add_query_arg('gateway', 'wpsc_merchant_paypal_pro', $this->cart_data['notification_url']);
$data['IPADDRESS'] = $_SERVER["REMOTE_ADDR"];
if ($this->cart_data['billing_address']['country'] == 'UK') {
$this->cart_data['billing_address']['country'] = 'GB';
}
// Billing Data
$data['FIRSTNAME'] = $this->cart_data['billing_address']['first_name'];
$data['LASTNAME'] = $this->cart_data['billing_address']['last_name'];
$data['EMAIL'] = $this->cart_data['email_address'];
$data['STREET'] = $this->cart_data['billing_address']['address'];
$data['CITY'] = $this->cart_data['billing_address']['city'];
$data['STATE'] = $this->cart_data['billing_address']['state'];
$data['COUNTRYCODE'] = $this->cart_data['billing_address']['country'];
$data['ZIP'] = $this->cart_data['billing_address']['post_code'];
// Shipping Data
$data['SHIPTONAME'] = $this->cart_data['shipping_address']['first_name'] . " " . $this->cart_data['shipping_address']['last_name'];
$data['SHIPTOSTREET'] = $this->cart_data['shipping_address']['address'];
$data['SHIPTOCITY'] = $this->cart_data['shipping_address']['city'];
// Check the state for internal numeric ID and trap it
if (is_numeric($this->cart_data['shipping_address']['state'])) {
$this->cart_data['shipping_address']['state'] = wpsc_get_state_by_id($this->cart_data['shipping_address']['state'], 'code');
}
if ($this->cart_data['shipping_address']['country'] == 'UK') {
$this->cart_data['shipping_address']['country'] = 'GB';
}
$data['SHIPTOSTATE'] = $this->cart_data['shipping_address']['state'];
$data['SHIPTOCOUNTRY'] = $this->cart_data['shipping_address']['country'];
$data['SHIPTOZIP'] = $this->cart_data['shipping_address']['post_code'];
// Credit Card Data
$data['CREDITCARDTYPE'] = $_POST['cctype'];
$data['ACCT'] = str_replace(array(' ', '-'), '', $_POST['card_number']);
$data['EXPDATE'] = $_POST['expiry']['month'] . $_POST['expiry']['year'];
$data['CVV2'] = $_POST['card_code'];
// Ordered Items
// Cart Item Data
$i = $item_total = 0;
$tax_total = wpsc_tax_isincluded() ? 0 : $this->cart_data['cart_tax'];
$shipping_total = $this->convert($this->cart_data['base_shipping']);
foreach ($this->cart_items as $cart_row) {
$data['L_NAME' . $i] = apply_filters('the_title', $cart_row['name']);
$data['L_AMT' . $i] = $this->convert($cart_row['price']);
$data['L_NUMBER' . $i] = $i;
$data['L_QTY' . $i] = $cart_row['quantity'];
$shipping_total += $this->convert($cart_row['shipping']);
$item_total += $this->convert($cart_row['price']) * $cart_row['quantity'];
$i++;
}
if ($this->cart_data['has_discounts']) {
$discount_value = $this->convert($this->cart_data['cart_discount_value']);
$coupon = new wpsc_coupons($this->cart_data['cart_discount_data']);
// free shipping
if ($coupon->is_percentage == 2) {
$shipping_total = 0;
$discount_value = 0;
} elseif ($discount_value >= $item_total) {
$discount_value = $item_total - 0.01;
$shipping_total -= 0.01;
}
$data["L_NAME{$i}"] = _x('Coupon / Discount', 'PayPal Pro Item Name for Discounts', 'wpsc');
$data["L_AMT{$i}"] = -$discount_value;
$data["L_NUMBER{$i}"] = $i;
$data["L_QTY{$i}"] = 1;
$item_total -= $discount_value;
}
// Cart totals
$data['ITEMAMT'] = $this->format_price($item_total);
$data['SHIPPINGAMT'] = $this->format_price($shipping_total);
$data['TAXAMT'] = $this->convert($tax_total);
$data['AMT'] = $data['ITEMAMT'] + $data['SHIPPINGAMT'] + $data['TAXAMT'];
$this->collected_gateway_data = apply_filters('wpsc_paypal_pro_gateway_data_array', $data, $this->cart_items);
}
示例5: calculate_total_price
/**
* Calculate total price method
*
* @access public
*
* @return float returns the price as a floating point value
*/
function calculate_total_price()
{
// Calculate individual component that comprise the cart total
$subtotal = $this->calculate_subtotal();
$shipping = $this->calculate_total_shipping();
// Get tax only if it is included
$tax = !wpsc_tax_isincluded() ? $this->calculate_total_tax() : 0.0;
// Get coupon amount, note that no matter what float precision this
// coupon amount is, it's always saved to the database with rounded
// value anyways
$coupons_amount = round($this->coupons_amount, 2);
// Calculate the total
$total = $subtotal > $coupons_amount ? $subtotal - $coupons_amount + $shipping + $tax : $tax + $shipping;
// Filter total
$total = apply_filters('wpsc_calculate_total_price', $total, $subtotal, $shipping, $tax, $coupons_amount, $this);
// Set variable and return
$this->total_price = $total;
return $total;
}
示例6: CallShortcutExpressCheckout
function CallShortcutExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL)
{
global $wpdb;
$nvpstr = '';
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
$nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
$nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
$data = array();
if (!isset($this->cart_data['shipping_address']['first_name']) && !isset($this->cart_data['shipping_address']['last_name'])) {
$this->cart_data['shipping_address']['first_name'] = $this->cart_data['billing_address']['first_name'];
$this->cart_data['shipping_address']['last_name'] = $this->cart_data['billing_address']['last_name'];
}
if ($this->cart_data['shipping_address']['country'] == 'UK') {
$this->cart_data['shipping_address']['country'] = 'GB';
}
$data += array('PAYMENTREQUEST_0_SHIPTONAME' => $this->cart_data['shipping_address']['first_name'] . ' ' . $this->cart_data['shipping_address']['last_name'], 'PAYMENTREQUEST_0_SHIPTOSTREET' => $this->cart_data['shipping_address']['address'], 'PAYMENTREQUEST_0_SHIPTOCITY' => $this->cart_data['shipping_address']['city'], 'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => $this->cart_data['shipping_address']['country'], 'PAYMENTREQUEST_0_SHIPTOZIP' => $this->cart_data['shipping_address']['post_code']);
if (!empty($this->cart_data['shipping_address']['state'])) {
$data += array('PAYMENTREQUEST_0_SHIPTOSTATE' => $this->cart_data['shipping_address']['state']);
}
$i = 0;
$item_total = 0;
$tax_total = 0;
$shipping_total = 0;
$is_free_shipping = false;
if ($this->cart_data['has_discounts'] && (double) $this->cart_data['cart_discount_value'] > 0) {
$coupon = new wpsc_coupons($this->cart_data['cart_discount_coupon']);
$is_free_shipping = $coupon->is_free_shipping();
}
foreach ($this->cart_items as $cart_item) {
$data["L_PAYMENTREQUEST_0_NAME{$i}"] = urlencode(apply_filters('the_title', $cart_item['name']));
$data["L_PAYMENTREQUEST_0_AMT{$i}"] = $this->convert($cart_item['price']);
$data["L_PAYMENTREQUEST_0_NUMBER{$i}"] = $i;
$data["L_PAYMENTREQUEST_0_QTY{$i}"] = $cart_item['quantity'];
$item_total += $this->convert($cart_item['price']) * $cart_item['quantity'];
$shipping_total += $cart_item['shipping'];
$i++;
}
//if we have a discount then include a negative amount with that discount
// in php 0.00 = true so we will change that here
if ($this->cart_data['cart_discount_value'] == 0.0) {
$this->cart_data['cart_discount_value'] = 0;
}
$discount_value = $this->convert($this->cart_data['cart_discount_value']);
if ($this->cart_data['cart_discount_value'] && !$is_free_shipping) {
// if item total < discount amount, leave at least 0.01 unit in item total, then subtract
// 0.01 from shipping as well
if (!$is_free_shipping && $discount_value >= $item_total) {
$discount_value = $item_total - 0.01;
$shipping_total -= 0.01;
}
$item_total -= $discount_value;
$data["L_PAYMENTREQUEST_0_NAME{$i}"] = "Discount / Coupon";
$data["L_PAYMENTREQUEST_0_AMT{$i}"] = -$discount_value;
$data["L_PAYMENTREQUEST_0_NUMBER{$i}"] = $i;
$data["L_PAYMENTREQUEST_0_QTY{$i}"] = 1;
}
$data["PAYMENTREQUEST_0_ITEMAMT"] = $this->format_price($item_total);
if ($discount_value && $is_free_shipping) {
$data["PAYMENTREQUEST_0_SHIPPINGAMT"] = 0;
} else {
$data["PAYMENTREQUEST_0_SHIPPINGAMT"] = $this->convert($this->cart_data['base_shipping'] + $shipping_total);
}
$total = $data["PAYMENTREQUEST_0_ITEMAMT"] + $data["PAYMENTREQUEST_0_SHIPPINGAMT"];
if (!wpsc_tax_isincluded()) {
$data["PAYMENTREQUEST_0_TAXAMT"] = $this->convert($this->cart_data['cart_tax']);
$total += $data["PAYMENTREQUEST_0_TAXAMT"];
}
// adjust total amount in case we had to round up after converting currency
// or discount calculation
if ($total != $paymentAmount) {
$paymentAmount = $total;
}
$data["PAYMENTREQUEST_0_AMT"] = $paymentAmount;
if (count($data) >= 4) {
$temp_data = array();
foreach ($data as $key => $value) {
$temp_data[] = $key . "=" . $value;
}
$nvpstr = $nvpstr . "&" . implode("&", $temp_data);
}
wpsc_update_customer_meta('paypal_express_currency_code_type', $currencyCodeType);
wpsc_update_customer_meta('paypal_express_payment_type', $paymentType);
$resArray = paypal_hash_call("SetExpressCheckout", $nvpstr);
$ack = strtoupper($resArray["ACK"]);
if ($ack == "SUCCESS") {
$token = urldecode($resArray["TOKEN"]);
wpsc_update_customer_meta('paypal_express_token', $token);
}
return $resArray;
}
示例7: wpsc_display_sales_log_index
//.........这里部分代码省略.........
</div><br />
<?php
wpsc_purchaselogs_displaylist();
?>
</div>
</div>
<?php
} else {
//NOT IN GENERIC PURCHASE LOG PAGE, IN DETAILS PAGE PER PURCHASE LOG
if (isset($_GET['cleared']) || isset($_GET['cleared'])) {
?>
<div id="message" class="updated fade"><p>
<?php
if (isset($_GET['cleared']) && $_GET['cleared'] == true) {
printf(__ngettext('Downloads for this log have been released.', 'Downloads for this log have been released.', $_GET['cleared']), $_GET['cleared']);
unset($_GET['cleared']);
}
if (isset($_GET['sent']) && (int) $_GET['sent']) {
printf(__ngettext('Receipt has been resent ', 'Receipt has been resent ', $_GET['sent']), $_GET['sent']);
unset($_GET['sent']);
}
?>
</p></div>
<?php
}
//$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted','cleared'), $_SERVER['REQUEST_URI'] );
?>
<?php
$page_back = remove_query_arg(array('locked', 'skipped', 'updated', 'deleted', 'purchaselog_id'), $_SERVER['REQUEST_URI']);
if (wpsc_tax_isincluded() == false) {
$taxlabel = 'Tax';
} else {
$taxlabel = 'Tax Included';
}
$columns = array('title' => 'Name', 'sku' => 'SKU', 'quantity' => 'Quantity', 'price' => 'Price', 'shipping' => 'Shipping', 'tax' => $taxlabel, 'total' => 'Total');
register_column_headers('display-purchaselog-details', $columns);
?>
<div id='post-body' class='has-sidebar' style='width:95%;'>
<?php
if (wpsc_has_purchlog_shipping()) {
?>
<div id='wpsc_shipping_details_box'>
<h3><?php
_e('Shipping Details');
?>
</h3>
<p><strong><?php
echo wpsc_display_purchlog_shipping_name();
?>
</strong></p>
<p>
<?php
echo wpsc_display_purchlog_shipping_address();
?>
<br />
<?php
echo wpsc_display_purchlog_shipping_city();
?>
<br />
<?php
echo wpsc_display_purchlog_shipping_state_and_postcode();
?>
示例8: wpsc_is_tax_included
function wpsc_is_tax_included()
{
return wpsc_tax_isincluded();
}
示例9: _construct_value_array
/**
* construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
* @access private
* @param boolean $aggregate Whether to aggregate the cart data or not. Defaults to false.
* @return array $paypal_vars The paypal vars
*/
function _construct_value_array($aggregate = false)
{
global $wpdb, $wpsc_cart;
$paypal_vars = array();
$add_tax = !wpsc_tax_isincluded();
$buy_now = defined('WPSC_PAYPAL_BUY_NOW') && WPSC_PAYPAL_BUY_NOW;
$return_url = add_query_arg('sessionid', $this->cart_data['session_id'], $this->cart_data['transaction_results_url']);
if ($buy_now) {
$return_url = add_query_arg('wpsc_buy_now_return', 1, $return_url);
}
// Store settings to be sent to paypal
$paypal_vars += array('business' => get_option('paypal_multiple_business'), 'return' => $return_url, 'cancel_return' => $this->cart_data['transaction_results_url'], 'rm' => '2', 'currency_code' => $this->get_paypal_currency_code(), 'lc' => $this->cart_data['store_currency'], 'no_note' => '1', 'charset' => 'utf-8');
// IPN data
if (get_option('paypal_ipn') == 1) {
$notify_url = $this->cart_data['notification_url'];
$notify_url = add_query_arg('gateway', 'wpsc_merchant_paypal_standard', $notify_url);
$notify_url = apply_filters('wpsc_paypal_standard_notify_url', $notify_url);
$paypal_vars += array('notify_url' => $notify_url);
}
// Customer details
$paypal_vars += array('email' => $this->cart_data['email_address'], 'first_name' => $this->cart_data['billing_address']['first_name'], 'last_name' => $this->cart_data['billing_address']['last_name'], 'address1' => $this->cart_data['billing_address']['address'], 'city' => $this->cart_data['billing_address']['city'], 'state' => isset($this->cart_data['billing_address']['state']) ? $this->cart_data['billing_address']['state'] : '', 'zip' => $this->cart_data['billing_address']['post_code'], 'country' => isset($this->cart_data['billing_address']['country']) ? $this->cart_data['billing_address']['country'] : '');
// Shipping
if ((bool) get_option('paypal_ship') && !$buy_now) {
$paypal_vars += array('address_override' => get_option('address_override'), 'no_shipping' => '0');
if ($paypal_vars['country'] == 'UK') {
$paypal_vars['country'] = 'GB';
}
} else {
$paypal_vars += array('no_shipping' => '1');
}
// Order settings to be sent to paypal
$paypal_vars += array('invoice' => $this->cart_data['session_id']);
if ($buy_now) {
$paypal_vars['custom'] = 'buy_now';
}
// Two cases:
// - We're dealing with a subscription
// - We're dealing with a normal cart
if ($this->cart_data['is_subscription']) {
$paypal_vars += array('cmd' => '_xclick-subscriptions');
$reprocessed_cart_data['shopping_cart'] = array('is_used' => false, 'price' => 0, 'length' => 1, 'unit' => 'd', 'times_to_rebill' => 1);
$reprocessed_cart_data['subscription'] = array('is_used' => false, 'price' => 0, 'length' => 1, 'unit' => 'D', 'times_to_rebill' => 1);
foreach ($this->cart_items as $cart_row) {
if ($cart_row['is_recurring']) {
$reprocessed_cart_data['subscription']['is_used'] = true;
$reprocessed_cart_data['subscription']['price'] = $this->convert($cart_row['price']);
$reprocessed_cart_data['subscription']['length'] = $cart_row['recurring_data']['rebill_interval']['length'];
$reprocessed_cart_data['subscription']['unit'] = strtoupper($cart_row['recurring_data']['rebill_interval']['unit']);
$reprocessed_cart_data['subscription']['times_to_rebill'] = $cart_row['recurring_data']['times_to_rebill'];
} else {
$item_cost = ($cart_row['price'] + $cart_row['shipping'] + $cart_row['tax']) * $cart_row['quantity'];
if ($item_cost > 0) {
$reprocessed_cart_data['shopping_cart']['price'] += $item_cost;
$reprocessed_cart_data['shopping_cart']['is_used'] = true;
}
}
$paypal_vars += array('item_name' => apply_filters('the_title', $cart_row['name']), 'src' => '1');
// This can be false, we don't need to have additional items in the cart/
if ($reprocessed_cart_data['shopping_cart']['is_used']) {
$paypal_vars += array("a1" => $this->convert($reprocessed_cart_data['shopping_cart']['price']), "p1" => $reprocessed_cart_data['shopping_cart']['length'], "t1" => $reprocessed_cart_data['shopping_cart']['unit']);
}
// We need at least one subscription product,
// If this is not true, something is rather wrong.
if ($reprocessed_cart_data['subscription']['is_used']) {
$paypal_vars += array("a3" => $this->convert($reprocessed_cart_data['subscription']['price']), "p3" => $reprocessed_cart_data['subscription']['length'], "t3" => $reprocessed_cart_data['subscription']['unit']);
// If the srt value for the number of times to rebill is not greater than 1,
// paypal won't accept the transaction.
if ($reprocessed_cart_data['subscription']['times_to_rebill'] > 1) {
$paypal_vars += array('srt' => $reprocessed_cart_data['subscription']['times_to_rebill']);
}
}
}
// end foreach cart item
} else {
if ($buy_now) {
$paypal_vars['cmd'] = '_xclick';
} else {
$paypal_vars += array('upload' => '1', 'cmd' => '_ext-enter', 'redirect_cmd' => '_cart');
}
$free_shipping = false;
$coupon = wpsc_get_customer_meta('coupon');
if ($coupon) {
$coupon = new wpsc_coupons($coupon);
$free_shipping = $coupon->is_free_shipping();
}
if ($this->cart_data['has_discounts'] && $free_shipping) {
$handling = 0;
} else {
$handling = $this->cart_data['base_shipping'];
}
$tax_total = 0;
if ($add_tax) {
$tax_total = $this->cart_data['cart_tax'];
}
//.........这里部分代码省略.........
示例10: save_to_db
/**
* save to database method
* @access public
*
* @param integer purchase log id
*/
function save_to_db($purchase_log_id)
{
global $wpdb, $wpsc_shipping_modules;
if ($method === null) {
$method = $this->cart->selected_shipping_method;
}
if (method_exists($wpsc_shipping_modules[$method], "get_item_shipping")) {
$shipping = $wpsc_shipping_modules[$this->cart->selected_shipping_method]->get_item_shipping($this);
}
if ($this->cart->has_total_shipping_discount()) {
$shipping = 0;
}
if ($this->apply_tax == true && wpsc_tax_isincluded() == false) {
if (is_numeric($this->custom_tax_rate)) {
$tax_rate = $this->custom_tax_rate;
} else {
$tax_rate = $this->cart->tax_percentage;
}
$tax = $this->unit_price * ($tax_rate / 100);
} else {
$tax = 0;
$tax_rate = 0;
}
$wpdb->query($wpdb->prepare("INSERT INTO `" . WPSC_TABLE_CART_CONTENTS . "` (`prodid`, `name`, `purchaseid`, `price`, `pnp`,`tax_charged`, `gst`, `quantity`, `donation`, `no_shipping`, `custom_message`, `files`, `meta`) VALUES ('%d', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '0', '%s', '%s', NULL)", $this->product_id, $this->product_name, $purchase_log_id, $this->unit_price, (double) $shipping, (double) $tax, (double) $tax_rate, $this->quantity, $this->is_donation, $this->custom_message, serialize($this->custom_file)));
$cart_id = $wpdb->get_var("SELECT LAST_INSERT_ID() AS `id` FROM `" . WPSC_TABLE_CART_CONTENTS . "` LIMIT 1");
foreach ((array) $this->variation_data as $variation_row) {
$wpdb->query("INSERT INTO `" . WPSC_TABLE_CART_ITEM_VARIATIONS . "` ( `cart_id` , `variation_id` , `value_id` ) VALUES ( '" . $cart_id . "', '" . $variation_row['variation_id'] . "', '" . $variation_row['id'] . "' );");
}
$downloads = get_option('max_downloads');
if ($this->is_downloadable == true) {
//$product_files = $wpdb->get_row("SELECT `meta_value` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `product_id` = '".$this->product_id."' AND `meta_key` = 'product_files'", ARRAY_A);
//$product_files = unserialize($product_files["meta_value"]);
$product_files = get_product_meta($this->product_id, 'product_files');
if ($this->file_id != null) {
// if the file is downloadable, check that the file is real
if ($wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `id` IN ('{$this->file_id}')")) {
$unique_id = sha1(uniqid(mt_rand(), true));
$wpdb->query("INSERT INTO `" . WPSC_TABLE_DOWNLOAD_STATUS . "` (`product_id` , `fileid` , `purchid` , `cartid`, `uniqueid`, `downloads` , `active` , `datetime` ) VALUES ( '{$this->product_id}', '{$this->file_id}', '{$purchase_log_id}', '{$cart_id}', '{$unique_id}', '{$downloads}', '0', NOW( ));");
}
} else {
foreach ($product_files as $file) {
// if the file is downloadable, check that the file is real
if ($wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `id` IN ('{$file}')")) {
$unique_id = sha1(uniqid(mt_rand(), true));
$wpdb->query("INSERT INTO `" . WPSC_TABLE_DOWNLOAD_STATUS . "` (`product_id` , `fileid` , `purchid` , `cartid`, `uniqueid`, `downloads` , `active` , `datetime` ) VALUES ( '{$this->product_id}', '{$file}', '{$purchase_log_id}', '{$cart_id}', '{$unique_id}', '{$downloads}', '0', NOW( ));");
}
}
}
}
do_action('wpsc_save_cart_item', $cart_id, $this->product_id);
}
示例11: wpsc_cart_tax
/**
* tax total function, no parameters
*
* @uses wpsc_cart
*
* @return float the total weight of the cart
*/
function wpsc_cart_tax($format_for_display = true)
{
global $wpsc_cart;
$cart_tax = $format_for_display ? '' : 0;
if (_wpsc_verify_global_cart_has_been_initialized(__FUNCTION__)) {
if ($format_for_display) {
if (!wpsc_tax_isincluded()) {
$cart_tax = wpsc_currency_display($wpsc_cart->calculate_total_tax());
} else {
$cart_tax = '(' . wpsc_currency_display($wpsc_cart->calculate_total_tax()) . ')';
}
} else {
$cart_tax = $wpsc_cart->calculate_total_tax();
}
}
return $cart_tax;
}
示例12: wpsc_purchaselog_details_tax
function wpsc_purchaselog_details_tax()
{
global $purchlogitem, $wpsc_cart;
// exit('<pre>'.print_r($purchlogitem->purchitem, true).'</pre>');
if (wpsc_tax_isincluded() == false) {
return nzshpcrt_currency_display($purchlogitem->purchitem->tax_charged, true);
} else {
//exit('<pre>'.print_r($purchlogitem,true).'</pre>');
if ($purchlogitem->purchitem->notax == 0) {
if ($purchlogitem->purchitem->price == null && $id != null) {
foreach ((array) $purchlogitem->allcartcontent as $cartcontent) {
//exit('<pre>'.print_r($cartcontent, true).'</pre>');
if ($cartcontent->prodid == $id && $cartcontent->notax == 1) {
return '-';
}
}
$price = $id;
} else {
$price = $purchlogitem->purchitem->price;
}
$tax = $price / (100 + $wpsc_cart->tax_percentage) * $wpsc_cart->tax_percentage;
$tax = $wpsc_cart->process_as_currency($tax);
return $tax . ' (' . $wpsc_cart->tax_percentage . '%)';
} else {
// $tax = 0;
return '-';
}
}
}
示例13: wpsc_packing_slip
//.........这里部分代码省略.........
// echo " <tr><td>".__('Transaction Id', 'wpsc').":</td><td>".$purch_data['transactid']."</td></tr>\n\r";
// }
echo "</table>\n\r";
echo "<table class='packing_slip'>";
echo "<tr>";
echo " <th>" . __('Quantity', 'wpsc') . " </th>";
echo " <th>" . __('Name', 'wpsc') . "</th>";
echo " <th>" . __('Price', 'wpsc') . " </th>";
echo " <th>" . __('Shipping', 'wpsc') . " </th>";
echo "<th>" . wpsc_display_tax_label(false) . "</th>";
echo '</tr>';
$endtotal = 0;
$all_donations = true;
$all_no_shipping = true;
$file_link_list = array();
// exit('<pre>'.print_r($cart_log,true).'</pre>');
foreach ($cart_log as $cart_row) {
$purchlogitem->the_purch_item();
// exit('<pre>'.print_r, true).'</pre>');
$alternate = "";
$j++;
if ($j % 2 != 0) {
$alternate = "class='alt'";
}
$productsql = "SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `id`=" . $cart_row['prodid'] . "";
$product_data = $wpdb->get_results($productsql, ARRAY_A);
$variation_sql = "SELECT * FROM `" . WPSC_TABLE_CART_ITEM_VARIATIONS . "` WHERE `cart_id`='" . $cart_row['id'] . "'";
$variation_data = $wpdb->get_results($variation_sql, ARRAY_A);
$variation_count = count($variation_data);
if ($variation_count > 1) {
$variation_list = " (";
$i = 0;
foreach ($variation_data as $variation) {
if ($i > 0) {
$variation_list .= ", ";
}
$value_id = $variation['value_id'];
$value_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_VARIATION_VALUES . "` WHERE `id`='" . $value_id . "' LIMIT 1", ARRAY_A);
$variation_list .= $value_data[0]['name'];
$i++;
}
$variation_list .= ")";
} else {
if ($variation_count == 1) {
$value_id = $variation_data[0]['value_id'];
$value_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_VARIATION_VALUES . "` WHERE `id`='" . $value_id . "' LIMIT 1", ARRAY_A);
$variation_list = " (" . $value_data[0]['name'] . ")";
} else {
$variation_list = '';
}
}
if ($cart_row['donation'] != 1) {
$all_donations = false;
}
if ($cart_row['no_shipping'] != 1) {
$shipping = $cart_row['pnp'] * $cart_row['quantity'];
$total_shipping += $shipping;
$all_no_shipping = false;
} else {
$shipping = 0;
}
$price = $cart_row['price'] * $cart_row['quantity'];
$gst = $price - $price / (1 + $cart_row['gst'] / 100);
if ($gst > 0) {
$tax_per_item = $gst / $cart_row['quantity'];
}
echo "<tr {$alternate}>";
echo " <td>";
echo $cart_row['quantity'];
echo " </td>";
echo " <td>";
echo $product_data[0]['name'];
echo stripslashes($variation_list);
echo " </td>";
echo " <td>";
echo nzshpcrt_currency_display($price, 1);
echo " </td>";
echo " <td>";
echo nzshpcrt_currency_display($shipping, 1);
echo " </td>";
echo '<td>';
if (wpsc_tax_isincluded()) {
echo wpsc_purchaselog_details_tax();
} else {
echo nzshpcrt_currency_display($cart_row['tax_charged'], 1);
}
echo '<td>';
echo '</tr>';
}
echo "</table>";
echo '<table class="packing-slip-totals">';
echo '<tr><th>Base Shipping</th><td>' . nzshpcrt_currency_display($purch_data['base_shipping'], 1) . '</td></tr>';
echo '<tr><th>Total Shipping</th><td>' . nzshpcrt_currency_display($purch_data['base_shipping'] + $total_shipping, 1) . '</td></tr>';
echo '<tr><th>Total Price</th><td>' . nzshpcrt_currency_display($purch_data['totalprice'], 1) . '</td></tr>';
echo '</table>';
echo "</div>\n\r";
} else {
echo "<br />" . __('This users cart was empty', 'wpsc');
}
}
示例14: wpsc_options_general
//.........这里部分代码省略.........
<a href='<?php
echo add_query_arg(array('page' => 'wpsc-settings', 'isocode' => get_option('base_country')));
?>
'><?php
echo $region_count;
?>
Regions</a>
<?php
} else {
?>
<input type='hidden' name='country_id' value='<?php
echo $country_data['id'];
?>
' />
<input type='text' name='country_tax' class='tax_forms' maxlength='5' size='5' value='<?php
echo $country_data['tax'];
?>
' />%
<?php
}
?>
</span>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('Tax Included in prices', 'wpsc');
?>
:</th>
<td>
<?php
$tax_inprice0 = '';
$tax_inprice1 = '';
if (wpsc_tax_isincluded()) {
$tax_inprice1 = 'checked="checked"';
} else {
$tax_inprice0 = 'checked="checked"';
}
?>
<input <?php
echo $tax_inprice1;
?>
type='radio' name='wpsc_options[tax_inprice]' value='1' id='tax_inprice1' />
<label for='tax_inprice1'><?php
echo __('Yes', 'wpsc');
?>
</label>
<input <?php
echo $tax_inprice0;
?>
type='radio' name='wpsc_options[tax_inprice]' value='0' id='tax_inprice0' />
<label for='tax_inprice1'><?php
echo __('No', 'wpsc');
?>
</label>
</td>
</tr>
<?php
/* START OF TARGET MARKET SELECTION */
$countrylist = $wpdb->get_results("SELECT id,country,visible FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC ", ARRAY_A);
?>
<tr>
<th scope="row">
<?php
echo __('Target Markets', 'wpsc');
示例15: calculate_total_price
/**
* calculate total price method
* @access public
*
* @return float returns the price as a floating point value
*/
function calculate_total_price()
{
if ($this->total_price == null) {
$total = $this->calculate_subtotal();
$total += $this->calculate_total_shipping();
if (wpsc_tax_isincluded() == false) {
$total += $this->calculate_total_tax();
}
$total -= $this->coupons_amount;
$this->total_price = $total;
} else {
$total = $this->total_price;
}
if ($total < 0) {
$wpsc_cart->coupons_amount += $total;
$total = 0;
}
return $total;
}