?> </table> <!-- cart contents table close --> <?php if (wpsc_uses_shipping()) { ?> <p class="wpsc_cost_before"></p> <?php } ?> <?php //this HTML dispalys the calculate your order HTML ?> <?php if (wpsc_has_category_and_country_conflict()) { ?> <p class='validation-error'><?php echo esc_html(wpsc_get_customer_meta('category_shipping_conflict')); ?> </p> <?php } ?> <?php if (isset($_SESSION['WpscGatewayErrorMessage']) && $_SESSION['WpscGatewayErrorMessage'] != '') { ?> <p class="validation-error"><?php echo $_SESSION['WpscGatewayErrorMessage']; ?>
/** * Cycles through the categories represented by the products in the cart. * Retrieves their target markets and returns an array of acceptable markets * We're only listing target markets that are acceptable for ALL categories in the cart * * @since 3.8.9 * @return array Countries that can be shipped to. If empty, sets session variable with appropriate error message */ function wpsc_get_acceptable_countries() { global $wpdb; $cart_category_ids = array_unique(wpsc_cart_item_categories(true)); $target_market_ids = array(); foreach ($cart_category_ids as $category_id) { $target_markets = wpsc_get_meta($category_id, 'target_market', 'wpsc_category'); if (!empty($target_markets)) { $target_market_ids[$category_id] = $target_markets; } } $have_target_market = !empty($target_market_ids); //If we're comparing multiple categories if (count($target_market_ids) > 1) { $target_market_ids = call_user_func_array('array_intersect', $target_market_ids); } elseif ($have_target_market) { $target_market_ids = array_values($target_market_ids); $target_market_ids = $target_market_ids[0]; } $country_data = WPSC_Countries::get_countries_array(); $have_target_market = $have_target_market && count($country_data) != count($target_market_ids); $GLOBALS['wpsc_country_data'] = $country_data; // TODO Is this ever used? $conflict_error = wpsc_get_customer_meta('category_shipping_conflict'); $target_conflict = wpsc_get_customer_meta('category_shipping_target_market_conflict'); // Return true if there are no restrictions if (!$have_target_market) { // clear out the target market messages if (!empty($target_conflict)) { wpsc_delete_customer_meta('category_shipping_conflict'); } wpsc_update_customer_meta('category_shipping_target_market_conflict', false); wpsc_update_customer_meta('category_shipping_conflict', false); return true; } // temporarily hijack this session variable to display target market restriction warnings if (!empty($target_conflict) || !wpsc_has_category_and_country_conflict()) { wpsc_update_customer_meta('category_shipping_target_market_conflict', true); wpsc_update_customer_meta('category_shipping_conflict', __("Some of your cart items are targeted specifically to certain markets. As a result, you can only select those countries as your shipping destination.", 'wp-e-commerce')); } if (empty($target_market_ids)) { wpsc_update_customer_meta('category_shipping_target_market_conflict', true); wpsc_update_customer_meta('category_shipping_conflict', __('It appears that some products in your cart have conflicting target market restrictions. As a result, there is no common destination country where your cart items can be shipped to. Please contact the site administrator for more information.', 'wp-e-commerce')); } return $target_market_ids; }