function test_get_currency_symbol_html() { $country = new WPSC_Country(self::COUNTRY_ID_WITHOUT_REGIONS); $currency_symbol = $country->get_currency_symbol_html(); $this->assertEquals(self::COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_SYMBOL_HTML, $currency_symbol); }
/** * Product Shipping Forms * * @uses wpsc_validate_weight_unit() * @uses wpsc_validate_dimension_unit() */ function wpsc_product_shipping_forms($product = false, $field_name_prefix = 'meta[_wpsc_product_metadata]', $bulk = false) { if (!$product) { $product_id = get_the_ID(); } else { $product_id = $product->ID; } $meta = get_post_meta($product_id, '_wpsc_product_metadata', true); if (!is_array($meta)) { $meta = array(); } $defaults = array('weight' => '', 'weight_unit' => wpsc_validate_weight_unit(), 'demension_unit' => wpsc_validate_dimension_unit(), 'dimensions' => array(), 'shipping' => array(), 'no_shipping' => '', 'display_weight_as' => ''); $dimensions_defaults = array('height' => 0, 'width' => 0, 'length' => 0); $shipping_defaults = array('local' => '', 'international' => ''); $meta = array_merge($defaults, $meta); $meta['dimensions'] = array_merge($dimensions_defaults, $meta['dimensions']); $meta['shipping'] = array_merge($shipping_defaults, $meta['shipping']); extract($meta, EXTR_SKIP); foreach ($shipping as $key => &$val) { $val = wpsc_format_number($val); } $weight = wpsc_convert_weight($weight, 'pound', $weight_unit); $dimension_units = wpsc_dimension_units(); $weight_units = wpsc_weight_units(); // Why we need this???? $measurements = $dimensions; $measurements['weight'] = $weight; $measurements['weight_unit'] = $weight_unit; // End why ?> <div class="wpsc-stock-editor<?php if ($bulk) { echo ' wpsc-bulk-edit'; } ?> "> <p class="wpsc-form-field"> <input type="checkbox" id="wpsc-product-no-shipping" name="<?php echo esc_attr($field_name_prefix); ?> [no_shipping]" value="1" <?php checked($no_shipping && !$bulk); ?> > <label for="wpsc-product-no-shipping"><?php _e('Product will <em>not</em> be shipped to customer', 'wp-e-commerce'); ?> </label> </p> <div class="wpsc-product-shipping-section wpsc-product-shipping-weight-dimensions"> <p><strong><?php esc_html_e('Calculate Shipping Costs based on measurements', 'wp-e-commerce'); ?> </strong></p> <!-- WEIGHT INPUT --> <p class="wpsc-form-field"> <?php if ($bulk) { ?> <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][weight]" value="1" /> <?php } ?> <label for="wpsc-product-shipping-weight"><?php echo esc_html_e('Weight', 'wp-e-commerce'); ?> </label> <span class="wpsc-product-shipping-input"> <input type="text" id="wpsc-product-shipping-weight" name="<?php echo esc_attr($field_name_prefix); ?> [weight]" value="<?php if (!$bulk) { echo esc_attr(wpsc_format_number($weight)); } ?> " /> <select id="wpsc-product-shipping-weight-unit" name="<?php echo $field_name_prefix; ?> [weight_unit]"> <?php foreach ($weight_units as $unit => $unit_label) { ?> <option value="<?php echo esc_attr($unit); ?> " <?php if (!$bulk) { selected($unit, $measurements['weight_unit']); } ?> ><?php echo esc_html($unit_label); ?> </option> <?php } ?> </select> </span> </p> <!-- END WEIGHT INPUT --> <!-- DIMENSIONS INPUT --> <p class="wpsc-form-field"> <?php if ($bulk) { ?> <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][dimensions]" value="1" /> <?php } ?> <label for="wpsc-product-shipping-weight"><?php echo esc_html_e('Dimensions', 'wp-e-commerce'); ?> </label> <span class="wpsc-product-shipping-input"> <input placeholder="L" type="text" id="wpsc-product-shipping-length" name="<?php echo esc_attr($field_name_prefix); ?> [dimensions][length]" value="<?php if (!$bulk && $dimensions['length'] > 0) { echo esc_attr(wpsc_format_number($dimensions['length'])); } ?> " /> × <input placeholder="W" type="text" id="wpsc-product-shipping-width" name="<?php echo esc_attr($field_name_prefix); ?> [dimensions][width]" value="<?php if (!$bulk && $dimensions['width'] > 0) { echo esc_attr(wpsc_format_number($dimensions['width'])); } ?> " /> × <input placeholder="H" type="text" id="wpsc-product-shipping-height" name="<?php echo esc_attr($field_name_prefix); ?> [dimensions][height]" value="<?php if (!$bulk && $dimensions['height'] > 0) { echo esc_attr(wpsc_format_number($dimensions['height'])); } ?> " /> <select id="wpsc-product-shipping-dimensions-unit" name="<?php echo $field_name_prefix; ?> [dimension_unit]"> <?php foreach ($dimension_units as $unit => $unit_label) { ?> <option value="<?php echo esc_attr($unit); ?> " <?php if (!$bulk && isset($meta['dimension_unit'])) { selected($unit, $meta['dimension_unit']); } // Dirty code ?> ><?php echo esc_html($unit_label); ?> </option> <?php } ?> </select> </span> </p> <!-- END DEMENSION INPUT --> </div> <?php $currency_type = get_option('currency_type'); $country = new WPSC_Country($currency_type); $ct_symb = $country->get_currency_symbol_html(); ?> <div class="wpsc-product-shipping-section wpsc-product-shipping-flat-rate"> <p><strong><?php esc_html_e('Flat Rate Settings', 'wp-e-commerce'); ?> </strong></p> <p class="wpsc-form-field"> <?php if ($bulk) { ?> <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][local]" value="1" /> <?php } ?> <label for="wpsc-product-shipping-flatrate-local"><?php esc_html_e('Local Shipping Fee', 'wp-e-commerce'); ?> </label> <span> <?php echo esc_html($ct_symb); ?> <input type="text" id="wpsc-product-shipping-flatrate-local" name="<?php echo esc_html($field_name_prefix); ?> [shipping][local]" value="<?php if (!$bulk) { echo $shipping['local']; } ?> " /> </span> </p> <p class="wpsc-form-field"> <?php if ($bulk) { ?> <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][international]" value="1" /> <?php } ?> <label for="wpsc-product-shipping-flatrate-international"><?php esc_html_e('International Shipping Fee', 'wp-e-commerce'); ?> </label> <span> <?php echo esc_html($ct_symb); ?> <input type="text" id="wpsc-product-shipping-flatrate-international" name="<?php echo esc_html($field_name_prefix); ?> [shipping][international]" value="<?php if (!$bulk) { echo $shipping['international']; } ?> " /> </span> </p> </div> </div> <?php wp_nonce_field('update', 'wpsc_product_shipping_nonce'); }