本文整理汇总了PHP中wpsc_currency_display函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_currency_display函数的具体用法?PHP wpsc_currency_display怎么用?PHP wpsc_currency_display使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_currency_display函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpsc_admin_ajax
/**
* WP eCommerce Admin AJAX functions
*
* These are the WPSC Admin AJAX functions
*
* @package wp-e-commerce
* @since 3.7
*
* @uses update_option() Updates option in the database given key and value
* @uses wp_delete_term() Removes term from the database
* @uses fetch_rss() DEPRECATED
* @uses wpsc_member_dedeactivate_subscriptions() @todo docs
* @uses wpsc_member_deactivate_subscriptions() @todo docs
* @uses wpsc_update_purchase_log_status() Updates the status of the logs for a purchase
* @uses transaction_results() Main function for creating purchase reports
* @uses wpsc_find_purchlog_status_name() Finds name of given status
*/
function wpsc_admin_ajax()
{
if (!wpsc_is_store_admin()) {
return;
}
global $wpdb;
if (isset($_POST['action']) && $_POST['action'] == 'product-page-order') {
$current_order = get_option('wpsc_product_page_order');
$new_order = $_POST['order'];
if (isset($new_order["advanced"])) {
$current_order["advanced"] = array_unique(explode(',', $new_order["advanced"]));
}
if (isset($new_order["side"])) {
$current_order["side"] = array_unique(explode(',', $new_order["side"]));
}
update_option('wpsc_product_page_order', $current_order);
exit(print_r($order, 1));
}
if (isset($_POST['save_image_upload_state']) && $_POST['save_image_upload_state'] == 'true' && is_numeric($_POST['image_upload_state'])) {
$upload_state = (int) (bool) $_POST['image_upload_state'];
update_option('wpsc_use_flash_uploader', $upload_state);
exit("done");
}
if (isset($_POST['remove_variation_value']) && $_POST['remove_variation_value'] == "true" && is_numeric($_POST['variation_value_id'])) {
$value_id = absint($_GET['variation_value_id']);
echo wp_delete_term($value_id, 'wpsc-variation');
exit;
}
if (isset($_REQUEST['log_state']) && $_REQUEST['log_state'] == "true" && is_numeric($_POST['id']) && is_numeric($_POST['value'])) {
$newvalue = $_POST['value'];
if ($_REQUEST['suspend'] == 'true') {
if ($_REQUEST['value'] == 1 && function_exists('wpsc_member_dedeactivate_subscriptions')) {
wpsc_member_dedeactivate_subscriptions($_POST['id']);
} elseif (function_exists('wpsc_member_deactivate_subscriptions')) {
wpsc_member_deactivate_subscriptions($_POST['id']);
}
exit;
} else {
$log_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = '%d' LIMIT 1", $_POST['id']), ARRAY_A);
if ($newvalue == 2 && function_exists('wpsc_member_activate_subscriptions')) {
wpsc_member_activate_subscriptions($_POST['id']);
}
wpsc_update_purchase_log_status($_POST['id'], $newvalue);
if ($newvalue > $log_data['processed'] && $log_data['processed'] < 2) {
transaction_results($log_data['sessionid'], false);
}
$status_name = wpsc_find_purchlog_status_name($purchase['processed']);
echo "document.getElementById(\"form_group_" . absint($_POST['id']) . "_text\").innerHTML = '" . $status_name . "';\n";
$year = date("Y");
$month = date("m");
$start_timestamp = mktime(0, 0, 0, $month, 1, $year);
$end_timestamp = mktime(0, 0, 0, $month + 1, 0, $year);
echo "document.getElementById(\"log_total_month\").innerHTML = '" . addslashes(wpsc_currency_display(admin_display_total_price($start_timestamp, $end_timestamp))) . "';\n";
echo "document.getElementById(\"log_total_absolute\").innerHTML = '" . addslashes(wpsc_currency_display(admin_display_total_price())) . "';\n";
exit;
}
}
}
示例2: _wpsc_get_checkout_info
/**
* Get replacement elements for country and region fields on the checkout form
*
* Note: extracted from the wpsc_change_tax function in ajax.php as of version 3.8.13.3
*
* @since 3.8.14
* @access private
* @return array checkout information
*/
function _wpsc_get_checkout_info()
{
global $wpsc_cart;
// Checkout info is what we will return to the AJAX client
$checkout_info = array();
// start with items that have no dependencies
$checkout_info['delivery_country'] = wpsc_get_customer_meta('shippingcountry');
$checkout_info['billing_country'] = wpsc_get_customer_meta('billingcountry');
$checkout_info['country_name'] = wpsc_get_country($checkout_info['delivery_country']);
$checkout_info['lock_tax'] = get_option('lock_tax');
// TODO: this is set anywhere, probably deprecated
$checkout_info['needs_shipping_recalc'] = wpsc_cart_need_to_recompute_shipping_quotes();
$checkout_info['shipping_keys'] = array();
foreach ($wpsc_cart->cart_items as $key => $cart_item) {
$checkout_info['shipping_keys'][$key] = wpsc_currency_display($cart_item->shipping);
}
if (!$checkout_info['needs_shipping_recalc']) {
$wpsc_cart->update_location();
$wpsc_cart->get_shipping_method();
$wpsc_cart->get_shipping_option();
if ($wpsc_cart->selected_shipping_method != '') {
$wpsc_cart->update_shipping($wpsc_cart->selected_shipping_method, $wpsc_cart->selected_shipping_option);
}
$tax = $wpsc_cart->calculate_total_tax();
$total = wpsc_cart_total();
$total_input = wpsc_cart_total(false);
if ($wpsc_cart->coupons_amount >= $total_input && !empty($wpsc_cart->coupons_amount)) {
$total = 0;
}
if ($wpsc_cart->total_price < 0) {
$wpsc_cart->coupons_amount += $wpsc_cart->total_price;
$wpsc_cart->total_price = null;
$wpsc_cart->calculate_total_price();
}
$cart_widget = _wpsc_ajax_get_cart(false);
if (isset($cart_widget['widget_output']) && !empty($cart_widget['widget_output'])) {
$checkout_info['widget_output'] = $cart_widget['widget_output'];
}
$checkout_info['cart_shipping'] = wpsc_cart_shipping();
$checkout_info['tax'] = $tax;
$checkout_info['display_tax'] = wpsc_cart_tax();
$checkout_info['total'] = $total;
$checkout_info['total_input'] = $total_input;
}
return apply_filters('wpsc_ajax_checkout_info', $checkout_info);
}
示例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: wpsc_product_variation_price_from
/**
* WPSC Product Variation Price From
* Gets the formatted lowest price of a product's variations.
*
* @since 3.8.10
*
* @param $product_id (int) Product ID
* @param $args (array) Array of options
* @return (string) Number formatted price
*
* @uses apply_filters() Calls 'wpsc_do_convert_price' passing price and product ID.
* @uses wpsc_currency_display() Passing price and args.
*/
function wpsc_product_variation_price_from($product_id, $args = null)
{
global $wpdb;
$args = wp_parse_args($args, array('from_text' => false, 'only_normal_price' => false, 'only_in_stock' => false));
static $price_data = array();
/* @todo: Rewrite using proper WP_Query */
if (isset($price_data[$product_id])) {
$results = $price_data[$product_id];
} else {
$stock_sql = '';
if ($args['only_in_stock']) {
$stock_sql = "INNER JOIN {$wpdb->postmeta} AS pm3 ON pm3.post_id = p.id AND pm3.meta_key = '_wpsc_stock' AND pm3.meta_value != '0'";
}
$sql = $wpdb->prepare("\n\t\t\tSELECT pm.meta_value AS price, pm2.meta_value AS special_price\n\t\t\tFROM {$wpdb->posts} AS p\n\t\t\tINNER JOIN {$wpdb->postmeta} AS pm ON pm.post_id = p.id AND pm.meta_key = '_wpsc_price'\n\t\t\tLEFT JOIN {$wpdb->postmeta} AS pm2 ON pm2.post_id = p.id AND pm2.meta_key = '_wpsc_special_price'\n\t\t\t{$stock_sql}\n\t\t\tWHERE p.post_type = 'wpsc-product' AND p.post_parent = %d AND p.post_status IN ( 'publish', 'inherit' )\n\t\t", $product_id);
$results = $wpdb->get_results($sql);
$price_data[$product_id] = $results;
}
$prices = array();
foreach ($results as $row) {
$price = (double) $row->price;
if (!$args['only_normal_price']) {
$special_price = (double) $row->special_price;
if ($special_price != 0 && $special_price < $price) {
$price = $special_price;
}
}
$prices[] = $price;
}
sort($prices);
if (empty($prices)) {
$prices[] = 0;
}
$price = apply_filters('wpsc_do_convert_price', $prices[0], $product_id);
$price = wpsc_currency_display($price, array('display_as_html' => false));
if (isset($prices[0]) && $prices[0] == $prices[count($prices) - 1]) {
$args['from_text'] = false;
}
if ($args['from_text']) {
$price = sprintf($args['from_text'], $price);
}
return $price;
}
示例5: get_table_args
private function get_table_args()
{
$log_id = $this->purchase_log->get('id');
$log_data = $this->purchase_log->get_data();
$rows = array();
$headings = array(_x('Name', 'purchase log notification table heading', 'wp-e-commerce') => 'left', _x('Price', 'purchase log notification table heading', 'wp-e-commerce') => 'right', _x('Quantity', 'purchase log notification table heading', 'wp-e-commerce') => 'right', _x('Item Total', 'purchase log notification table heading', 'wp-e-commerce') => 'right');
$has_additional_details = false;
$additional_details = array();
foreach ($this->purchase_log->get_cart_contents() as $item) {
$cart_item_array = array('purchase_id' => $log_id, 'cart_item' => (array) $item, 'purchase_log' => $log_data);
// legacy code, which Gary honestly doesn't fully understand because it just doesn't make sense
// prior to 3.8.9, these actions are called on each product item. Don't really know what they do.
do_action('wpsc_transaction_result_cart_item', $cart_item_array);
do_action('wpsc_confirm_checkout', $log_id);
// then there's also this annoying apply_filters call, which is apparently not the best example
// of how to use it, but we have to preserve them anyways
$additional_content = apply_filters('wpsc_transaction_result_content', $cart_item_array);
if (!is_string($additional_content)) {
$additional_content = '';
} else {
$has_additional_details = true;
}
$additional_details[] = $additional_content;
$item_total = $item->quantity * $item->price;
$item_total = wpsc_currency_display($item_total, array('display_as_html' => false));
$item_price = wpsc_currency_display($item->price, array('display_as_html' => false));
$item_name = apply_filters('the_title', $item->name);
$rows[] = array($item_name, $item_price, $item->quantity, $item_total);
}
// Preserve the 'wpsc_transaction_result_content' filter for backward compat
if ($has_additional_details) {
$headings[] = __('Additional Details', 'wp-e-commerce');
foreach ($rows as $index => $row) {
$rows[] = $additional_details[$index];
}
}
$table_args = array('headings' => $headings, 'rows' => $rows);
return apply_filters('wpsc_purchase_log_notification_product_table_args', $table_args, $this);
}
示例6: paypal_processingfunctions
//.........这里部分代码省略.........
$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"]);
if ($ack == "SUCCESS") {
// Redirect to paypal.com here
$token = urldecode($resArray["TOKEN"]);
$payPalURL = $PAYPAL_URL . $token;
wp_redirect($payPalURL);
} else {
// Redirecting to APIError.php to display errors.
$location = get_option('transact_url') . "&act=error";
wp_redirect($location);
}
exit;
} else {
/* At this point, the buyer has completed in authorizing payment
at PayPal. The script will now call PayPal with the details
of the authorization, incuding any shipping information of the
buyer. Remember, the authorization is not a completed transaction
at this state - the buyer still needs an additional step to finalize
the transaction
*/
$token = urlencode($_REQUEST['token']);
/* Build a second API request to PayPal, using the token as the
ID to get the details on the payment authorization
*/
$nvpstr = "&TOKEN=" . $token;
/* Make the API call and store the results in an array. If the
call was a success, show the authorization details, and provide
an action to complete the payment. If failed, show the error
*/
$resArray = paypal_hash_call("GetExpressCheckoutDetails", $nvpstr);
wpsc_update_customer_meta('paypal_express_reshash', $resArray);
$ack = strtoupper($resArray["ACK"]);
if ($ack == "SUCCESS") {
/********************************************************
GetExpressCheckoutDetails.php
This functionality is called after the buyer returns from
PayPal and has authorized the payment.
Displays the payer details returned by the
GetExpressCheckoutDetails response and calls
DoExpressCheckoutPayment.php to complete the payment
authorization.
Called by ReviewOrder.php.
Calls DoExpressCheckoutPayment.php and APIError.php.
********************************************************/
/* Collect the necessary information to complete the
authorization for the PayPal payment
*/
/* Display the API response back to the browser .
If the response from PayPal was a success, display the response parameters
*/
if (isset($_REQUEST['token']) && !isset($_REQUEST['PayerID'])) {
wpsc_update_customer_meta('paypal_express_message', _x('<h4>TRANSACTION CANCELED</h4>', 'paypal express cancel header', 'wpsc'));
} else {
wpsc_update_customer_meta('paypal_express_token', $_REQUEST['token']);
wpsc_update_customer_meta('paypal_express_payer_id', $_REQUEST['PayerID']);
$resArray = wpsc_get_customer_meta('paypal_express_reshash');
if (get_option('permalink_structure') != '') {
$separator = "?";
} else {
$separator = "&";
}
if (!isset($resArray['SHIPTOSTREET2'])) {
$resArray['SHIPTOSTREET2'] = '';
}
$output = "\n\t\t\t\t\t <table width='400' class='paypal_express_form'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' class='firstcol'><b>" . __('Order Total:', 'wpsc') . "</b></td>\n\t\t\t\t\t\t\t<td align='left'>" . wpsc_currency_display(wpsc_get_customer_meta('paypal_express_original_amount')) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' colspan='2'><b>" . __('Shipping Address:', 'wpsc') . " </b></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' class='firstcol'>\n\t\t\t\t\t\t\t\t" . __('Street 1:', 'wpsc') . "</td>\n\t\t\t\t\t\t\t<td align='left'>" . $resArray['SHIPTOSTREET'] . "</td>\n\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' class='firstcol'>\n\t\t\t\t\t\t\t\t" . __('Street 2:', 'wpsc') . "</td>\n\t\t\t\t\t\t\t<td align='left'>" . $resArray['SHIPTOSTREET2'] . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' class='firstcol'>\n\t\t\t\t\t\t\t\t" . __('City:', 'wpsc') . "</td>\n\n\t\t\t\t\t\t\t<td align='left'>" . $resArray['SHIPTOCITY'] . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' class='firstcol'>\n\t\t\t\t\t\t\t\t" . __('State:', 'wpsc') . "</td>\n\t\t\t\t\t\t\t<td align='left'>" . $resArray['SHIPTOSTATE'] . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' class='firstcol'>\n\t\t\t\t\t\t\t\t" . __('Postal code:', 'wpsc') . "</td>\n\n\t\t\t\t\t\t\t<td align='left'>" . $resArray['SHIPTOZIP'] . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' class='firstcol'>\n\t\t\t\t\t\t\t\t" . __('Country:', 'wpsc') . "</td>\n\t\t\t\t\t\t\t<td align='left'>" . $resArray['SHIPTOCOUNTRYNAME'] . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'>";
$output .= "<form action=" . get_option('transact_url') . " method='post'>\n";
$output .= "\t<input type='hidden' name='totalAmount' value='" . wpsc_cart_total(false) . "' />\n";
$output .= "\t<input type='hidden' name='shippingStreet' value='" . $resArray['SHIPTOSTREET'] . "' />\n";
$output .= "\t<input type='hidden' name='shippingStreet2' value='" . $resArray['SHIPTOSTREET2'] . "' />\n";
$output .= "\t<input type='hidden' name='shippingCity' value='" . $resArray['SHIPTOCITY'] . "' />\n";
$output .= "\t<input type='hidden' name='shippingState' value='" . $resArray['SHIPTOSTATE'] . "' />\n";
$output .= "\t<input type='hidden' name='postalCode' value='" . $resArray['SHIPTOZIP'] . "' />\n";
$output .= "\t<input type='hidden' name='country' value='" . $resArray['SHIPTOCOUNTRYNAME'] . "' />\n";
$output .= "\t<input type='hidden' name='token' value='" . wpsc_get_customer_meta('paypal_express_token') . "' />\n";
$output .= "\t<input type='hidden' name='PayerID' value='" . wpsc_get_customer_meta('paypal_express_payer_id') . "' />\n";
$output .= "\t<input type='hidden' name='act' value='do' />\n";
$output .= "\t<p> <input name='usePayPal' type='submit' value='" . __('Confirm Payment', 'wpsc') . "' /></p>\n";
$output .= "</form>";
$output .= " </td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</center>\n\t\t\t\t\t";
wpsc_update_customer_meta('paypal_express_message', $output);
}
}
}
}
}
}
}
示例7: wpsc_packing_slip
//.........这里部分代码省略.........
} else {
echo "\t<tr><td>" . esc_html($form_field['name']) . ":</td><td>" . (isset($rekeyed_input[$form_field['id']]) ? esc_html($rekeyed_input[$form_field['id']]['value']) : '') . "</td></tr>\n\r";
}
break;
}
}
} else {
echo "\t<tr><td>" . esc_html__('Name', 'wp-e-commerce') . ":</td><td>" . $purch_data['firstname'] . " " . $purch_data['lastname'] . "</td></tr>\n\r";
echo "\t<tr><td>" . esc_html__('Address', 'wp-e-commerce') . ":</td><td>" . $purch_data['address'] . "</td></tr>\n\r";
echo "\t<tr><td>" . esc_html__('Phone', 'wp-e-commerce') . ":</td><td>" . $purch_data['phone'] . "</td></tr>\n\r";
echo "\t<tr><td>" . esc_html__('Email', 'wp-e-commerce') . ":</td><td>" . $purch_data['email'] . "</td></tr>\n\r";
}
if (2 == get_option('payment_method')) {
$gateway_name = '';
global $nzshpcrt_gateways;
foreach ($nzshpcrt_gateways as $gateway) {
if ($purch_data['gateway'] != 'testmode') {
if ($gateway['internalname'] == $purch_data['gateway']) {
$gateway_name = $gateway['name'];
}
} else {
$gateway_name = esc_html__('Manual Payment', 'wp-e-commerce');
}
}
}
echo "</table>\n\r";
do_action('wpsc_packing_slip_extra_info', $purchase_id);
echo "<table class='packing_slip'>";
echo "<tr>";
echo " <th>" . esc_html__('Quantity', 'wp-e-commerce') . " </th>";
echo " <th>" . esc_html__('Name', 'wp-e-commerce') . "</th>";
echo " <th>" . esc_html__('Price', 'wp-e-commerce') . " </th>";
echo " <th>" . esc_html__('Shipping', 'wp-e-commerce') . " </th>";
echo '<th>' . esc_html__('Tax', 'wp-e-commerce') . '</th>';
echo '</tr>';
$endtotal = 0;
$all_donations = true;
$all_no_shipping = true;
$file_link_list = array();
$total_shipping = 0;
foreach ($cart_log as $cart_row) {
$alternate = "";
$j++;
if ($j % 2 != 0) {
$alternate = "class='alt'";
}
// product ID will be $cart_row['prodid']. need to fetch name and stuff
$variation_list = '';
if ($cart_row['donation'] != 1) {
$all_donations = false;
}
if ($cart_row['no_shipping'] != 1) {
$shipping = $cart_row['pnp'];
$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 apply_filters('the_title', $cart_row['name']);
echo $variation_list;
echo " </td>";
echo " <td>";
echo wpsc_currency_display($price);
echo " </td>";
echo " <td>";
echo wpsc_currency_display($shipping);
echo " </td>";
echo '<td>';
echo wpsc_currency_display($cart_row['tax_charged']);
echo '</td>';
echo '</tr>';
}
echo "</table>";
echo '<table class="packing-slip-totals">';
if (floatval($purch_data['discount_value'])) {
echo '<tr><th>' . esc_html__('Discount', 'wp-e-commerce') . '</th><td>(' . wpsc_currency_display($purch_data['discount_value']) . ')</td></tr>';
}
echo '<tr><th>' . esc_html__('Base Shipping', 'wp-e-commerce') . '</th><td>' . wpsc_currency_display($purch_data['base_shipping']) . '</td></tr>';
echo '<tr><th>' . esc_html__('Total Shipping', 'wp-e-commerce') . '</th><td>' . wpsc_currency_display($purch_data['base_shipping'] + $total_shipping) . '</td></tr>';
//wpec_taxes
if ($purch_data['wpec_taxes_total'] != 0.0) {
echo '<tr><th>' . esc_html__('Taxes', 'wp-e-commerce') . '</th><td>' . wpsc_currency_display($purch_data['wpec_taxes_total']) . '</td></tr>';
}
echo '<tr><th>' . esc_html__('Total Price', 'wp-e-commerce') . '</th><td>' . wpsc_currency_display($purch_data['totalprice']) . '</td></tr>';
echo '</table>';
echo "</div>\n\r";
} else {
echo "<br />" . esc_html__('This users cart was empty', 'wp-e-commerce');
}
}
示例8: wpsc_display_purchlog_details
function wpsc_display_purchlog_details()
{
while (wpsc_have_purchaselog_details()) {
wpsc_the_purchaselog_item();
?>
<tr>
<td><?php
echo wpsc_purchaselog_details_name();
?>
</td> <!-- NAME! -->
<td><?php
echo wpsc_purchaselog_details_SKU();
?>
</td> <!-- SKU! -->
<td><?php
echo wpsc_purchaselog_details_quantity();
?>
</td> <!-- QUANTITY! -->
<td><?php
echo wpsc_currency_display(wpsc_purchaselog_details_price());
?>
</td> <!-- PRICE! -->
<td><?php
echo wpsc_currency_display(wpsc_purchaselog_details_shipping());
?>
</td> <!-- SHIPPING! -->
<td><?php
if (wpec_display_product_tax()) {
echo wpsc_currency_display(wpsc_purchaselog_details_tax());
}
?>
</td> <!-- TAX! -->
<!-- <td><?php
echo wpsc_currency_display(wpsc_purchaselog_details_discount());
?>
</td> --> <!-- DISCOUNT! -->
<td><?php
echo wpsc_currency_display(wpsc_purchaselog_details_total());
?>
</td> <!-- TOTAL! -->
</tr>
<?php
}
}
示例9: wpsc_change_tax
/**
* wpsc_change_tax function, used through ajax and in normal page loading.
* No parameters, returns nothing
*/
function wpsc_change_tax()
{
global $wpdb, $wpsc_cart;
$form_id = absint($_POST['form_id']);
$wpsc_selected_country = $wpsc_cart->selected_country;
$wpsc_selected_region = $wpsc_cart->selected_region;
$wpsc_delivery_country = $wpsc_cart->delivery_country;
$wpsc_delivery_region = $wpsc_cart->delivery_region;
$previous_country = $_SESSION['wpsc_selected_country'];
if (isset($_POST['billing_country'])) {
$wpsc_selected_country = $wpdb->escape($_POST['billing_country']);
$_SESSION['wpsc_selected_country'] = $wpsc_selected_country;
}
if (isset($_POST['billing_region'])) {
$wpsc_selected_region = absint($_POST['billing_region']);
$_SESSION['wpsc_selected_region'] = $wpsc_selected_region;
}
$check_country_code = $wpdb->get_var(" SELECT `country`.`isocode` FROM `" . WPSC_TABLE_REGION_TAX . "` AS `region` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `region`.`country_id` = `country`.`id` WHERE `region`.`id` = '" . $_SESSION['wpsc_selected_region'] . "' LIMIT 1");
if ($_SESSION['wpsc_selected_country'] != $check_country_code) {
$wpsc_selected_region = null;
}
if (isset($_POST['shipping_country'])) {
$wpsc_delivery_country = $wpdb->escape($_POST['shipping_country']);
$_SESSION['wpsc_delivery_country'] = $wpsc_delivery_country;
}
if (isset($_POST['shipping_region'])) {
$wpsc_delivery_region = absint($_POST['shipping_region']);
$_SESSION['wpsc_delivery_region'] = $wpsc_delivery_region;
}
$check_country_code = $wpdb->get_var(" SELECT `country`.`isocode` FROM `" . WPSC_TABLE_REGION_TAX . "` AS `region` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `region`.`country_id` = `country`.`id` WHERE `region`.`id` = '" . $wpsc_delivery_region . "' LIMIT 1");
if ($wpsc_delivery_country != $check_country_code) {
$wpsc_delivery_region = null;
}
$wpsc_cart->update_location();
$wpsc_cart->get_shipping_method();
$wpsc_cart->get_shipping_option();
if ($wpsc_cart->selected_shipping_method != '') {
$wpsc_cart->update_shipping($wpsc_cart->selected_shipping_method, $wpsc_cart->selected_shipping_option);
}
$tax = $wpsc_cart->calculate_total_tax();
$total = wpsc_cart_total();
$total_input = wpsc_cart_total(false);
if ($wpsc_cart->coupons_amount >= wpsc_cart_total() && !empty($wpsc_cart->coupons_amount)) {
$total = 0;
}
if ($wpsc_cart->total_price < 0) {
$wpsc_cart->coupons_amount += $wpsc_cart->total_price;
$wpsc_cart->total_price = null;
$wpsc_cart->calculate_total_price();
}
ob_start();
include_once wpsc_get_template_file_path('wpsc-cart_widget.php');
$output = ob_get_contents();
ob_end_clean();
$output = str_replace(array("\n", "\r"), array("\\n", "\\r"), addslashes($output));
if (get_option('lock_tax') == 1) {
echo "jQuery('#current_country').val('" . $_SESSION['wpsc_delivery_country'] . "'); \n";
if ($_SESSION['wpsc_delivery_country'] == 'US' && get_option('lock_tax') == 1) {
$output = wpsc_shipping_region_list($_SESSION['wpsc_delivery_country'], $_SESSION['wpsc_delivery_region']);
$output = str_replace(array("\n", "\r"), array("\\n", "\\r"), addslashes($output));
echo "jQuery('#region').remove();\n\r";
echo "jQuery('#change_country').append(\"" . $output . "\");\n\r";
}
}
foreach ($wpsc_cart->cart_items as $key => $cart_item) {
echo "jQuery('#shipping_{$key}').html(\"" . wpsc_currency_display($cart_item->shipping) . "\");\n\r";
}
echo "jQuery('#checkout_shipping').html(\"" . wpsc_cart_shipping() . "\");\n\r";
echo "jQuery('div.shopping-cart-wrapper').html('{$output}');\n";
if (get_option('lock_tax') == 1) {
echo "jQuery('.shipping_country').val('" . $_SESSION['wpsc_delivery_country'] . "') \n";
$sql = "SELECT `country` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `isocode`='" . $_SESSION['wpsc_selected_country'] . "'";
$country_name = $wpdb->get_var($sql);
echo "jQuery('.shipping_country_name').html('" . $country_name . "') \n";
}
$form_selected_country = null;
$form_selected_region = null;
$onchange_function = null;
if ($_POST['billing_country'] != 'undefined' && !isset($_POST['shipping_country'])) {
$form_selected_country = $wpsc_selected_country;
$form_selected_region = $wpsc_selected_region;
$onchange_function = 'set_billing_country';
} else {
if ($_POST['shipping_country'] != 'undefined' && !isset($_POST['billing_country'])) {
$form_selected_country = $wpsc_delivery_country;
$form_selected_region = $wpsc_delivery_region;
$onchange_function = 'set_shipping_country';
}
}
if ($form_selected_country != null && $onchange_function != null) {
$region_list = $wpdb->get_results("SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "`, `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `" . WPSC_TABLE_CURRENCY_LIST . "`.`isocode` IN('" . $form_selected_country . "') AND `" . WPSC_TABLE_CURRENCY_LIST . "`.`id` = `" . WPSC_TABLE_REGION_TAX . "`.`country_id`", ARRAY_A);
if ($region_list != null) {
$title = empty($_POST['billing_country']) ? 'shippingstate' : 'billingstate';
$output = "<select name='collected_data[" . $form_id . "][1]' class='current_region' onchange='{$onchange_function}(\"region_country_form_{$form_id}\", \"{$form_id}\");' title='" . $title . "'>\n\r";
foreach ($region_list as $region) {
if ($form_selected_region == $region['id']) {
//.........这里部分代码省略.........
示例10: _wpsc_manage_products_column_sale_price
/**
* Sale price column in Manage Products page.
*
* @since 3.8.9
* @access private
* @param object $post Post object
* @param int $post_id Post ID
* @param boolean $has_variations Whether the product has variations
*/
function _wpsc_manage_products_column_sale_price($post, $post_id, $has_variations)
{
$price = get_post_meta($post->ID, '_wpsc_special_price', true);
if (!$has_variations) {
echo wpsc_currency_display($price);
echo '<div id="inline_' . $post->ID . '_sale_price" class="hidden">' . $price . '</div>';
} else {
echo wpsc_product_variation_price_available($post->ID) . '+';
}
}
示例11: wpsc_user_purchases
function wpsc_user_purchases()
{
global $wpdb, $user_ID, $wpsc_purchlog_statuses, $gateway_checkout_form_fields, $purchase_log, $col_count, $nzshpcrt_gateways;
$i = 0;
$subtotal = 0;
do_action('wpsc_pre_purchase_logs');
foreach ((array) $purchase_log as $purchase) {
$status_state = "expand";
$status_style = "display:none;";
$alternate = "";
$i++;
if ($i % 2 != 0) {
$alternate = "alt";
}
echo "<tr class='{$alternate}'>\n\r";
echo " <td class='status processed'>";
echo "<a href=\"#\" onclick=\"return show_details_box('status_box_" . $purchase['id'] . "','log_expander_icon_" . $purchase['id'] . "');\">";
if (!empty($_GET['id']) && $_GET['id'] == $purchase['id']) {
$status_state = "collapse";
$status_style = "style='display: block;'";
}
echo "<img class=\"log_expander_icon\" id=\"log_expander_icon_" . $purchase['id'] . "\" src=\"" . WPSC_CORE_IMAGES_URL . "/icon_window_{$status_state}.gif\" alt=\"\" title=\"\" />";
echo "<span id='form_group_" . $purchase['id'] . "_text'>" . __('Details', 'wpsc') . "</span>";
echo "</a>";
echo " </td>\n\r";
echo " <td class='date'>";
echo date("jS M Y", $purchase['date']);
echo " </td>\n\r";
echo " <td class='price'>";
$country = get_option('country_form_field');
if ($purchase['shipping_country'] != '') {
$billing_country = $purchase['billing_country'];
$shipping_country = $purchase['shipping_country'];
} elseif (!empty($country)) {
$country_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` WHERE `log_id` = %d AND `form_id` = %d LIMIT 1", $purchase['id'], get_option('country_form_field'));
$country_data = $wpdb->get_results($country_sql, ARRAY_A);
$billing_country = $country_data[0]['value'];
$shipping_country = $country_data[0]['value'];
}
echo wpsc_currency_display($purchase['totalprice'], array('display_as_html' => false));
$subtotal += $purchase['totalprice'];
echo " </td>\n\r";
if (get_option('payment_method') == 2) {
echo " <td class='payment_method'>";
$gateway_name = '';
foreach ((array) $nzshpcrt_gateways as $gateway) {
if ($purchase['gateway'] != 'testmode') {
if ($gateway['internalname'] == $purchase['gateway']) {
$gateway_name = $gateway['name'];
}
} else {
$gateway_name = __("Manual Payment", 'wpsc');
}
}
echo $gateway_name;
echo " </td>\n\r";
}
echo "</tr>\n\r";
echo "<tr>\n\r";
echo " <td colspan='{$col_count}' class='details'>\n\r";
echo " <div id='status_box_" . $purchase['id'] . "' class='order_status' style=\"{$status_style}\">\n\r";
echo " <div>\n\r";
//order status code lies here
//check what $purchase['processed'] reflects in the $wpsc_purchlog_statuses array
$status_name = wpsc_find_purchlog_status_name($purchase['processed']);
echo " <strong class='form_group'>" . __('Order Status', 'wpsc') . ":</strong>\n\r";
echo $status_name . "<br /><br />";
do_action('wpsc_user_log_after_order_status', $purchase);
//written by allen
$usps_id = get_option('usps_user_id');
if ($usps_id != null) {
$XML1 = "<TrackFieldRequest USERID=\"{$usps_id}\"><TrackID ID=\"" . $purchase['track_id'] . "\"></TrackID></TrackFieldRequest>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://secure.shippingapis.com/ShippingAPITest.dll?");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$postdata = "API=TrackV2&XML=" . $XML1;
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$parser = new xml2array();
$parsed = $parser->parse($result);
$parsed = $parsed[0]['children'][0]['children'];
if ($purchase['track_id'] != null) {
echo "<br /><br />";
echo " <strong class='form_group'>" . __('Shipping Address', 'wpsc') . "</strong>\n\r";
echo "<table>";
foreach ((array) $parsed as $parse) {
if ($parse['name'] == "TRACKSUMMARY") {
foreach ((array) $parse['children'] as $attrs) {
if ($attrs['name'] != "EVENT") {
$attrs['name'] = str_replace("EVENT", "", $attrs['name']);
}
$bar = ucfirst(strtolower($attrs['name']));
echo "<tr><td>" . $bar . "</td><td>" . $attrs['tagData'] . "</td></tr>";
}
}
}
echo "</table>";
}
echo "<br /><br />";
//.........这里部分代码省略.........
示例12: wpsc_cart_item_shipping
/**
* cart item shipping function, no parameters
* @return string the cart item price multiplied by the quantity, with a currency sign
*/
function wpsc_cart_item_shipping($forDisplay = true)
{
global $wpsc_cart;
if ($forDisplay) {
return wpsc_currency_display($wpsc_cart->cart_item->shipping);
} else {
return $wpsc_cart->cart_item->shipping;
}
}
示例13: process_as_currency
/**
* process_as_currency method
*
* @access public
*
* @param float a price
* @return string a price with a currency sign
*/
function process_as_currency($price)
{
_wpsc_deprecated_function(__FUNCTION__, '3.8', 'wpsc_currency_display');
return wpsc_currency_display($price);
}
示例14: add_pushes
public function add_pushes($session_id)
{
global $wpdb;
$purchase = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= %s LIMIT 1", $session_id));
$purchase_id = $purchase->id;
$output = '';
$city = $wpdb->get_var($wpdb->prepare("\n\t\t\t\t\t\tSELECT tf.value FROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " tf\n\t\t\t\t\t\tLEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf\n\t\t\t\t\t\tON cf.id = tf.form_id\n\t\t\t\t\t\tWHERE cf.unique_name = 'billingcity'\n\t\t\t\t\t\tAND log_id = %d", $purchase_id));
$state = $wpdb->get_var($wpdb->prepare("\n\t\t\t\t\t\tSELECT tf.value\n\t\t\t\t\t\tFROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " tf\n\t\t\t\t\t\tLEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf\n\t\t\t\t\t\tON cf.id = tf.form_id\n\t\t\t\t\t\tWHERE cf.unique_name = 'billingstate'\n\t\t\t\t\t\tAND log_id = %d", $purchase_id));
$country = $wpdb->get_var($wpdb->prepare("\n\t\t\t\t\t\tSELECT tf.value\n\t\t\t\t\t\tFROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " tf\n\t\t\t\t\t\tLEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf\n\t\t\t\t\t\tON cf.id = tf.form_id\n\t\t\t\t\t\tWHERE cf.unique_name = 'billingcountry'\n\t\t\t\t\t\tAND log_id = %d", $purchase_id));
$city = !empty($city) ? $city : '';
$state = !empty($state) ? wpsc_get_state_by_id($state, 'name') : '';
$country = !empty($country) ? $country : '';
$cart_items = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid = %d", $purchase_id), ARRAY_A);
$total_shipping = wpsc_get_total_shipping($purchase_id);
$total_tax = $total_price = 0;
foreach ($cart_items as $item) {
$total_tax += $item['tax_charged'];
$total_price += $item['price'];
}
if ($this->is_theme_tracking || $this->advanced_code) {
$output .= "<script type='text/javascript'>\n\r";
}
add_filter('wpsc_toggle_display_currency_code', array($this, 'remove_currency_and_html'));
$output .= "\n\t\t\t_gaq.push(['_addTrans',\n\t\t\t'" . $purchase_id . "', // order ID - required\n\t\t\t'" . wp_specialchars_decode($this->get_site_name()) . "', // affiliation or store name\n\t\t\t'" . number_format($total_price, 2, '.', '') . "', // total - required\n\t\t\t'" . wpsc_currency_display($total_tax) . "', // tax\n\t\t\t'" . wpsc_currency_display($total_shipping) . "', // shipping\n\t\t\t'" . wp_specialchars_decode($city) . "', // city\n\t\t\t'" . wp_specialchars_decode($state) . "', // state or province\n\t\t\t'" . wp_specialchars_decode($country) . "' // country\n \t\t]);\n\r";
remove_filter('wpsc_toggle_display_currency_code', array($this, 'remove_currency_and_html'));
foreach ($cart_items as $item) {
$category = wp_get_object_terms($item['prodid'], 'wpsc_product_category', array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'all_with_object_id'));
$item['sku'] = get_post_meta($item['prodid'], '_wpsc_sku', true);
if ($category) {
$item['category'] = $category[0]->name;
} else {
$item['category'] = '';
}
$item = array_map('wp_specialchars_decode', $item);
$output .= "_gaq.push(['_addItem'," . "'" . $purchase_id . "'," . "'" . $item['sku'] . "'," . "'" . $item['name'] . "'," . "'" . $item['category'] . "'," . "'" . $item['price'] . "'," . "'" . $item['quantity'] . "']);\n\r";
// Item Quantity
}
$output .= "_gaq.push(['_trackTrans']);\n\r";
if ($this->is_theme_tracking || $this->advanced_code) {
$output .= "</script>\n\r";
}
return $output;
}
示例15: get_last_few_order_details
function get_last_few_order_details($product_id, $select, $from, $group_by, $where)
{
global $wpdb, $cat_rev, $months, $order_arr;
$select .= ",wtcc.purchaseid as PurchaseID,wtpl.date as date,wtpl.totalprice as totalprice";
$select .= ",(select concat(a.value,' ',b.value) from {$wpdb->prefix}wpsc_submited_form_data as a \n\t\t\t\t\tJoin {$wpdb->prefix}wpsc_submited_form_data as b\n\t\t\t\t\twhere a.form_id=(select id from {$wpdb->prefix}wpsc_checkout_forms where unique_name like 'billingfirstname')\n\t\t\t\t\tand b.form_id=(select id from {$wpdb->prefix}wpsc_checkout_forms where unique_name like 'billinglastname')\n\t\t\t\t\tand a.log_id=PurchaseID and b.log_id=PurchaseID) as cname";
$order_by = "ORDER BY date DESC";
$limit = "limit 0,5";
if (isset($product_id)) {
$group_by .= "GROUP BY PurchaseID";
}
if (isset($product_id) && $product_id != 0) {
$where .= " AND prodid = {$product_id} ";
}
$query = "{$select} {$from} {$where} {$group_by} {$order_by} {$limit}";
$results = $wpdb->get_results($query, 'ARRAY_A');
$num_rows = $wpdb->num_rows;
$no_records = $num_rows;
if ($no_records == 0) {
$encoded['orderDetails']['order'] = '';
$encoded['orderDetails']['orderTotalCount'] = 0;
} else {
$cnt = 0;
$order_data = array();
foreach ($results as $result) {
// put within condition
$order_data[$cnt]['purchaseid'] = $result['PurchaseID'];
$order_data[$cnt]['date'] = date("d-M-Y", $result['date']);
$order_data[$cnt]['totalprice'] = wpsc_currency_display($result['totalprice']);
$order_data[$cnt]['cname'] = $result['cname'];
$orders[] = $order_data[$cnt];
$cnt++;
}
$encoded['orderDetails']['order'] = $orders;
$encoded['orderDetails']['orderTotalCount'] = count($orders);
}
return $encoded;
}