?> </h2> <table class="productcart"> <tr> <td colspan='5'> <?php echo TXT_WPSC_SHIPPING_DETAIL; ?> </td> </tr> <tr> <td colspan='5'> <form name='change_country' id='change_country' action='' method='post'> <?php echo wpsc_shipping_country_list(); ?> <input type='hidden' name='wpsc_update_location' value='true' /> <input type='submit' name='wpsc_submit_zipcode' value='Calculate' /> </form> </td> </tr> <?php while (wpsc_have_shipping_methods()) { wpsc_the_shipping_method(); ?> <?php // Don't display shipping method if it doesn't have at least one quote if (!wpsc_have_shipping_quotes()) {
/** * form_field method, returns the form html * @access public */ function form_field() { global $wpdb, $user_ID; // exit('<pre>'.print_r($_SESSION['wpsc_checkout_saved_values'], true).'</pre>'); if (count($_SESSION['wpsc_checkout_saved_values']) <= 0 && $user_ID > 0) { //$_SESSION['wpsc_checkout_saved_values'] = get_usermeta($user_ID, 'wpshpcrt_usr_profile'); } if (is_array($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id])) { if (function_exists('wpsc_get_ticket_checkout_set')) { if ($this->checkout_item->checkout_set == wpsc_get_ticket_checkout_set()) { if (!isset($_SESSION['wpsc_tickets_saved_values_count'])) { $_SESSION['wpsc_tickets_saved_values_count'] = 0; $count = $_SESSION['wpsc_tickets_saved_values_count']; } else { $count = $_SESSION['wpsc_tickets_saved_values_count'] - 1; } $saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id][$count]), ENT_QUOTES, 'UTF-8'); } } } else { $saved_form_data = htmlentities(stripslashes($_SESSION['wpsc_checkout_saved_values'][$this->checkout_item->id]), ENT_QUOTES, 'UTF-8'); } //make sure tickets are arrays for multiple ticket holders $an_array = ''; if (function_exists('wpsc_get_ticket_checkout_set')) { if ($this->checkout_item->checkout_set == wpsc_get_ticket_checkout_set()) { $an_array = '[]'; } } switch ($this->checkout_item->type) { case "address": case "delivery_address": case "textarea": $output = "<textarea title='" . $this->checkout_item->unique_name . "' class='text' id='" . $this->form_element_id() . "' name='collected_data[{$this->checkout_item->id}]" . $an_array . "' rows='3' cols='40' >" . $saved_form_data . "</textarea>"; break; case "checkbox": $options = $this->get_checkout_options($this->checkout_item->id); if ($options != '') { $i = mt_rand(); $j = 0; foreach ($options as $label => $value) { $output .= "<input type='hidden' title='" . $this->checkout_item->unique_name . "' id='" . $this->form_element_id() . $j . "' value='-1' name='collected_data[{$this->checkout_item->id}][" . $i . "][" . $j . "]'/><input type='checkbox' title='" . $this->checkout_item->unique_name . "' id='" . $this->form_element_id() . "' value='" . $value . "' name='collected_data[{$this->checkout_item->id}][" . $i . "][" . $j . "]'/> "; $output .= "<label for='" . $this->form_element_id() . $j . "'>" . $label . "</label><br />"; $j++; } } break; case "country": $output = wpsc_country_region_list($this->checkout_item->id, false, $_SESSION['wpsc_selected_country'], $_SESSION['wpsc_selected_region'], $this->form_element_id()); break; case "delivery_country": if (wpsc_uses_shipping() && get_option('use_billing_unless_is_shipping') != 1) { $country_name = $wpdb->get_var("SELECT `country` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `isocode`='" . $_SESSION['wpsc_delivery_country'] . "' LIMIT 1"); $output = "<input title='" . $this->checkout_item->unique_name . "' type='hidden' id='" . $this->form_element_id() . "' class='shipping_country' name='collected_data[{$this->checkout_item->id}]' value='" . $_SESSION['wpsc_delivery_country'] . "' /><span class='shipping_country_name'>" . $country_name . "</span> "; } else { if (get_option('use_billing_unless_is_shipping') == 1) { $output = wpsc_shipping_country_list(); } else { $checkoutfields = true; //$output = wpsc_shipping_country_list($checkoutfields); $output = wpsc_country_region_list($this->checkout_item->id, false, $_SESSION['wpsc_selected_country'], $_SESSION['wpsc_selected_region'], $this->form_element_id(), $checkoutfields); } } break; case "select": $options = $this->get_checkout_options($this->checkout_item->id); if ($options != '') { $output = "<select name='collected_data[{$this->checkout_item->id}]" . $an_array . "'>"; $output .= "<option value='-1'>Select an Option</option>"; foreach ((array) $options as $label => $value) { $value = str_replace(' ', '', $value); if ($saved_form_data == $value) { $selected = 'selected="selected"'; } else { $selected = ''; } $output .= "<option " . $selected . " value='" . $value . "'>" . $label . "</option>\n\r"; } $output .= "</select>"; } break; case "radio": $options = $this->get_checkout_options($this->checkout_item->id); if ($options != '') { $i = mt_rand(); foreach ((array) $options as $label => $value) { $output .= "<input type='radio' title='" . $this->checkout_item->unique_name . "' id='" . $this->form_element_id() . "'value='" . $value . "' name='collected_data[{$this->checkout_item->id}][" . $i . "]'/> "; $output .= "<label for='" . $this->form_element_id() . "'>" . $label . "</label>"; } } break; case "text": case "city": case "delivery_city": case "email": case "coupon": default: $country_data = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `isocode` IN('" . $_SESSION['wpsc_delivery_country'] . "') LIMIT 1", ARRAY_A); if ($this->checkout_item->unique_name == 'shippingstate') { if (wpsc_uses_shipping() && $country_data['has_regions'] == 1) { $region_name = $wpdb->get_var("SELECT `name` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id`='" . $_SESSION['wpsc_delivery_region'] . "' LIMIT 1"); $output = "<input title='" . $this->checkout_item->unique_name . "' type='hidden' id='" . $this->form_element_id() . "' class='shipping_region' name='collected_data[{$this->checkout_item->id}]' value='" . $_SESSION['wpsc_delivery_region'] . "' size='4' /><span class='shipping_region_name'>" . $region_name . "</span> "; } else { $output = "<input class='shipping_region' title='" . $this->checkout_item->unique_name . "' type='text' id='" . $this->form_element_id() . "' class='text' value='" . $saved_form_data . "' name='collected_data[{$this->checkout_item->id}]" . $an_array . "' />"; } } else { $output = "<input title='" . $this->checkout_item->unique_name . "' type='text' id='" . $this->form_element_id() . "' class='text' value='" . $saved_form_data . "' name='collected_data[{$this->checkout_item->id}]" . $an_array . "' />"; } break; } return $output; }
function wpsc_update_shipping_quotes_on_shipping_same_as_billing() { global $wpsc_cart; wpsc_update_location(); if (get_option('do_not_use_shipping')) { die('-1'); } if (!wpsc_have_shipping_quotes()) { die('0'); } else { ?> <tr class="wpsc_shipping_info"> <td colspan="5"> <?php _e('Please choose a country below to calculate your shipping costs', 'wpsc'); ?> </td> </tr> <?php if (!wpsc_have_shipping_quote()) { // No valid shipping quotes ?> <?php if (wpsc_have_valid_shipping_zipcode()) { ?> <tr class='wpsc_update_location'> <td colspan='5' class='shipping_error' > <?php _e('Please provide a Zipcode and click Calculate in order to continue.', 'wpsc'); ?> </td> </tr> <?php } else { ?> <tr class='wpsc_update_location_error'> <td colspan='5' class='shipping_error' > <?php _e('Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details.', 'wpsc'); ?> </td> </tr> <?php } ?> <?php } ?> <tr class='wpsc_change_country'> <td colspan='5'> <form name='change_country' id='change_country' action='' method='post'> <?php echo wpsc_shipping_country_list(); ?> <input type='hidden' name='wpsc_update_location' value='true' /> <input type='submit' name='wpsc_submit_zipcode' value='Calculate' /> </form> </td> </tr> <?php if (wpsc_have_morethanone_shipping_quote()) { ?> <?php while (wpsc_have_shipping_methods()) { wpsc_the_shipping_method(); ?> <?php if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote ?> <tr class='wpsc_shipping_header'><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name() . __(' - Choose a Shipping Rate', 'wpsc'); ?> </td></tr> <?php while (wpsc_have_shipping_quotes()) { wpsc_the_shipping_quote(); ?> <tr class='<?php echo wpsc_shipping_quote_html_id(); ?> '> <td class='wpsc_shipping_quote_name wpsc_shipping_quote_name_<?php echo wpsc_shipping_quote_html_id(); ?> ' colspan='3'> <label for='<?php echo wpsc_shipping_quote_html_id(); ?> '><?php echo wpsc_shipping_quote_name(); ?> </label> </td> <td class='wpsc_shipping_quote_price wpsc_shipping_quote_price_<?php echo wpsc_shipping_quote_html_id(); ?> ' style='text-align:center;'> <label for='<?php echo wpsc_shipping_quote_html_id(); ?> '><?php echo wpsc_shipping_quote_value(); ?> </label> </td> <td class='wpsc_shipping_quote_radio wpsc_shipping_quote_radio_<?php echo wpsc_shipping_quote_html_id(); ?> ' style='text-align:center;'> <?php if (wpsc_have_morethanone_shipping_methods_and_quotes()) { ?> <input type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?> ' <?php echo wpsc_shipping_quote_selected_state(); ?> onclick='switchmethod("<?php echo wpsc_shipping_quote_name(); ?> ", "<?php echo wpsc_shipping_method_internal_name(); ?> ")' value='<?php echo wpsc_shipping_quote_value(true); ?> ' name='shipping_method' /> <?php } else { ?> <input <?php echo wpsc_shipping_quote_selected_state(); ?> disabled='disabled' type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?> ' value='<?php echo wpsc_shipping_quote_value(true); ?> ' name='shipping_method' /> <?php wpsc_update_shipping_single_method(); ?> <?php } ?> </td> </tr> <?php } ?> <?php } ?> <?php } ?> <?php wpsc_update_shipping_multiple_methods(); ?> <?php } exit; }
<?php echo " </td>\n\r"; echo " <td colspan='2' style='vertical-align: middle;'>"; echo "</td>\n\r"; echo "</tr>\n\r"; } echo "<tr class='total_price'>\n\r"; echo " <td colspan='2' >\n\r"; if (get_option('payment_gateway') == 'google') { echo TXT_WPSC_POSTAGE . ":"; } else { ?> <div class='select_country'> <form name='change_country' action='' method='POST'> <?php echo wpsc_shipping_country_list($_SESSION['delivery_country'], $_SESSION['selected_region']); ?> </form> <!--usps changes--> <div id='usps_shipping_methods'> <?php $dest = $_SESSION['delivery_country']; if ($dest == get_option('base_country')) { // $request = '<RateV3Request USERID="' . "221ALLEN1967" . '" PASSWORD="******"651AC00ZD570" . '">'; // $allowed_types = explode(", ", MODULE_SHIPPING_USPS_TYPES); // // while (list($key, $value) = each($this->types)) { // if ( !in_array($key, $allowed_types) ) continue; // // if ($key == 'FIRST CLASS'){ // $this->FirstClassMailType = '<FirstClassMailType>LETTER</FirstClassMailType>';