当前位置: 首页>>代码示例>>PHP>>正文


PHP wpsc_get_region函数代码示例

本文整理汇总了PHP中wpsc_get_region函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_get_region函数的具体用法?PHP wpsc_get_region怎么用?PHP wpsc_get_region使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wpsc_get_region函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpsc_packing_slip

function wpsc_packing_slip($purchase_id)
{
    echo "<!DOCTYPE html><html><head><title>" . __('Packing Slip', 'wpsc') . "</title></head><body id='wpsc-packing-slip'>";
    global $wpdb;
    $purch_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`='" . $purchase_id . "'";
    $purch_data = $wpdb->get_row($purch_sql, ARRAY_A);
    //echo "<p style='padding-left: 5px;'><strong>".__('Date', 'wpsc')."</strong>:".date("jS M Y", $purch_data['date'])."</p>";
    $cartsql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase_id . "";
    $cart_log = $wpdb->get_results($cartsql, ARRAY_A);
    $j = 0;
    if ($cart_log != null) {
        echo "<div class='packing_slip'>\n\r";
        echo apply_filters('wpsc_packing_slip_header', '<h2>' . __('Packing Slip', 'wpsc') . "</h2>\n\r");
        echo "<strong>" . __('Order', 'wpsc') . " #</strong> " . $purchase_id . "<br /><br />\n\r";
        echo "<table>\n\r";
        $form_sql = "SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE\t`log_id` = '" . (int) $purchase_id . "'";
        $input_data = $wpdb->get_results($form_sql, ARRAY_A);
        foreach ($input_data as $input_row) {
            $rekeyed_input[$input_row['form_id']] = $input_row;
        }
        if ($input_data != null) {
            $form_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1'", ARRAY_A);
            foreach ($form_data as $form_field) {
                switch ($form_field['type']) {
                    case 'country':
                        $delivery_region_count = $wpdb->get_var("SELECT COUNT(`regions`.`id`) FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('" . $wpdb->escape($purch_data['billing_country']) . "')");
                        if (is_numeric($purch_data['billing_region']) && $delivery_region_count > 0) {
                            echo "\t<tr><td>" . __('State', 'wpsc') . ":</td><td>" . wpsc_get_region($purch_data['billing_region']) . "</td></tr>\n\r";
                        }
                        echo "\t<tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8') . "</td></tr>\n\r";
                        break;
                    case 'delivery_country':
                        if (is_numeric($purch_data['shipping_region']) && $delivery_region_count > 0) {
                            echo "\t<tr><td>" . __('State', 'wpsc') . ":</td><td>" . wpsc_get_region($purch_data['shipping_region']) . "</td></tr>\n\r";
                        }
                        echo "\t<tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8') . "</td></tr>\n\r";
                        break;
                    case 'heading':
                        if ($form_field['name'] == "Hidden Fields") {
                            continue;
                        } else {
                            echo "\t<tr class='heading'><td colspan='2'><strong>" . wp_kses($form_field['name'], array()) . ":</strong></td></tr>\n\r";
                        }
                        break;
                    default:
                        if ($form_field['name'] == "Cupcakes") {
                            parse_str($rekeyed_input[$form_field['id']]['value'], $cupcakes);
                            foreach ($cupcakes as $product_id => $quantity) {
                                $product = get_post($product_id);
                                $string .= "(" . $quantity . ") " . $product->post_title . ", ";
                            }
                            $string = rtrim($string, ", ");
                            echo "\t<tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . htmlentities(stripslashes($string), ENT_QUOTES, 'UTF-8') . "</td></tr>\n\r";
                        } else {
                            if ($form_field['name'] == "State" && !empty($purch_data['billing_region']) || $form_field['name'] == "State" && !empty($purch_data['billing_region'])) {
                                echo "";
                            } else {
                                echo "\t<tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8') . "</td></tr>\n\r";
                            }
                        }
                        break;
                }
            }
        } else {
            echo "\t<tr><td>" . __('Name', 'wpsc') . ":</td><td>" . $purch_data['firstname'] . " " . $purch_data['lastname'] . "</td></tr>\n\r";
            echo "\t<tr><td>" . __('Address', 'wpsc') . ":</td><td>" . $purch_data['address'] . "</td></tr>\n\r";
            echo "\t<tr><td>" . __('Phone', 'wpsc') . ":</td><td>" . $purch_data['phone'] . "</td></tr>\n\r";
            echo "\t<tr><td>" . __('Email', 'wpsc') . ":</td><td>" . $purch_data['email'] . "</td></tr>\n\r";
        }
        if (2 == get_option('payment_method')) {
            $gateway_name = '';
            $nzshpcrt_gateways = nzshpcrt_get_gateways();
            foreach ($nzshpcrt_gateways as $gateway) {
                if ($purch_data['gateway'] != 'testmode') {
                    if ($gateway['internalname'] == $purch_data['gateway']) {
                        $gateway_name = $gateway['name'];
                    }
                } else {
                    $gateway_name = __('Manual Payment', 'wpsc');
                }
            }
        }
        echo "</table>\n\r";
        do_action('wpsc_packing_slip_extra_info', $purchase_id);
        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>' . __('Tax', 'wpsc') . '</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) {
//.........这里部分代码省略.........
开发者ID:hornet9,项目名称:Morato,代码行数:101,代码来源:admin-form-functions.php

示例2: shippingstate

 function shippingstate($id)
 {
     global $wpdb;
     if (is_numeric($id)) {
         $name = wpsc_get_region($id);
         return $name;
     } else {
         return $id;
     }
 }
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:10,代码来源:purchaselogs.class.php

示例3: wpsc_packing_slip

function wpsc_packing_slip($purchase_id)
{
    global $wpdb;
    $purch_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`='" . $purchase_id . "'";
    $purch_data = $wpdb->get_row($purch_sql, ARRAY_A);
    //echo "<p style='padding-left: 5px;'><strong>".TXT_WPSC_DATE."</strong>:".date("jS M Y", $purch_data['date'])."</p>";
    $cartsql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase_id . "";
    $cart_log = $wpdb->get_results($cartsql, ARRAY_A);
    $j = 0;
    if ($cart_log != null) {
        echo "<div class='packing_slip'>\n\r";
        echo "<h2>" . TXT_WPSC_PACKING_SLIP . "</h2>\n\r";
        echo "<strong>" . TXT_WPSC_ORDER . " #</strong> " . $purchase_id . "<br /><br />\n\r";
        echo "<table>\n\r";
        $form_sql = "SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE  `log_id` = '" . (int) $purchase_id . "'";
        $input_data = $wpdb->get_results($form_sql, ARRAY_A);
        foreach ($input_data as $input_row) {
            $rekeyed_input[$input_row['form_id']] = $input_row;
        }
        if ($input_data != null) {
            $form_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1'", ARRAY_A);
            foreach ($form_data as $form_field) {
                switch ($form_field['type']) {
                    case 'country':
                        $delivery_region_count = $wpdb->get_var("SELECT COUNT(`regions`.`id`) FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('" . $wpdb->escape($purch_data['billing_country']) . "')");
                        if (is_numeric($purch_data['shipping_region']) && $delivery_region_count > 0) {
                            echo "  <tr><td>" . __('State', 'wpsc') . ":</td><td>" . wpsc_get_region($purch_data['shipping_region']) . "</td></tr>\n\r";
                        }
                        echo "  <tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . wpsc_get_country($purch_data['billing_country']) . "</td></tr>\n\r";
                        break;
                    case 'delivery_country':
                        echo "  <tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . wpsc_get_country($purch_data['shipping_country']) . "</td></tr>\n\r";
                        break;
                    case 'heading':
                        echo "  <tr><td colspan='2'><strong>" . wp_kses($form_field['name'], array()) . ":</strong></td></tr>\n\r";
                        break;
                    default:
                        echo "  <tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES) . "</td></tr>\n\r";
                        break;
                }
            }
        } else {
            echo "  <tr><td>" . TXT_WPSC_NAME . ":</td><td>" . $purch_data['firstname'] . " " . $purch_data['lastname'] . "</td></tr>\n\r";
            echo "  <tr><td>" . TXT_WPSC_ADDRESS . ":</td><td>" . $purch_data['address'] . "</td></tr>\n\r";
            echo "  <tr><td>" . TXT_WPSC_PHONE . ":</td><td>" . $purch_data['phone'] . "</td></tr>\n\r";
            echo "  <tr><td>" . TXT_WPSC_EMAIL . ":</td><td>" . $purch_data['email'] . "</td></tr>\n\r";
        }
        if (get_option('payment_method') == 2) {
            $gateway_name = '';
            foreach ($GLOBALS['nzshpcrt_gateways'] as $gateway) {
                if ($purch_data['gateway'] != 'testmode') {
                    if ($gateway['internalname'] == $purch_data['gateway']) {
                        $gateway_name = $gateway['name'];
                    }
                } else {
                    $gateway_name = "Manual Payment";
                }
            }
        }
        // 			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 .= ", ";
//.........这里部分代码省略.........
开发者ID:alx,项目名称:SimplePress,代码行数:101,代码来源:admin-form-functions.php

示例4: filter_confirm_transaction_page

    public function filter_confirm_transaction_page()
    {
        ob_start();
        ?>
		<table width='400' class='paypal_express_form'>
	        <tr>
	            <td align='left' class='firstcol'><strong><?php 
        _e('Order Total:', 'wpsc');
        ?>
</strong></td>
	            <td align='left'><?php 
        echo wpsc_currency_display($this->purchase_log->get('totalprice'));
        ?>
</td>
	        </tr>
			<tr>
			    <td align='left' colspan='2'><strong><?php 
        _e('Shipping Details:', 'wpsc');
        ?>
</strong></td>
			</tr>
	        <tr>
	            <td align='left' class='firstcol'>
	                <?php 
        echo __('Address:', 'wpsc');
        ?>
				</td>
	            <td align='left'>
					<?php 
        echo esc_html($this->checkout_data->get('shippingaddress'));
        ?>
	            </td>
	        </tr>
	        <tr>
	            <td align='left' class='firstcol'>
	                <?php 
        echo __('City:', 'wpsc');
        ?>
				</td>
	            <td align='left'><?php 
        echo esc_html($this->checkout_data->get('shippingcity'));
        ?>
</td>
	        </tr>
	        <tr>
	            <td align='left' class='firstcol'>
	                <?php 
        echo __('State:', 'wpsc');
        ?>
				</td>
	            <td align='left'>
					<?php 
        echo esc_html(wpsc_get_region($this->checkout_data->get('shippingstate')));
        ?>
				</td>
	        </tr>
	        <tr>
	            <td align='left' class='firstcol'>
	                <?php 
        echo __('Postal code:', 'wpsc');
        ?>
				</td>
	            <td align='left'><?php 
        echo esc_html($this->checkout_data->get('shippingpostcode'));
        ?>
</td>
	        </tr>
	        <tr>
	            <td align='left' class='firstcol'>
	                <?php 
        echo __('Country:', 'wpsc');
        ?>
</td>
	            <td align='left'><?php 
        echo esc_html(wpsc_get_country($this->checkout_data->get('shippingcountry')));
        ?>
</td>
	        </tr>
	        <tr>
	            <td colspan='2'>
					<form action="<?php 
        echo remove_query_arg(array('payment_gateway', 'payment_gateway_callback'));
        ?>
" method='post'>
						<input type='hidden' name='payment_gateway' value='paypal-express-checkout' />
						<input type='hidden' name='payment_gateway_callback' value='process_confirmed_payment' />
						<p><input name='action' type='submit' value='<?php 
        _e('Confirm Payment', 'wpsc');
        ?>
' /></p>
					</form>
				</td>
	        </tr>
	    </table>
		<?php 
        $output = apply_filters('wpsc_confirm_payment_message', ob_get_clean(), $this->purchase_log);
        return $output;
    }
开发者ID:nikitanaumov,项目名称:WP-e-Commerce,代码行数:98,代码来源:paypal-express-checkout.php

示例5: getQuote

    /**
     * General entry point for WPEC external shipping calculator
     * This function expects no arguments but requires POST data
     * and configuration from the plugin settings
     * @return array $rate_table List of rates in "Service"=>"Rate" format
     */
    function getQuote()
    {
        global $wpdb, $wpec_ash, $wpec_ash_tools, $wpsc_cart;
        $data = array();
        //************** These values are common to all entry points **************
        //*** User/Customer Entered Values ***\\
        //*** Set up the destination country ***\
        $data["dest_country"] = wpsc_get_customer_meta('shipping_country');
        $settings = get_option('wpec_usps');
        //Disable International Shipping. Default: Enabled as it currently is.
        $data['intl_rate'] = isset($settings['intl_rate']) && !empty($settings['intl_rate']) ? FALSE : TRUE;
        if (!$data['intl_rate'] && $data['dest_country'] != get_option('base_country')) {
            return array();
        }
        // If ths zip code is provided via a form post use it!
        $data["dest_zipcode"] = (string) wpsc_get_customer_meta('shippingpostcode');
        if (!is_object($wpec_ash_tools)) {
            $wpec_ash_tools = new ASHTools();
        }
        if (empty($data["dest_zipcode"]) && $wpec_ash_tools->needs_post_code($data["dest_country"])) {
            // We cannot get a quote without a zip code so might as well return!
            return array();
        }
        //*** Grab Total Weight from the shipment object for simple shipping
        $data["weight"] = wpsc_cart_weight_total();
        if (empty($data["weight"])) {
            return array();
        }
        // If the region code is provided via a form post use it!
        if (isset($_POST['region']) && !empty($_POST['region'])) {
            $data['dest_state'] = wpsc_get_region(sanitize_text_field($_POST['region']));
        } else {
            if ($dest_state = wpsc_get_customer_meta('shipping_state')) {
                // Well, we have a zip code in the session and no new one provided
                $data['dest_state'] = $dest_state;
            } else {
                $data['dest_state'] = "";
            }
        }
        $data["dest_country"] = $wpec_ash_tools->get_full_country($data["dest_country"]);
        $data["dest_country"] = $this->_update_country($data["dest_country"]);
        if (!is_object($wpec_ash)) {
            $wpec_ash = new ASH();
        }
        $shipping_cache_check['state'] = $data['dest_state'];
        $shipping_cache_check['country'] = $data['dest_country'];
        $shipping_cache_check['zipcode'] = $data["dest_zipcode"];
        $this->shipment = $wpec_ash->get_shipment();
        $this->shipment->set_destination($this->internal_name, $shipping_cache_check);
        $this->shipment->rates_expire = date('Y-m-d');
        //Date will be checked against the cached date.
        $data['shipper'] = $this->internal_name;
        $data["adv_rate"] = !empty($settings["adv_rate"]) ? $settings["adv_rate"] : FALSE;
        // Use advanced shipping for Domestic Rates ? Not available
        if ($data["weight"] > 70 && !(bool) $data["adv_rate"]) {
            //USPS has a weight limit: https://www.usps.com/send/can-you-mail-it.htm?#3.
            $over_weight_txt = apply_filters('wpsc_shipment_over_weight', __('Your order exceeds the standard shipping weight limit.
													Please contact us to quote other shipping alternatives.', 'wp-e-commerce'), $data);
            $shipping_quotes[$over_weight_txt] = 0;
            // yes, a constant.
            $wpec_ash->cache_results($this->internal_name, array($shipping_quotes), $this->shipment);
            return array($shipping_quotes);
        }
        // Check to see if the cached shipment is still accurate, if not we need new rate
        $cache = $wpec_ash->check_cache($this->internal_name, $this->shipment);
        // We do not want to spam USPS (and slow down our process) if we already
        // have a shipping quote!
        if (count($cache["rate_table"]) >= 1) {
            //$cache['rate_table'] could be array(0).
            return $cache["rate_table"];
        }
        //*** WPEC Configuration values ***\\
        $this->use_test_env = !isset($settings["test_server"]) ? false : (bool) $settings['test_server'];
        $data["fcl_type"] = !empty($settings["fcl_type"]) ? $settings["fcl_type"] : "PARCEL";
        $data["mail_type"] = !empty($settings["intl_pkg"]) ? $settings["intl_pkg"] : "Package";
        $data["base_zipcode"] = get_option("base_zipcode");
        $data["services"] = !empty($settings["services"]) ? $settings["services"] : array("STANDARD POST", "PRIORITY", "PRIORITY EXPRESS", "FIRST CLASS");
        foreach ($data["services"] as $id => $service) {
            if ($service == 'PARCEL') {
                $data["services"][$id] = 'STANDARD POST';
            }
            if ($service == 'EXPRESS') {
                $data["services"][$id] = 'PRIORITY EXPRESS';
            }
        }
        $data["user_id"] = $settings["id"];
        $data["value"] = $wpsc_cart->calculate_subtotal(true);
        //Required by $this->_build_intl_shipment.
        $data = apply_filters('wpsc_shipment_data', $data, $this->shipment);
        if (isset($data['stop'])) {
            //Do not get rates.
            return array();
        }
        //************ GET THE RATE ************\\
//.........这里部分代码省略.........
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:101,代码来源:usps_20.php

示例6: wpsc_packing_slip

function wpsc_packing_slip($purchase_id)
{
    _wpsc_deprecated_function(__FUNCTION__, '3.8.13');
    echo "<!DOCTYPE html><html><meta http-equiv=\"content-type\" content=\"text-html; charset=utf-8\"><head><title>" . __('Packing Slip', 'wp-e-commerce') . "</title></head><body id='wpsc-packing-slip'>";
    global $wpdb;
    $purch_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`=%d", $purchase_id);
    $purch_data = $wpdb->get_row($purch_sql, ARRAY_A);
    $cartsql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=%d", $purchase_id);
    $cart_log = $wpdb->get_results($cartsql, ARRAY_A);
    $j = 0;
    if ($cart_log != null) {
        echo "<div class='packing_slip'>\n\r";
        echo apply_filters('wpsc_packing_slip_header', '<h2>' . esc_html__('Packing Slip', 'wp-e-commerce') . "</h2>\n\r");
        echo "<strong>" . esc_html__('Order', 'wp-e-commerce') . " #</strong> " . $purchase_id . "<br /><br />\n\r";
        echo "<table>\n\r";
        $form_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` WHERE `log_id` = %d", $purchase_id);
        $input_data = $wpdb->get_results($form_sql, ARRAY_A);
        foreach ($input_data as $input_row) {
            $rekeyed_input[$input_row['form_id']] = $input_row;
        }
        if ($input_data != null) {
            $form_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' ORDER BY `checkout_order`", ARRAY_A);
            foreach ($form_data as $form_field) {
                switch ($form_field['type']) {
                    case 'country':
                        $region_count_sql = $wpdb->prepare("SELECT COUNT(`regions`.`id`) FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('%s')", $purch_data['billing_country']);
                        $delivery_region_count = $wpdb->get_var($region_count_sql);
                        if (is_numeric($purch_data['billing_region']) && $delivery_region_count > 0) {
                            echo "\t<tr><td>" . esc_html__('State', 'wp-e-commerce') . ":</td><td>" . wpsc_get_region($purch_data['billing_region']) . "</td></tr>\n\r";
                        }
                        echo "\t<tr><td>" . esc_html($form_field['name']) . ":</td><td>" . esc_html($rekeyed_input[$form_field['id']]['value']) . "</td></tr>\n\r";
                        break;
                    case 'delivery_country':
                        if (is_numeric($purch_data['shipping_region']) && $delivery_region_count > 0) {
                            echo "\t<tr><td>" . esc_html__('State', 'wp-e-commerce') . ":</td><td>" . wpsc_get_region($purch_data['shipping_region']) . "</td></tr>\n\r";
                        }
                        echo "\t<tr><td>" . esc_html($form_field['name']) . ":</td><td>" . esc_html($rekeyed_input[$form_field['id']]['value']) . "</td></tr>\n\r";
                        break;
                    case 'heading':
                        if ($form_field['name'] == "Hidden Fields") {
                            continue;
                        } else {
                            echo "\t<tr class='heading'><td colspan='2'><strong>" . esc_html($form_field['name']) . ":</strong></td></tr>\n\r";
                        }
                        break;
                    default:
                        if ($form_field['name'] == "State" && !empty($purch_data['billing_region']) || $form_field['name'] == "State" && !empty($purch_data['billing_region'])) {
                            echo "";
                        } 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) {
//.........这里部分代码省略.........
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:101,代码来源:wpsc-deprecated.php

示例7: wpsc_display_purchlog_shipping_state_and_postcode

function wpsc_display_purchlog_shipping_state_and_postcode()
{
    global $purchlogitem;
    $state = '';
    if (is_numeric($purchlogitem->extrainfo->shipping_region)) {
        $state = esc_html(wpsc_get_region($purchlogitem->extrainfo->shipping_region));
    } else {
        $state = esc_html($purchlogitem->shippinginfo['shippingstate']['value']);
    }
    if (!empty($purchlogitem->shippinginfo['shippingpostcode']['value'])) {
        if (empty($state)) {
            $state = esc_html($purchlogitem->shippinginfo['shippingpostcode']['value']);
        } else {
            $state .= ', ' . esc_html($purchlogitem->shippinginfo['shippingpostcode']['value']);
        }
    }
    return $state;
}
开发者ID:nikitanaumov,项目名称:WP-e-Commerce,代码行数:18,代码来源:purchaselogs.class.php

示例8: transaction_results


//.........这里部分代码省略.........
                $message .= "\n\r" . TXT_WPSC_YOURTRANSACTIONID . ": " . $_GET['ti'];
                $message_html .= "\n\r" . TXT_WPSC_YOURTRANSACTIONID . ": " . $_GET['ti'];
                $report .= "\n\r" . TXT_WPSC_TRANSACTIONID . ": " . $_GET['ti'];
            } else {
                $report_id = "Purchase No.: " . $purchase_log['id'] . "\n\r";
            }
            //echo "<pre>".print_r($purchase_log,true)."</pre>";
            $message = str_replace('%product_list%', $product_list, $message);
            $message = str_replace('%total_shipping%', $total_shipping_email, $message);
            $message = str_replace('%total_price%', $total_price_email, $message);
            //$message = str_replace('%order_status%',get_option('blogname'),$message);
            $message = str_replace('%shop_name%', get_option('blogname'), $message);
            $report = str_replace('%product_list%', $report_product_list, $report);
            $report = str_replace('%total_shipping%', $total_shipping_email, $report);
            $report = str_replace('%total_price%', $total_price_email, $report);
            $report = str_replace('%shop_name%', get_option('blogname'), $report);
            $message_html = str_replace('%product_list%', $product_list_html, $message_html);
            $message_html = str_replace('%total_shipping%', $total_shipping_html, $message_html);
            $message_html = str_replace('%total_price%', $total_price_email, $message_html);
            $message_html = str_replace('%shop_name%', get_option('blogname'), $message_html);
            //$message_html = str_replace('%order_status%',get_option('blogname'),$message_html);
            if ($email != '' && $purchase_log['email_sent'] != 1) {
                add_filter('wp_mail_from', 'wpsc_replace_reply_address', 0);
                add_filter('wp_mail_from_name', 'wpsc_replace_reply_name', 0);
                if ($purchase_log['processed'] < 2) {
                    $payment_instructions = strip_tags(get_option('payment_instructions'));
                    $message = TXT_WPSC_ORDER_PENDING . "\n\r" . $payment_instructions . "\n\r" . $message;
                    wp_mail($email, TXT_WPSC_ORDER_PENDING_PAYMENT_REQUIRED, $message);
                } else {
                    wp_mail($email, TXT_WPSC_PURCHASERECEIPT, $message);
                }
            }
            remove_filter('wp_mail_from_name', 'wpsc_replace_reply_name');
            remove_filter('wp_mail_from', 'wpsc_replace_reply_address');
            $report_user = TXT_WPSC_CUSTOMERDETAILS . "\n\r";
            $form_sql = "SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` = '" . $purchase_log['id'] . "'";
            $form_data = $wpdb->get_results($form_sql, ARRAY_A);
            if ($form_data != null) {
                foreach ($form_data as $form_field) {
                    $form_data = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `id` = '" . $form_field['form_id'] . "' LIMIT 1", ARRAY_A);
                    switch ($form_data['type']) {
                        case "country":
                            $delivery_region_count = $wpdb->get_var("SELECT COUNT(`regions`.`id`) FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('" . $wpdb->escape($purchase_log['billing_country']) . "')");
                            if (is_numeric($purchase_log['shipping_region']) && $delivery_region_count > 0) {
                                $report_user .= TXT_WPSC_STATE . ": " . wpsc_get_region($purchase_log['billing_region']) . "\n";
                            }
                            $report_user .= $form_data['name'] . ": " . wpsc_get_country($form_field['value']) . "\n";
                            break;
                        case "delivery_country":
                            $delivery_region_count = $wpdb->get_var("SELECT COUNT(`regions`.`id`) FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('" . $wpdb->escape($purchase_log['shipping_country']) . "')");
                            if (is_numeric($purchase_log['shipping_region']) && $delivery_region_count > 0) {
                                $report_user .= TXT_WPSC_DELIVERY_STATE . ": " . wpsc_get_region($purchase_log['shipping_region']) . "\n";
                            }
                            $report_user .= $form_data['name'] . ": " . wpsc_get_country($form_field['value']) . "\n";
                            break;
                        default:
                            $report_user .= $form_data['name'] . ": " . $form_field['value'] . "\n";
                            break;
                    }
                }
            }
            $report_user .= "\n\r";
            $report = $report_user . $report_id . $report;
            if ($stock_adjusted == true) {
                $wpdb->query("UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `stock_adjusted` = '1' WHERE `sessionid` = " . $sessionid . " LIMIT 1");
            }
            if (get_option('purch_log_email') != null && $purchase_log['email_sent'] != 1) {
                wp_mail(get_option('purch_log_email'), TXT_WPSC_PURCHASEREPORT, $report);
            }
            if ($purchase_log['processed'] < 2) {
                echo "<br />" . nl2br(str_replace("\$", '\\$', $message_html));
                return;
            }
            /// Empty the cart
            $wpsc_cart->submit_stock_claims($purchase_log['id']);
            $wpsc_cart->empty_cart();
            if (true === $echo_to_screen) {
                echo '<div class="wrap">';
                if ($sessionid != null) {
                    echo TXT_WPSC_THETRANSACTIONWASSUCCESSFUL . "<br />";
                    echo "<br />" . nl2br(str_replace("\$", '\\$', $message_html));
                }
                echo '</div>';
            }
        } else {
            if (true === $echo_to_screen) {
                echo '<div class="wrap">';
                echo TXT_WPSC_BUYPRODUCTS;
                echo '</div>';
            }
        }
        if ($purchase_log['email_sent'] != 1 and $sessionid != '') {
            if (preg_match("/^[\\w\\s._,-]+\$/", $transaction_id)) {
                $transact_id_sql = "`transactid` = '" . $transaction_id . "',";
            }
            $update_sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET {$transact_id_sql} `email_sent` = '1', `processed` = '{$order_status}' WHERE `sessionid` = " . $sessionid . " LIMIT 1";
            $wpdb->query($update_sql);
        }
    }
}
开发者ID:aeroerin,项目名称:wp-e-commerce-ezp,代码行数:101,代码来源:transaction_result_functions.php

示例9: get_raw_message

 public function get_raw_message()
 {
     global $wpdb;
     $form_data = new WPSC_Checkout_Form_Data($this->purchase_log->get('id'));
     $raw_data = $form_data->get_raw_data();
     $args = $this->get_common_args();
     $data = array('billing' => array('title' => __('Billing Details', 'wp-e-commerce'), 'fields' => array()), 'shipping' => array('title' => __('Shipping Details', 'wp-e-commerce'), 'fields' => array()), 'misc' => array('title' => __('Other Details', 'wp-e-commerce'), 'fields' => array()));
     foreach ($raw_data as $field) {
         if (strpos($field->unique_name, 'billing') !== false) {
             $type = 'billing';
         } elseif (strpos($field->unique_name, 'shipping') !== false) {
             $type = 'shipping';
         } else {
             $type = 'misc';
         }
         $data[$type]['fields'][] = $field;
     }
     // Transaction details
     $message = '<strong>' . __('Transaction Details', 'wp-e-commerce') . "</strong>\r\n";
     $message .= __('Sale Log ID', 'wp-e-commerce') . ': %purchase_id%' . "\r\n";
     if (!empty($args['transaction_id'])) {
         $message .= __('Transaction ID', 'wp-e-commerce') . ': %transaction_id%' . "\r\n";
     }
     // Discount
     if (!empty($args['coupon_code'])) {
         $message .= __('Coupon Code', 'wp-e-commerce') . ': %coupon_code%' . "\r\n";
         $message .= __('Discount Value', 'wp-e-commerce') . ': %discount%' . "\r\n";
     }
     // Subtotal, tax, shipping, total
     $message .= __('Subtotal', 'wp-e-commerce') . ': %subtotal%' . "\r\n";
     $message .= __('Tax', 'wp-e-commerce') . ': %tax%' . "\r\n";
     $message .= __('Shipping', 'wp-e-commerce') . ': %shipping%' . "\r\n";
     $message .= __('Total', 'wp-e-commerce') . ': %total%' . "\r\n";
     $message .= __('Payment Method', 'wp-e-commerce') . ': %payment_method%' . "\r\n";
     if (!get_option('do_not_use_shipping')) {
         $message .= __('Shipping Method', 'wp-e-commerce') . ': %shipping_method%' . "\r\n";
         $message .= __('Shipping Option', 'wp-e-commerce') . ': %shipping_option%' . "\r\n";
     }
     $message .= "\r\n";
     // Items
     $message .= '<strong>' . __('Items', 'wp-e-commerce') . "</strong>\r\n";
     $message .= "%product_list%\r\n";
     // Checkout fields
     $message .= "\r\n";
     foreach ($data as $section) {
         if (empty($section['fields'])) {
             continue;
         }
         $message .= "<strong>{$section['title']}</strong>\r\n";
         foreach ($section['fields'] as $field) {
             if (strpos($field->unique_name, 'state') && is_numeric($field->value)) {
                 $field->value = wpsc_get_region($field->value);
             }
             $message .= $field->name . ' : ' . $field->value . "\r\n";
         }
         $message .= "\r\n";
     }
     // preserve pre-3.8.9 hooks
     $message = apply_filters('wpsc_transaction_result_report', $message);
     return apply_filters('wpsc_purchase_log_admin_notification_raw_message', $message, $this);
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:61,代码来源:purchase-log-notification.class.php

示例10: transaction_results


//.........这里部分代码省略.........
	', 'wpsc'), wpsc_currency_display($total_shipping));
            }
            $total_price_html .= sprintf(__('Total: %s
', 'wpsc'), wpsc_currency_display($total));
            $report_id = sprintf(__("Purchase # %s\n", 'wpsc'), $purchase_log['id']);
            if (isset($_GET['ti'])) {
                $message .= "\n\r" . __('Your Transaction ID', 'wpsc') . ": " . $_GET['ti'];
                $message_html .= "\n\r" . __('Your Transaction ID', 'wpsc') . ": " . $_GET['ti'];
                $report .= "\n\r" . __('Transaction ID', 'wpsc') . ": " . $_GET['ti'];
            }
            $message = apply_filters('wpsc_transaction_result_message', $message);
            $message = str_replace('%purchase_id%', $report_id, $message);
            $message = str_replace('%product_list%', $product_list, $message);
            $message = str_replace('%total_tax%', $total_tax, $message);
            $message = str_replace('%total_shipping%', $total_shipping_email, $message);
            $message = str_replace('%total_price%', $total_price_email, $message);
            $message = str_replace('%shop_name%', get_option('blogname'), $message);
            $message = str_replace('%find_us%', $purchase_log['find_us'], $message);
            $report = apply_filters('wpsc_transaction_result_report', $report);
            $report = str_replace('%purchase_id%', $report_id, $report);
            $report = str_replace('%product_list%', $report_product_list, $report);
            $report = str_replace('%total_tax%', $total_tax, $report);
            $report = str_replace('%total_shipping%', $total_shipping_email, $report);
            $report = str_replace('%total_price%', $total_price_email, $report);
            $report = str_replace('%shop_name%', get_option('blogname'), $report);
            $report = str_replace('%find_us%', $purchase_log['find_us'], $report);
            $message_html = apply_filters('wpsc_transaction_result_message_html', $message_html);
            $message_html = str_replace('%purchase_id%', $report_id, $message_html);
            $message_html = str_replace('%product_list%', $product_list_html, $message_html);
            $message_html = str_replace('%total_tax%', $total_tax_html, $message_html);
            $message_html = str_replace('%total_shipping%', $total_shipping_html, $message_html);
            $message_html = str_replace('%total_price%', $total_price_html, $message_html);
            $message_html = str_replace('%shop_name%', get_option('blogname'), $message_html);
            $message_html = str_replace('%find_us%', $purchase_log['find_us'], $message_html);
            if (!empty($email)) {
                add_filter('wp_mail_from', 'wpsc_replace_reply_address', 0);
                add_filter('wp_mail_from_name', 'wpsc_replace_reply_name', 0);
                $message = apply_filters('wpsc_email_message', $message, $report_id, $product_list, $total_tax, $total_shipping_email, $total_price_email);
                if (!$is_transaction) {
                    $payment_instructions = strip_tags(stripslashes(get_option('payment_instructions')));
                    if (!empty($payment_instructions)) {
                        $payment_instructions .= "\n\r";
                    }
                    $message = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions . $message;
                    $message_html = __('Thank you, your purchase is pending, you will be sent an email once the order clears.', 'wpsc') . "\n\r" . $payment_instructions . $message_html;
                    // prevent email duplicates
                    if (!get_transient("{$sessionid}_pending_email_sent") || $resend_email) {
                        wp_mail($email, __('Order Pending: Payment Required', 'wpsc'), $message);
                        set_transient("{$sessionid}_pending_email_sent", true, 60 * 60 * 12);
                    }
                } elseif (!get_transient("{$sessionid}_receipt_email_sent") || $resend_email) {
                    wp_mail($email, __('Purchase Receipt', 'wpsc'), $message);
                    set_transient("{$sessionid}_receipt_email_sent", true, 60 * 60 * 12);
                }
            }
            remove_filter('wp_mail_from_name', 'wpsc_replace_reply_name');
            remove_filter('wp_mail_from', 'wpsc_replace_reply_address');
            $report_user = __('Customer Details', 'wpsc') . "\n\r";
            $form_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` = %d", $purchase_log['id']);
            $form_data = $wpdb->get_results($form_sql, ARRAY_A);
            if ($form_data != null) {
                foreach ($form_data as $form_field) {
                    $form_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `id` = %d LIMIT 1", $form_field['form_id']), ARRAY_A);
                    switch ($form_data['type']) {
                        case "country":
                            $country_code = $form_field['value'];
                            $report_user .= $form_data['name'] . ": " . wpsc_get_country($country_code) . "\n";
                            //check if country has a state then display if it does.
                            $country_data = wpsc_country_has_state($country_code);
                            if ($country_data['has_regions'] == 1) {
                                $report_user .= __('Billing State', 'wpsc') . ": " . wpsc_get_region($purchase_log['billing_region']) . "\n";
                            }
                            break;
                        case "delivery_country":
                            $report_user .= $form_data['name'] . ": " . wpsc_get_country($form_field['value']) . "\n";
                            break;
                        default:
                            if ($form_data['name'] == 'State' && is_numeric($form_field['value'])) {
                                $report_user .= __('Delivery State', 'wpsc') . ": " . wpsc_get_state_by_id($form_field['value'], 'name') . "\n";
                            } else {
                                $report_user .= wp_kses($form_data['name'], array()) . ": " . $form_field['value'] . "\n";
                            }
                            break;
                    }
                }
            }
            $report_user .= "\n\r";
            $report = $report_id . $report_user . $report;
            //echo '======REPORT======<br />'.$report.'<br />';
            //echo '======EMAIL======<br />'.$message.'<br />';
            if (get_option('purch_log_email') != null && $purchase_log['email_sent'] != 1) {
                wp_mail(get_option('purch_log_email'), __('Purchase Report', 'wpsc'), $report);
                $wpdb->update(WPSC_TABLE_PURCHASE_LOGS, array('email_sent' => '1'), array('sessionid' => $sessionid));
            }
            /// Adjust stock and empty the cart
            $wpsc_cart->submit_stock_claims($purchase_log['id']);
            $wpsc_cart->empty_cart();
        }
    }
}
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:101,代码来源:wpsc-transaction_results_functions.php

示例11: get_state

 /**
  * Given a WPEC state code (int), will return the state/region name
  *
  * @since 0.0.1
  * @param int $state_code
  * @return string|int will be int if wordpress database & wpec are not available
  */
 function get_state($state_code)
 {
     $state_code = isset($_POST['region']) ? $_POST['region'] : $state_code;
     return wpsc_get_region($state_code);
 }
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:12,代码来源:shipping.helper.php

示例12: wpsc_user_details


//.........这里部分代码省略.........
                echo " <td>";
                echo wpsc_currency_display($shipping, array('display_as_html' => false));
                echo " </td>";
                echo " <td>";
                $endtotal += $price;
                echo wpsc_currency_display($shipping + $price, array('display_as_html' => false));
                echo " </td>";
                echo '</tr>';
            }
            echo "<tr >";
            echo " <td>";
            echo " </td>";
            echo " <td>";
            echo " </td>";
            echo " <td>";
            echo " <td>";
            echo " </td>";
            echo " </td>";
            echo " <td>";
            echo "<strong>" . __('Total Shipping', 'wpsc') . ":</strong><br />";
            echo "<strong>" . __('Total Tax', 'wpsc') . ":</strong><br />";
            echo "<strong>" . __('Final Total', 'wpsc') . ":</strong>";
            echo " </td>";
            echo " <td>";
            $total_shipping += $purchase['base_shipping'];
            $endtotal += $total_shipping;
            $endtotal += $purchase['wpec_taxes_total'];
            echo wpsc_currency_display($total_shipping, array('display_as_html' => false)) . "<br />";
            if ($gsttotal) {
                //if false then must be exclusive.. doesnt seem too reliable needs more testing
                echo wpsc_currency_display($gsttotal, array('display_as_html' => false)) . "<br />";
            } else {
                echo wpsc_currency_display($purchase['wpec_taxes_total'], array('display_as_html' => false)) . "<br />";
            }
            echo wpsc_currency_display($endtotal, array('display_as_html' => false));
            echo " </td>";
            echo '</tr>';
            echo "</table>";
            echo "<br />";
            echo "<strong>" . __('Customer Details', 'wpsc') . ":</strong>";
            echo "<table class='customer_details'>";
            $usersql = "SELECT `" . WPSC_TABLE_SUBMITED_FORM_DATA . "`.value, `" . WPSC_TABLE_CHECKOUT_FORMS . "`.* FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` LEFT JOIN `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` ON `" . WPSC_TABLE_CHECKOUT_FORMS . "`.id = `" . WPSC_TABLE_SUBMITED_FORM_DATA . "`.`form_id` WHERE `" . WPSC_TABLE_SUBMITED_FORM_DATA . "`.log_id=" . $purchase['id'] . " OR `" . WPSC_TABLE_CHECKOUT_FORMS . "`.type = 'heading' ORDER BY `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`checkout_order`";
            $formfields = $wpdb->get_results($usersql, ARRAY_A);
            if (!empty($formfields)) {
                foreach ((array) $formfields as $form_field) {
                    // If its a heading display the Name otherwise continue on
                    if ('heading' == $form_field['type']) {
                        echo "  <tr><td colspan='2'>" . $form_field['name'] . ":</td></tr>";
                        continue;
                    }
                    switch ($form_field['unique_name']) {
                        case 'shippingstate':
                            if (is_numeric($purchase['shipping_region'])) {
                                $state = wpsc_get_region($purchase['shipping_region']);
                            } else {
                                $state = $form_field['value'];
                            }
                            echo "  <tr><td>" . $form_field['name'] . ":</td><td>" . $state . "</td></tr>";
                            break;
                        case 'billingstate':
                            if (is_numeric($purchase['billing_region'])) {
                                $state = wpsc_get_region($purchase['billing_region']);
                            } else {
                                $state = $form_field['value'];
                            }
                            echo "  <tr><td>" . $form_field['name'] . ":</td><td>" . $state . "</td></tr>";
                            break;
                        default:
                            echo "  <tr><td>" . $form_field['name'] . ":</td><td>" . esc_html($form_field['value']) . "</td></tr>";
                    }
                }
            }
            $payment_gateway_names = '';
            $payment_gateway_names = get_option('payment_gateway_names');
            foreach ((array) $payment_gateway_names as $gatewayname) {
                //if the gateway has a custom name
                if (!empty($gatewayname)) {
                    $display_name = $payment_gateway_names[$purchase_log[0]['gateway']];
                } else {
                    //if not fall back on default name
                    foreach ((array) $nzshpcrt_gateways as $gateway) {
                        if ($gateway['internalname'] == $purchase['gateway']) {
                            $display_name = $gateway['name'];
                        }
                    }
                }
            }
            echo "  <tr><td>" . __('Payment Method', 'wpsc') . ":</td><td>" . $display_name . "</td></tr>";
            echo "  <tr><td>" . __('Purchase #', 'wpsc') . ":</td><td>" . $purchase['id'] . "</td></tr>";
            if ($purchase['transactid'] != '') {
                echo "  <tr><td>" . __('Transaction Id', 'wpsc') . ":</td><td>" . $purchase['transactid'] . "</td></tr>";
            }
            echo "</table>";
        }
        echo "  </div>\n\r";
        echo "  </div>\n\r";
        echo " </td>\n\r";
        echo "</tr>\n\r";
    }
}
开发者ID:hornet9,项目名称:Morato,代码行数:101,代码来源:wpsc-user_log_functions.php

示例13: print_packing_slip_data

function print_packing_slip_data($input_data, $form_data, $purch_data, $rekeyed_input, $purchase_id_value)
{
    global $wpdb;
    if ($input_data != null) {
        foreach ($form_data as $form_field) {
            switch ($form_field['type']) {
                case 'country':
                    $delivery_region_count = $wpdb->get_var("SELECT COUNT(`regions`.`id`) FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('" . $wpdb->_real_escape($purch_data[$purchase_id_value]['billing_country']) . "')");
                    if (is_numeric($purch_data[$purchase_id_value]['billing_region']) && $delivery_region_count > 0) {
                        echo "\t<tr><td>" . __('State', 'wpsc') . ":</td><td> " . wpsc_get_region($purch_data[$purchase_id_value]['billing_region']) . "</td></tr>\n\r";
                    }
                    echo "\t<tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . htmlentities(stripslashes($rekeyed_input[$purchase_id_value][$form_field['id']]['value']), ENT_QUOTES, 'UTF-8') . "</td></tr>\n\r";
                    break;
                case 'delivery_country':
                    if (is_numeric($purch_data[$purchase_id_value]['shipping_region']) && $delivery_region_count > 0) {
                        echo "\t<tr><td>" . __('State', 'wpsc') . ":</td><td> " . wpsc_get_region($purch_data[$purchase_id_value]['shipping_region']) . "</td></tr>\n\r";
                    }
                    echo "\t<tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . htmlentities(stripslashes($rekeyed_input[$purchase_id_value][$form_field['id']]['value']), ENT_QUOTES, 'UTF-8') . "</td></tr>\n\r";
                    break;
                case 'heading':
                    if ($form_field['name'] == "Hidden Fields") {
                        continue;
                    } else {
                        echo "<tr class='heading'><td colspan='2'><strong><u>" . wp_kses($form_field['name'], array()) . "</u>:</strong></td></tr>\n\r";
                    }
                    break;
                default:
                    if ($form_field['name'] == "Cupcakes") {
                        parse_str($rekeyed_input[$purchase_id_value][$form_field['id']]['value'], $cupcakes);
                        foreach ($cupcakes as $product_id => $quantity) {
                            $product = get_post($product_id);
                            $string .= "(" . $quantity . ") " . $product->post_title . ", ";
                        }
                        $string = rtrim($string, ", ");
                        echo "\t<tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . htmlentities(stripslashes($string), ENT_QUOTES, 'UTF-8') . "</td></tr>\n\r";
                    } else {
                        if ($form_field['name'] == "State" && !empty($purch_data[$purchase_id_value]['billing_region']) || $form_field['name'] == "State" && !empty($purch_data[$purchase_id_value]['billing_region'])) {
                            echo "";
                        } else {
                            echo "\t<tr><td>" . wp_kses($form_field['name'], array()) . ":</td><td>" . (isset($rekeyed_input[$purchase_id_value][$form_field['id']]) ? htmlentities(stripslashes($rekeyed_input[$purchase_id_value][$form_field['id']]['value']), ENT_QUOTES, 'UTF-8') : '') . "</td></tr>\n\r";
                        }
                    }
                    break;
            }
        }
    } else {
        echo "\t<tr><td>" . __('Name', 'wpsc') . ":</td><td> " . $purch_data[$purchase_id_value]['firstname'] . " " . $purch_data[$purchase_id_value]['lastname'] . "</td></tr>\n\r";
        echo "\t<tr><td>" . __('Address', 'wpsc') . ":</td><td> " . $purch_data[$purchase_id_value]['address'] . "</td></tr>\n\r";
        echo "\t<tr><td>" . __('Phone', 'wpsc') . ":</td><td> " . $purch_data[$purchase_id_value]['phone'] . "</td></tr>\n\r";
        echo "\t<tr><td>" . __('Email', 'wpsc') . ":</td><td> " . $purch_data[$purchase_id_value]['email'] . "</td></tr>\n\r";
    }
    if (2 == get_option('payment_method')) {
        $gateway_name = '';
        $nzshpcrt_gateways = nzshpcrt_get_gateways();
        foreach ($nzshpcrt_gateways as $gateway) {
            if ($purch_data[$purchase_id_value]['gateway'] != 'testmode') {
                if ($gateway['internalname'] == $purch_data[$purchase_id_value]['gateway']) {
                    $gateway_name = $gateway['name'];
                }
            } else {
                $gateway_name = __('Manual Payment', 'wpsc');
            }
        }
    }
}
开发者ID:bulats,项目名称:chef,代码行数:65,代码来源:sm38.php


注:本文中的wpsc_get_region函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。