本文整理汇总了PHP中nzshpcrt_currency_display函数的典型用法代码示例。如果您正苦于以下问题:PHP nzshpcrt_currency_display函数的具体用法?PHP nzshpcrt_currency_display怎么用?PHP nzshpcrt_currency_display使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nzshpcrt_currency_display函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nzshpcrt_specials
function nzshpcrt_specials($input = null)
{
global $wpdb;
$image_width = get_option('product_image_width');
$image_height = get_option('product_image_height');
$siteurl = get_option('siteurl');
$sql = "SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `special_price` != '0.00' AND `active` IN ('1') ORDER BY RAND() LIMIT 1";
$product = $wpdb->get_results($sql, ARRAY_A);
if ($product != null) {
$output = "<div>";
foreach ($product as $special) {
$special['name'] = htmlentities(stripslashes($special['name']), ENT_QUOTES, "UTF-8");
$output .= "<strong><a class='wpsc_product_title' href='" . wpsc_product_url($special['id'], $special['category']) . "'>" . $special['name'] . "</a></strong><br /> ";
if (is_numeric($special['image'])) {
$image_file_name = $wpdb->get_var("SELECT `image` FROM `" . WPSC_TABLE_PRODUCT_IMAGES . "` WHERE `id`= '" . $special['image'] . "' LIMIT 1");
if ($image_file_name != '') {
$image_path = "index.php?productid=" . $special['id'] . "&width=" . $image_width . "&height=" . $image_height . "";
$output .= "<img src='" . $image_path . "' title='" . $special['name'] . "' alt='" . $special['name'] . "' /><br />";
}
}
//exit('Widget specisl'.get_option('wpsc_special_description'));
if (get_option('wpsc_special_description') != '1') {
$output .= $special['description'] . "<br />";
}
$variations_processor = new nzshpcrt_variations();
$variations_output = $variations_processor->display_product_variations($special['id'], true, false, true);
$output .= $variations_output[0];
if ($variations_output[1] !== null) {
$special['price'] = $variations_output[1];
$special['special_price'] = 0;
}
if ($variations_output[1] == null) {
$output .= "<span class='oldprice'>" . nzshpcrt_currency_display($special['price'], $special['notax'], false) . "</span><br />";
}
$output .= "<span id='special_product_price_" . $special['id'] . "'><span class='pricedisplay'>";
$output .= nzshpcrt_currency_display($special['price'] - $special['special_price'], $special['notax'], false, $product['id']);
$output .= "</span></span><br />";
$output .= "<form id='specials_" . $special['id'] . "' method='post' action='' onsubmit='submitform(this, null);return false;' >";
$output .= "<input type='hidden' name='product_id' value='" . $special['id'] . "'/>";
$output .= "<input type='hidden' name='item' value='" . $special['id'] . "' />";
$output .= "<input type='hidden' name='wpsc_ajax_action' value='special_widget' />";
if ($special['quantity_limited'] == 1 && $special['quantity'] < 1) {
$output .= TXT_WPSC_PRODUCTSOLDOUT . "";
} else {
//$output .= $variations_processor->display_product_variations($special['id'],true);
$output .= "<input type='submit' name='" . TXT_WPSC_ADDTOCART . "' value='" . TXT_WPSC_ADDTOCART . "' />";
}
$output .= "</form>";
}
$output .= "</div>";
} else {
$output = '';
}
echo $input . $output;
}
示例2: display_product_extras
function display_product_extras($product_id, $no_label = false, $no_br = false, $update_price = false)
{
global $wpdb;
$output = '';
$sql = "SELECT * FROM `" . $wpdb->prefix . "product_list` WHERE `id`='" . $product_id . "' LIMIT 1";
$product_data = $wpdb->get_row($sql, ARRAY_A);
$extras_assoc_sql = "SELECT * FROM `" . $wpdb->prefix . "extras_values_associations` WHERE product_id IN ('{$product_id}')";
$extras_assoc_data = $wpdb->get_results($extras_assoc_sql, ARRAY_A);
if (count($extras_assoc_data) == 0) {
return '';
}
foreach ($extras_assoc_data as $extras_association) {
$extras_ids[] = $extras_association['extras_id'];
}
//echo
$special = 'false';
if ($no_label == true) {
$special = 'true';
}
$extras_ids_str = implode(',', $extras_ids);
$extras_name_sql = "SELECT * FROM " . $wpdb->prefix . "product_extra WHERE id IN (" . $extras_ids_str . ") ORDER BY id";
$extras_name_data = $wpdb->get_results($extras_name_sql, ARRAY_A);
//exit("<pre>".print_r($extras_name_data,1)."</pre>");
$j = 0;
$x = 0;
foreach ($extras_name_data as $extras_name_datum) {
$j++;
$extras_value_sql = "SELECT * FROM " . $wpdb->prefix . "extras_values WHERE extras_id IN (" . $extras_name_datum['id'] . ")";
$extras_value_data = $wpdb->get_results($extras_value_sql, ARRAY_A);
//exit("<pre>".print_r($extras_value_data,1)."</pre>");
$output .= "<label>" . $extras_name_datum['name'] . "</label>" . $extras_name_datum['price'] . "<br>";
if ($j == 1) {
$price = '';
$checked = 'checked="checked"';
} else {
$price = nzshpcrt_currency_display($extras_assoc_data[$x]['price'], 0);
$checked = '';
}
foreach ($extras_value_data as $extras_value_datum) {
if ($j == 1) {
$price = '';
} else {
$price = nzshpcrt_currency_display($extras_assoc_data[$x]['price'], 0);
}
$output .= "<input style='float:left;' type='checkbox' {$checked} name='extras[]' value='" . $extras_value_datum['id'] . "' class='extras_" . $product_id . "' id='extras_" . $product_id . "_" . $extras_value_datum['id'] . "' onclick='manage_extras(" . $product_id . "," . $extras_value_datum['id'] . "," . $special . ")' id='extra_value_id_" . $extras_value_datum['id'] . "'><label style='float:left;' for='extras_" . $product_id . "_" . $extras_value_datum['id'] . "'>" . $extras_value_datum['name'] . " " . $price . "</label><img style='display:none;float:left;' id='extras_indicator" . $product_id . $extras_value_datum['id'] . "' src=' " . WPSC_DIR_NAME . "/images/indicator.gif'><br>";
$x++;
}
}
return $output;
}
示例3: wpsc_grid_title_and_price
function wpsc_grid_title_and_price(&$product)
{
$output .= "<div class='grid_price'>";
if ($soldout) {
$output .= "<span class='soldoutgrid'>Sold out</span>";
} else {
if ($product['special'] == 1) {
$output .= nzshpcrt_currency_display($product['price'] - $product['special_price'], $product['notax'], false, $product['id']) . "\n\r";
} else {
$output .= nzshpcrt_currency_display($product['price'], $product['notax']) . "\n\r";
}
}
$output .= "</div>";
$output .= "<div class='grid_prodcut_title'><a href='" . wpsc_product_url($product['id']) . "'>" . stripslashes($product['name']) . "</a></div>";
return $output;
}
示例4: nzshpcrt_specials
function nzshpcrt_specials($input = null)
{
global $wpdb;
$siteurl = get_option('siteurl');
$sql = "SELECT * FROM `" . $wpdb->prefix . "product_list` WHERE `special` = '1' ORDER BY RAND() LIMIT 1";
$product = $wpdb->get_results($sql, ARRAY_A);
if ($product != null) {
$output = "<div><div>";
foreach ($product as $special) {
$output .= "<strong>" . $special['name'] . "</strong><br /> ";
if ($special['image'] != null) {
$output .= "<img src='{$siteurl}/wp-content/plugins/wp-shopping-cart/product_images/thumbnails/" . $special['image'] . "' title='" . $special['name'] . "' alt='" . $special['name'] . "' /><br />";
}
$output .= $special['description'] . "<br />";
// $output .= $special['price'];
$variations_processor = new nzshpcrt_variations();
$variations_output = $variations_processor->display_product_variations($special['id'], true, false, true);
$output .= $variations_output[0];
if ($variations_output[1] !== null) {
$special['price'] = $variations_output[1];
}
if ($variations_output[1] == null) {
$output .= "<span class='oldprice'>" . nzshpcrt_currency_display($special['price'], $special['notax'], false) . "</span><br />";
}
$output .= "<span id='special_product_price_" . $special['id'] . "'><span class='pricedisplay'>";
$output .= nzshpcrt_currency_display($special['price'] - $special['special_price'], $special['notax'], false, $product['id']);
$output .= "</span></span><br />";
$output .= "<form id='specials_" . $special['id'] . "' name='{$num}' method='post' action='#' onsubmit='submitform(this);return false;' >";
$output .= "<input type='hidden' name='prodid' value='" . $special['id'] . "'/>";
$output .= "<input type='hidden' name='item' value='" . $special['id'] . "' />";
if ($special['quantity_limited'] == 1 && $special['quantity'] < 1) {
$output .= TXT_WPSC_PRODUCTSOLDOUT . "";
} else {
//$output .= $variations_processor->display_product_variations($special['id'],true);
$output .= "<input type='submit' name='" . TXT_WPSC_ADDTOCART . "' value='" . TXT_WPSC_ADDTOCART . "' />";
}
$output .= "</form>";
}
$output .= "</div></div>";
} else {
$output = '';
}
echo $input . $output;
}
示例5: nzshpcrt_price_range
function nzshpcrt_price_range($input = null)
{
global $wpdb;
$siteurl = get_option('siteurl');
$product_page = get_option("product_list_url");
if (stristr($product_page, "?")) {
$seperater = '&';
} else {
$seperater = '?';
}
$result = $wpdb->get_results("SELECT DISTINCT `price` FROM " . WPSC_TABLE_PRODUCT_LIST . " WHERE `active` IN ('1') ORDER BY price ASC", ARRAY_A);
if ($result != null) {
sort($result);
$count = count($result);
$price_seperater = ceil($count / 6);
for ($i = 0; $i < $count; $i += $price_seperater) {
$ranges[] = round($result[$i]['price'], -1);
}
$ranges = array_unique($ranges);
$final_count = count($ranges);
$ranges = array_merge(array(), $ranges);
$_SESSION['price_range'] = $ranges;
// echo('<pre>'.print_r($ranges, true).'</pre>');
for ($i = 0; $i < $final_count; $i++) {
$j = $i;
if ($i == $final_count - 1) {
echo "<a href='" . htmlentities($product_page . $seperater . "range=" . $j) . "'>Over " . nzshpcrt_currency_display($ranges[$i], 1, true) . "</a><br/>";
} else {
if ($ranges[$i] == 0) {
echo "<a href='" . htmlentities($product_page . $seperater . "range=" . $j) . "'>Under " . nzshpcrt_currency_display($ranges[$i + 1], 1, true) . "</a><br/>";
} else {
echo "<a href='" . htmlentities($product_page . $seperater . "range=" . $j) . "'>" . nzshpcrt_currency_display($ranges[$i], 1, true) . " - " . nzshpcrt_currency_display($ranges[$i + 1], 1, true) . "</a><br/>";
}
}
}
if (get_option('permalink_structure') != '') {
$seperator = "?";
} else {
$seperator = "&";
}
echo "<a href='" . get_option("product_list_url") . $seperator . "range=all'>" . __('Show All', 'wpsc') . "</a><br/>";
}
}
示例6: transaction_results
//.........这里部分代码省略.........
if ($purchase_log['email_sent'] != 1) {
$wpdb->query("UPDATE `" . WPSC_TABLE_DOWNLOAD_STATUS . "` SET `active`='1' WHERE (`fileid` = '{$product_data['file']}' OR `cartid` = '{$row['id']}' ) AND `purchid` = '{$purchase_log['id']}'");
}
do_action('wpsc_transaction_result_cart_item', array("purchase_id" => $purchase_log['id'], "cart_item" => $row, "purchase_log" => $purchase_log));
if ($purchase_log['processed'] >= 2) {
$download_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "`\r\n\t\t\t\t\t INNER JOIN `" . WPSC_TABLE_PRODUCT_FILES . "`\r\n\t\t\t\t\t ON `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`fileid` = `" . WPSC_TABLE_PRODUCT_FILES . "`.`id`\r\n\t\t\t\t\t WHERE `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`active`='1'\r\n\t\t\t\t\t AND `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`purchid`='" . $purchase_log['id'] . "'\r\n\t\t\t\t\t AND (\r\n\t\t\t\t\t\t`" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`cartid` = '" . $row['id'] . "'\r\n\t\t\t\t\t\t\tOR (\r\n\t\t\t\t\t\t\t\t`" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`cartid` IS NULL\r\n\t\t\t\t\t\t\t\tAND `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`fileid` = '{$product_data['file']}'\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t\tAND `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`id` NOT IN ('" . implode("','", $previous_download_ids) . "')", ARRAY_A);
$link = array();
//exit('IM HERE'.$errorcode.'<pre>'.print_r($download_data).'</pre>');
if (sizeof($download_data) != 0) {
foreach ($download_data as $single_download) {
if ($single_download['uniqueid'] == null) {
// if the uniqueid is not equal to null, its "valid", regardless of what it is
$link[] = array("url" => site_url("?downloadid=" . $single_download['id']), "name" => $single_download["filename"]);
} else {
$link[] = array("url" => site_url("?downloadid=" . $single_download['uniqueid']), "name" => $single_download["filename"]);
}
}
//$order_status= 4;
} else {
$order_status = $purchase_log['processed'];
}
$previous_download_ids[] = $download_data['id'];
do_action('wpsc_confirm_checkout', $purchase_log['id']);
}
// do_action('wpsc_confirm_checkout', $purchase_log['id']);
$shipping = $row['pnp'];
$total_shipping += $shipping;
if ($product_data['special'] == 1) {
$price_modifier = $product_data['special_price'];
} else {
$price_modifier = 0;
}
$total += $row['price'] * $row['quantity'];
$message_price = nzshpcrt_currency_display($row['price'] * $row['quantity'], $product_data['notax'], true);
$shipping_price = nzshpcrt_currency_display($shipping, 1, true);
$variation_values = $wpdb->get_col("SELECT `value_id` FROM `" . WPSC_TABLE_CART_ITEM_VARIATIONS . "` WHERE `cart_id`='{$row['id']}'");
//echo "<pre>".print_r($product_data,true)."</pre>";
$variation_count = count($variation_values);
if ($purchase['gateway'] != 'testmode') {
if ($gateway['internalname'] == $purch_data[0]['gateway']) {
$gateway_name = $gateway['name'];
}
} else {
$gateway_name = "Manual Payment";
}
//echo "<pre>".print_r($variation_values,true)."</pre>";
$variation_list = '';
if ($variation_count > 0) {
$value_names = $wpdb->get_col("SELECT `name` FROM `" . WPSC_TABLE_VARIATION_VALUES . "` WHERE `id` IN ('" . implode("','", $variation_values) . "')");
$variation_list = " (" . stripslashes(implode(", ", $value_names)) . ")";
}
if ($link != '' && !empty($link)) {
$additional_content = apply_filters('wpsc_transaction_result_content', array("purchase_id" => $purchase_log['id'], "cart_item" => $row, "purchase_log" => $purchase_log));
if (!is_string($additional_content)) {
$additional_content = '';
}
//$product_list .= " - ". $product_data['name'] . stripslashes($variation_list) ." ".$message_price ." ".__('Click to download', 'wpsc').":\n\r $link\n\r".$additional_content;
//$product_list_html .= " - ". $product_data['name'] . stripslashes($variation_list) ." ".$message_price ." <a href='$link'>".__('Click to download', 'wpsc')."</a>\n". $additional_content;
$product_list .= " - " . $product_data['name'] . stripslashes($variation_list) . " " . $message_price;
$product_list_html .= " - " . $product_data['name'] . stripslashes($variation_list) . " " . $message_price;
foreach ($link as $single_link) {
$product_list .= "\n\r " . $single_link["name"] . ": " . $single_link["url"] . "\n\r";
$product_list_html .= "<a href='" . $single_link["url"] . "'>" . $single_link["name"] . "</a>\n";
$report_product_list .= "\n\r " . $single_link["name"] . ": " . $single_link["url"] . "\n\r";
// $report_product_list .="<a href='".$single_link["url"]."'>".$single_link["name"]."</a>\n";
}
示例7: wpsc_display_coupons_page
//.........这里部分代码省略.........
echo " </th>\n\r";
echo " <th>\n\r";
echo __('Start', 'wpsc');
echo " </th>\n\r";
echo " <th>\n\r";
echo __('Expiry', 'wpsc');
echo " </th>\n\r";
echo " <th>\n\r";
echo __('Active', 'wpsc');
echo " </th>\n\r";
echo " <th>\n\r";
echo __('Apply On All Products', 'wpsc');
echo " </th>\n\r";
echo " <th>\n\r";
echo __('Edit', 'wpsc');
echo " </th>\n\r";
$i = 0;
$coupon_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` ", ARRAY_A);
//exit('Coupon Data<pre>'.print_r($coupon_data, true).'</pre>');
foreach ((array) $coupon_data as $coupon) {
$alternate = "";
$i++;
if ($i % 2 != 0) {
$alternate = "class='alt'";
}
echo "<tr {$alternate}>\n\r";
echo " <td>\n\r";
echo $coupon['coupon_code'];
echo " </td>\n\r";
echo " <td>\n\r";
if ($coupon['is-percentage'] == 1) {
echo $coupon['value'] . "%";
} else {
echo nzshpcrt_currency_display($coupon['value'], 1);
}
echo " </td>\n\r";
echo " <td>\n\r";
echo date("d/m/Y", strtotime($coupon['start']));
echo " </td>\n\r";
echo " <td>\n\r";
echo date("d/m/Y", strtotime($coupon['expiry']));
echo " </td>\n\r";
echo " <td>\n\r";
switch ($coupon['active']) {
case 1:
echo "<img src='" . WPSC_URL . "/images/yes_stock.gif' alt='' title='' />";
break;
case 0:
default:
echo "<img src='" . WPSC_URL . "/images/no_stock.gif' alt='' title='' />";
break;
}
echo " </td>\n\r";
echo " <td>\n\r";
switch ($coupon['every_product']) {
case 1:
echo "<img src='" . WPSC_URL . "/images/yes_stock.gif' alt='' title='' />";
break;
case 0:
default:
echo "<img src='" . WPSC_URL . "/images/no_stock.gif' alt='' title='' />";
break;
}
echo " </td>\n\r";
echo " <td>\n\r";
echo "<a title='" . $coupon['coupon_code'] . "' href='javascript:void(0)' class='wpsc_edit_coupon' >" . __('Edit', 'wpsc') . "</a>";
示例8: transaction_results
function transaction_results($sessionid, $echo_to_screen = true, $transaction_id = null)
{
global $wpdb, $wpsc_cart;
//$curgateway = get_option('payment_gateway');
$curgateway = $wpdb->get_var("SELECT gateway FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE sessionid='{$sessionid}'");
$errorcode = 0;
$order_status = 2;
$siteurl = get_option('siteurl');
/*
* {Notes} Double check that $Echo_To_Screen is a boolean value
*/
$echo_to_screen = !is_bool($echo_to_screen) ? true : $echo_to_screen;
//exit('triggered but with errors?'.$echo_to_screen);
if (is_numeric($sessionid)) {
if ($echo_to_screen) {
echo apply_filters('wpsc_pre_transaction_results', '');
}
$purchase_log = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= " . $sessionid . " LIMIT 1", ARRAY_A);
if ($purchase_log['gateway'] == "testmode" && $purchase_log['processed'] < 2) {
$message = get_option('wpsc_email_receipt');
$message_html = $message;
} else {
$message = get_option('wpsc_email_receipt');
$message_html = $message;
}
$order_url = $siteurl . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php&purchcaseid=" . $purchase_log['id'];
if ($_GET['ipn_request'] != 'true' and get_option('paypal_ipn') == 1) {
if ($purchase_log == null) {
echo TXT_WPSC_ORDER_FAILED;
if (get_option('purch_log_email') != null && $purchase_log['email_sent'] != 1) {
wp_mail(get_option('purch_log_email'), TXT_WPSC_NEW_ORDER_PENDING_SUBJECT, TXT_WPSC_NEW_ORDER_PENDING_BODY . $order_url, "From: " . get_option('return_email') . "");
}
return false;
} else {
if ($purchase_log['processed'] < 2) {
//added by Thomas on 20/6/2007
echo TXT_WPSC_ORDER_PENDING . "<p style='margin: 1em 0px 0px 0px;' >" . nl2br(get_option('payment_instructions')) . "</p>";
/*if($purchase_log['gateway'] != 'testmode') {
if((get_option('purch_log_email') != null) && ($purchase_log['email_sent'] != 1)) {
mail(get_option('purch_log_email'), TXT_WPSC_NEW_ORDER_PENDING_SUBJECT, TXT_WPSC_NEW_ORDER_PENDING_BODY.$order_url, "From: ".get_option('return_email')."");
}
return false;
}*/
}
}
}
$cart = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='{$purchase_log['id']}'", ARRAY_A);
if ($purchase_log['shipping_country'] != '') {
$billing_country = $purchase_log['billing_country'];
$shipping_country = $purchase_log['shipping_country'];
} else {
$country = $wpdb->get_var("SELECT `value` FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id`=" . $purchase_log['id'] . " AND `form_id` = '" . get_option('country_form_field') . "' LIMIT 1");
$billing_country = $country;
$shipping_country = $country;
}
$email_form_field = $wpdb->get_results("SELECT `id`,`type` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `order` ASC LIMIT 1", ARRAY_A);
$email = $wpdb->get_var("SELECT `value` FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id`=" . $purchase_log['id'] . " AND `form_id` = '" . $email_form_field[0]['id'] . "' LIMIT 1");
$stock_adjusted = false;
$previous_download_ids = array(0);
$product_list = '';
if ($cart != null && $errorcode == 0) {
foreach ($cart as $row) {
$link = "";
$product_data = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `id`='{$row['prodid']}' LIMIT 1", ARRAY_A);
if ($purchase_log['email_sent'] != 1) {
$wpdb->query("UPDATE `" . WPSC_TABLE_DOWNLOAD_STATUS . "` SET `active`='1' WHERE (`fileid` = '{$product_data['file']}' OR `cartid` = '{$row['id']}' ) AND `purchid` = '{$purchase_log['id']}'");
}
do_action('wpsc_transaction_result_cart_item', array("purchase_id" => $purchase_log['id'], "cart_item" => $row, "purchase_log" => $purchase_log));
if ($purchase_log['processed'] >= 2) {
//echo "SELECT * FROM `".WPSC_TABLE_DOWNLOAD_STATUS."` WHERE `active`='1' AND `purchid`='".$purchase_log['id']."' AND (`cartid` = '".$row['id']."' OR (`cartid` IS NULL AND `fileid` = '{$product_data['file']}') ) AND `id` NOT IN ('".implode("','",$previous_download_ids)."') LIMIT 1";
$download_data = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `active`='1' AND `purchid`='" . $purchase_log['id'] . "' AND (`cartid` = '" . $row['id'] . "' OR (`cartid` IS NULL AND `fileid` = '{$product_data['file']}') ) AND `id` NOT IN ('" . implode("','", $previous_download_ids) . "') LIMIT 1", ARRAY_A);
//exit('IM HERE'.$errorcode.'<pre>'.print_r($download_data).'</pre>');
if ($download_data != null) {
if ($download_data['uniqueid'] == null) {
// if the uniqueid is not equal to null, its "valid", regardless of what it is
$link = $siteurl . "?downloadid=" . $download_data['id'];
} else {
$link = $siteurl . "?downloadid=" . $download_data['uniqueid'];
}
//$order_status= 4;
} else {
$order_status = $purchase_log['processed'];
}
$previous_download_ids[] = $download_data['id'];
}
do_action('wpsc_confirm_checkout', $purchase_log['id']);
$shipping = $row['pnp'] * $row['quantity'];
$total_shipping += $shipping;
if ($product_data['special'] == 1) {
$price_modifier = $product_data['special_price'];
} else {
$price_modifier = 0;
}
$total += $row['price'] * $row['quantity'];
$message_price = nzshpcrt_currency_display($row['price'] * $row['quantity'], $product_data['notax'], true);
$shipping_price = nzshpcrt_currency_display($shipping, 1, true);
$variation_values = $wpdb->get_col("SELECT `value_id` FROM `" . WPSC_TABLE_CART_ITEM_VARIATIONS . "` WHERE `cart_id`='{$row['id']}'");
//echo "<pre>".print_r($product_data,true)."</pre>";
$variation_count = count($variation_values);
if ($purchase['gateway'] != 'testmode') {
//.........这里部分代码省略.........
示例9: wpec_transaction_tracking
function wpec_transaction_tracking($push)
{
global $wpdb, $purchlogs, $cart_log_id;
if (!isset($cart_log_id) || empty($cart_log_id)) {
return $push;
}
$city = $wpdb->get_var("SELECT tf.value\n\t\t FROM " . WPSC_TABLE_SUBMITED_FORM_DATA . " tf\n\t\t LEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf\n\t\t ON cf.id = tf.form_id\n\t\t WHERE cf.type = 'city'\n\t\t AND log_id = " . $cart_log_id);
$country = $wpdb->get_var("SELECT tf.value\n\t\t FROM " . WPSC_TABLE_SUBMITED_FORM_DATA . " tf\n\t\t LEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf\n\t\t ON cf.id = tf.form_id\n\t\t WHERE cf.type = 'country'\n\t\t AND log_id = " . $cart_log_id);
$cart_items = $wpdb->get_results("SELECT * FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid = " . $cart_log_id, ARRAY_A);
$total_shipping = $purchlogs->allpurchaselogs[0]->base_shipping;
$total_tax = 0;
foreach ($cart_items as $item) {
$total_shipping += $item['pnp'];
$total_tax += $item['tax_charged'];
}
$push[] = "'_addTrans','" . $cart_log_id . "'," . "'" . GA_Filter::ga_str_clean(get_bloginfo('name')) . "'," . "'" . nzshpcrt_currency_display($purchlogs->allpurchaselogs[0]->totalprice, 1, true, false, true) . "'," . "'" . nzshpcrt_currency_display($total_tax, 1, true, false, true) . "'," . "'" . nzshpcrt_currency_display($total_shipping, 1, true, false, true) . "'," . "'" . $city . "'," . "''," . "'" . $country . "'";
// Country
foreach ($cart_items as $item) {
$item['sku'] = $wpdb->get_var("SELECT meta_value FROM " . WPSC_TABLE_PRODUCTMETA . " WHERE meta_key = 'sku' AND product_id = '" . $item['prodid'] . "' LIMIT 1");
$item['category'] = $wpdb->get_var("SELECT pc.name FROM " . WPSC_TABLE_PRODUCT_CATEGORIES . " pc LEFT JOIN " . WPSC_TABLE_ITEM_CATEGORY_ASSOC . " ca ON pc.id = ca.category_id WHERE pc.group_id = '1' AND ca.product_id = '" . $item['prodid'] . "'");
$push[] = "'_addItem'," . "'" . $cart_log_id . "'," . "'" . $item['sku'] . "'," . "'" . str_replace("'", "", $item['name']) . "'," . "'" . $item['category'] . "'," . "'" . $item['price'] . "'," . "'" . $item['quantity'] . "'";
// Item Quantity
}
$push[] = "'_trackTrans'";
return $push;
}
示例10: wpsc_purchlog_resend_email
/**
* Purchase log ajax code starts here
*/
function wpsc_purchlog_resend_email()
{
global $wpdb;
$siteurl = get_option('siteurl');
$log_id = $_GET['email_buyer_id'];
if (is_numeric($log_id)) {
$selectsql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`= " . $log_id . " LIMIT 1";
$purchase_log = $wpdb->get_row($selectsql, ARRAY_A);
if ($purchase_log['gateway'] == "testmode" && $purchase_log['processed'] < 2) {
$message = get_option("wpsc_email_receipt");
$message_html = "<h2 style='font-size:16px;font-weight:bold;color:#000;border:0px;padding-top: 0px;' >" . __('Your Order', 'wpsc') . "</h2>";
} else {
$message = get_option("wpsc_email_receipt");
$message_html = $message;
}
$order_url = $siteurl . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php&purchcaseid=" . $purchase_log['id'];
$cartsql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase_log['id'] . "";
$cart = $wpdb->get_results($cartsql, ARRAY_A);
if ($purchase_log['shipping_country'] != '') {
$billing_country = $purchase_log['billing_country'];
$shipping_country = $purchase_log['shipping_country'];
} else {
$country = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id`=" . $purchase_log['id'] . " AND `form_id` = '" . get_option('country_form_field') . "' LIMIT 1", ARRAY_A);
$billing_country = $country[0]['value'];
$shipping_country = $country[0]['value'];
}
$email_form_field = $wpdb->get_results("SELECT `id`,`type` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `order` ASC LIMIT 1", ARRAY_A);
$email_address = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id`=" . $purchase_log['id'] . " AND `form_id` = '" . $email_form_field[0]['id'] . "' LIMIT 1", ARRAY_A);
$email = $email_address[0]['value'];
$previous_download_ids = array(0);
if ($cart != null) {
foreach ($cart as $row) {
$link = "";
$productsql = "SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `id`=" . $row['prodid'] . "";
$product_data = $wpdb->get_results($productsql, ARRAY_A);
if ($product_data[0]['file'] > 0) {
if ($purchase_log['email_sent'] != 1) {
$wpdb->query("UPDATE `" . WPSC_TABLE_DOWNLOAD_STATUS . "` SET `active`='1' WHERE `fileid`='" . $product_data[0]['file'] . "' AND `purchid` = '" . $purchase_log['id'] . "' LIMIT 1");
}
if ($purchase_log['processed'] >= 2) {
$download_data = $wpdb->get_results("SELECT *\r\n\t\t\t\t\t\tFROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` INNER JOIN `" . WPSC_TABLE_PRODUCT_FILES . "`\r\n\t\t\t\t\t\tON `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`fileid` = `" . WPSC_TABLE_PRODUCT_FILES . "`.`id`\r\n\t\t\t\t\t\tWHERE `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`active`='1'\r\n\t\t\t\t\t\tAND `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`purchid`='" . $purchase_log['id'] . "'\r\n\t\t\t\t\t\tAND (\r\n\t\t\t\t\t\t\t`" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`cartid` = '" . $row['id'] . "'\r\n\t\t\t\t\t\t\tOR (\r\n\t\t\t\t\t\t\t\t`" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`cartid` IS NULL\r\n\t\t\t\t\t\t\t\tAND `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`fileid` = '{$product_data['file']}'\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t\t AND `" . WPSC_TABLE_DOWNLOAD_STATUS . "`.`id` NOT IN ('" . implode("','", $previous_download_ids) . "')", ARRAY_A);
$link = array();
//exit('IM HERE'.$errorcode.'<pre>'.print_r($download_data).'</pre>');
if (sizeof($download_data) != 0) {
foreach ($download_data as $single_download) {
if ($single_download['uniqueid'] == null) {
// if the uniqueid is not equal to null, its "valid", regardless of what it is
$link[] = array("url" => $siteurl . "?downloadid=" . $single_download['id'], "name" => $single_download["filename"]);
} else {
$link[] = array("url" => $siteurl . "?downloadid=" . $single_download['uniqueid'], "name" => $single_download["filename"]);
}
}
}
$previous_download_ids[] = $download_data['id'];
$order_status = 4;
}
}
do_action('wpsc_confirm_checkout', $purchase_log['id']);
$shipping = nzshpcrt_determine_item_shipping($row['prodid'], $row['quantity'], $shipping_country);
if (isset($_SESSION['quote_shipping'])) {
$shipping = $_SESSION['quote_shipping'];
}
$total_shipping += $shipping;
if ($product_data[0]['special'] == 1) {
$price_modifier = $product_data[0]['special_price'];
} else {
$price_modifier = 0;
}
$total += $row['price'] * $row['quantity'];
$message_price = nzshpcrt_currency_display($row['price'] * $row['quantity'], $product_data[0]['notax'], true);
$shipping_price = nzshpcrt_currency_display($shipping, 1, true);
$variation_sql = "SELECT * FROM `" . WPSC_TABLE_CART_ITEM_VARIATIONS . "` WHERE `cart_id`='" . $row['id'] . "'";
$variation_data = $wpdb->get_results($variation_sql, ARRAY_A);
$variation_count = count($variation_data);
if ($variation_count > 1) {
$variation_list = " (";
if ($purchase['gateway'] != 'testmode') {
if ($gateway['internalname'] == $purch_data[0]['gateway']) {
$gateway_name = $gateway['name'];
}
} else {
$gateway_name = "Manual Payment";
}
$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'];
//.........这里部分代码省略.........
示例11: wpsc_packing_slip
//.........这里部分代码省略.........
}
}
}
// echo " <tr><td colspan='2'></td></tr>\n\r";
// echo " <tr><td>".TXT_WPSC_PAYMENT_METHOD.":</td><td>".$gateway_name."</td></tr>\n\r";
// //echo " <tr><td>".TXT_WPSC_PURCHASE_NUMBER.":</td><td>".$purch_data['id']."</td></tr>\n\r";
// echo " <tr><td>".TXT_WPSC_HOWCUSTOMERFINDUS.":</td><td>".$purch_data['find_us']."</td></tr>\n\r";
// $engrave_line = explode(",",$purch_data['engravetext']);
// echo " <tr><td>".TXT_WPSC_ENGRAVE."</td><td></td></tr>\n\r";
// echo " <tr><td>".TXT_WPSC_ENGRAVE_LINE_ONE.":</td><td>".$engrave_line[0]."</td></tr>\n\r";
// echo " <tr><td>".TXT_WPSC_ENGRAVE_LINE_TWO.":</td><td>".$engrave_line[1]."</td></tr>\n\r";
// if($purch_data['transactid'] != '') {
// echo " <tr><td>".TXT_WPSC_TXN_ID.":</td><td>".$purch_data['transactid']."</td></tr>\n\r";
// }
echo "</table>\n\r";
echo "<table class='packing_slip'>";
echo "<tr>";
echo " <th>" . TXT_WPSC_QUANTITY . " </th>";
echo " <th>" . TXT_WPSC_NAME . "</th>";
echo " <th>" . TXT_WPSC_PRICE . " </th>";
echo " <th>" . TXT_WPSC_SHIPPING . " </th>";
echo '<th>Tax</th>';
echo '</tr>';
$endtotal = 0;
$all_donations = true;
$all_no_shipping = true;
$file_link_list = array();
foreach ($cart_log as $cart_row) {
$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>';
echo nzshpcrt_currency_display($cart_row['tax_charged'], 1);
echo '<td>';
echo '</tr>';
}
echo "</table>";
echo "</div>\n\r";
} else {
echo "<br />" . TXT_WPSC_USERSCARTWASEMPTY;
}
}
示例12: wpsc_display_purchlog_totalprice
function wpsc_display_purchlog_totalprice()
{
global $purchlogitem;
$purchlogitem->totalAmount -= wpsc_display_purchlog_discount(true);
$purchlogitem->totalAmount += wpsc_display_purchlog_shipping(true);
//$purchlogitem->totalAmount += $purchlogitem->extrainfo->base_shipping;
return nzshpcrt_currency_display($purchlogitem->extrainfo->totalprice, true);
}
示例13: nzshpcrt_specials
function nzshpcrt_specials($input = null)
{
global $wpdb;
$siteurl = SITEURL;
$sql = "SELECT * FROM `wp_product_list` WHERE `special` = '1' LIMIT 1";
$product = $wpdb->get_results($sql, ARRAY_A);
if ($product != null) {
$output = "<div id='sideshoppingcart'><div id='shoppingcartcontents'><h2>" . TXT_WPSC_SPECIALS . "</h2><br \\>";
foreach ($product as $special) {
$output .= "<strong>" . $special['name'] . "</strong><br /> ";
if ($special['image'] != null) {
$output .= "<img src='http://th.cartoonbank.ru/" . $special['image'] . "' title='" . $special['name'] . "' alt='" . $special['name'] . "' /><br />";
}
$output .= $special['description'] . "<br />";
$output .= "<span class='oldprice'>" . nzshpcrt_currency_display($special['price'], $special['notax'], false) . "</span><br />";
// $output .= $special['price'];
$variations_procesor = new nzshpcrt_variations();
$output .= $variations_procesor->display_product_variations($product['id']);
$output .= nzshpcrt_currency_display($special['price'], $special['notax'], false, $special['id']) . "<br />";
$output .= "<form id='specials' name='{$num}' method='POST' action='#' onsubmit='submitform(this);return false;' >";
$output .= "<input type='hidden' name='prodid' value='" . $special['id'] . "'>";
$output .= "<input type='hidden' name='item' value='" . $special['id'] . "' />";
// $output .= "<input type='submit' name='Buy' value='".TXT_WPSC_BUY."' />";
if ($special['quantity_limited'] == 1 && $special['quantity'] < 1) {
$output .= TXT_WPSC_PRODUCTSOLDOUT . "";
} else {
$output .= $variations_procesor->display_product_variations($special['id'], true);
$output .= "<input type='submit' name='" . TXT_WPSC_ADDTOCART . "' value='" . TXT_WPSC_ADDTOCART . "' />";
}
$output .= "</form>";
}
$output .= "</div></div>";
} else {
$output = '';
}
echo $input . $output;
}
示例14: product_display_list
function product_display_list($product_list, $group_type, $group_sql = '', $search_sql = '')
{
global $wpdb;
$siteurl = get_option('siteurl');
if ((double) WPSC_VERSION < 3.8) {
$images_dir = 'images';
} else {
$images_dir = 'wpsc-core/images';
}
if (get_option('permalink_structure') != '') {
$seperator = "?";
} else {
$seperator = "&";
}
$product_listing_data = wpsc_get_product_listing($product_list, $group_type, $group_sql, $search_sql);
$product_list = $product_listing_data['product_list'];
$output .= $product_listing_data['page_listing'];
if ($product_listing_data['category_id']) {
$category_nice_name = $wpdb->get_var("SELECT `nice-name` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `id` ='" . (int) $product_listing_data['category_id'] . "' LIMIT 1");
} else {
$category_nice_name = '';
}
if ($product_list != null) {
$output .= "<table class='list_productdisplay {$category_nice_name}'>";
$i = 0;
foreach ($product_list as $product) {
$num++;
if ($i % 2 == 1) {
$output .= " <tr class='product_view_{$product['id']}'>";
} else {
$output .= " <tr class='product_view_{$product['id']}' style='background-color:#EEEEEE'>";
}
$i++;
$output .= " <td style='width: 9px;'>";
if ($product['description'] != null) {
$output .= "<a href='#' class='additional_description_link' onclick='return show_additional_description(\"list_description_" . $product['id'] . "\",\"link_icon" . $product['id'] . "\");'>";
$output .= "<img style='margin-top:3px;' id='link_icon" . $product['id'] . "' src='{$siteurl}/wp-content/plugins/" . WPSC_DIR_NAME . "/" . $images_dir . "/icon_window_expand.gif' title='" . $product['name'] . "' alt='" . $product['name'] . "' />";
$output .= "</a>";
}
$output .= " </td>\n\r";
$output .= " <td width='55%'>";
if ($product['special'] == 1) {
$special = "<strong class='special'>" . TXT_WPSC_SPECIAL . " - </strong>";
} else {
$special = "";
}
$output .= "<a href='" . wpsc_product_url($product['id']) . "' class='wpsc_product_title' ><strong>" . stripslashes($product['name']) . "</strong></a>";
$output .= " </td>";
$variations_procesor = new nzshpcrt_variations();
$variations_output = $variations_procesor->display_product_variations($product['id'], false, false, true);
if ($variations_output[1] !== null) {
$product['price'] = $variations_output[1];
}
$output .= " <td width='10px' style='text-align: center;'>";
if ($product['quantity'] < 1 && $product['quantity_limited'] == 1) {
$output .= "<img style='margin-top:5px;' src='{$siteurl}/wp-content/plugins/" . WPSC_DIR_NAME . "/" . $images_dir . "/no_stock.gif' title='No' alt='No' />";
} else {
$output .= "<img style='margin-top:4px;' src='{$siteurl}/wp-content/plugins/" . WPSC_DIR_NAME . "/" . $images_dir . "/yes_stock.gif' title='Yes' alt='Yes' />";
}
$output .= " </td>";
$output .= " <td width='10%'>";
if ($product['special'] == 1 && $variations_output[1] === null) {
$output .= nzshpcrt_currency_display($product['price'] - $product['special_price'], $product['notax'], false, $product['id']) . "<br />";
} else {
$output .= "<span id='product_price_" . $product['id'] . "'>" . nzshpcrt_currency_display($product['price'], $product['notax']) . "</span>";
}
$output .= " </td>";
$output .= " <td width='20%'>";
if (get_option('addtocart_or_buynow') == '0') {
$output .= "<form name='{$num}' id='product_" . $product['id'] . "' method='POST' action='" . get_option('product_list_url') . $seperator . "category=" . $_GET['category'] . "' onsubmit='submitform(this);return false;' >";
}
if (get_option('list_view_quantity') == 1) {
$output .= "<input type='text' name='quantity' value='1' size='3' maxlength='3'> ";
}
$output .= $variations_output[0];
$output .= "<input type='hidden' name='item' value='" . $product['id'] . "' />";
$output .= "<input type='hidden' name='prodid' value='" . $product['id'] . "'>";
if (get_option('wpsc_selected_theme') == 'iShop') {
if (get_option('addtocart_or_buynow') == '0') {
if ($product['quantity_limited'] == 1 && $product['quantity'] < 1) {
$output .= "<input disabled='true' type='submit' value='' name='Buy' class='wpsc_buy_button'/>";
} else {
$output .= "<input type='submit' name='Buy' value='' class='wpsc_buy_button'/>";
}
} else {
if (!($product['quantity_limited'] == 1 && $product['quantity'] < 1)) {
$output .= google_buynow($product['id']);
}
}
} else {
if (get_option('addtocart_or_buynow') == '0') {
if ($product['quantity_limited'] == 1 && $product['quantity'] < 1) {
$output .= "<input disabled='true' type='submit' name='Buy' class='wpsc_buy_button' value='" . TXT_WPSC_ADDTOCART . "' />";
} else {
$output .= "<input type='submit' name='Buy' class='wpsc_buy_button' value='" . TXT_WPSC_ADDTOCART . "' />";
}
} else {
if (!($product['quantity_limited'] == 1 && $product['quantity'] < 1)) {
$output .= google_buynow($product['id']);
}
//.........这里部分代码省略.........
示例15: nzshpcrt_overall_total_price
function nzshpcrt_overall_total_price($country_code = null, $for_display = false, $no_discount = false, $total_checkbox = 0)
{
/*
* Determines the total in the shopping cart, adds the tax and shipping if a country code is supplied and adds the discount of a coupon code is present
* Adds a dollar sign and information if there is no tax and shipping if $for_display is true
*/
global $wpdb;
$cart =& $_SESSION['nzshpcrt_cart'];
$total_quantity = 0;
$total_weight = 0;
$all_donations = true;
$all_no_shipping = true;
foreach ($cart as $cart_item) {
$product_id = $cart_item->product_id;
$quantity = $cart_item->quantity;
$product_variations = $cart_item->product_variations;
$extras = $cart_item->extras;
$extras_count = count($extras);
$raw_price = 0;
$variation_count = count($product_variations);
if ($variation_count > 0) {
foreach ($product_variations as $product_variation) {
$value_id = $product_variation;
$value_data = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "variation_values` WHERE `id`='" . $value_id . "' LIMIT 1", ARRAY_A);
}
}
//$total_quantity += $quantity;
$sql = "SELECT * FROM `" . $wpdb->prefix . "product_list` WHERE `id` = '{$product_id}' LIMIT 1";
$product = $wpdb->get_row($sql, ARRAY_A);
if ($product['donation'] == 1) {
$price = $quantity * $cart_item->donation_price;
} else {
$price = $quantity * calculate_product_price($product_id, $product_variations, 'stay', $extras);
if ($country_code != null) {
if ($product['notax'] != 1) {
$price = nzshpcrt_calculate_tax($price, $_SESSION['selected_country'], $_SESSION['selected_region']);
}
$shipping = nzshpcrt_determine_item_shipping($product_id, $quantity, $country_code);
$price += $shipping;
}
$all_donations = false;
}
if ($product['no_shipping'] != 1) {
$all_no_shipping = false;
}
$total += $price;
}
if ($country_code != null && $all_donations == false && $all_no_shipping == false) {
//echo $_SESSION['selected_country'];
//exit(nzshpcrt_determine_base_shipping(0, $country_code));
$total += nzshpcrt_determine_base_shipping(0, $_SESSION['delivery_country']);
}
if (!empty($_SESSION['coupon_num']) && $no_discount !== true) {
$total += nzshpcrt_apply_coupon($total, $_SESSION['coupon_num']) - $total;
}
if ($for_display === true) {
$total = nzshpcrt_currency_display($total, 1);
if ($country_code == null && get_option('add_plustax') == 1) {
$total .= "<span class='pluspostagetax'> + " . TXT_WPSC_POSTAGE_AND_TAX . "</span>";
}
}
return $total;
}