-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Countries, currencies and regions infrastructure update #1865
base: master
Are you sure you want to change the base?
Changes from 2 commits
87f3fa8
e105c72
f30735d
324fb64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,12 +127,10 @@ function wpsc_price_control_forms() { | |
} | ||
|
||
$product_data['meta']['_wpsc_price'] = wpsc_format_number( $product_data['meta']['_wpsc_price'] ); | ||
|
||
$currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A ); | ||
$currency_data = wpsc_get_all_countries(); | ||
|
||
/* Get country name and symbol */ | ||
$currency_type = get_option( 'currency_type' ); | ||
$country = new WPSC_Country( $currency_type ); | ||
$country = wpsc_get_currency_type_country_object(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a massive fan of ending function names in data types, e.g. |
||
|
||
$ct_code = $country->get_currency_code(); // Country currency code | ||
$ct_symb = $country->get_currency_symbol(); // Country symbol | ||
|
@@ -197,9 +195,9 @@ function wpsc_price_control_forms() { | |
<td class="remove"><a href="#" class="wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>" rel="<?php echo $iso; ?>"><?php echo $currency_delete_text; ?></a></td> | ||
<td> | ||
<select name="newCurrency[]" class="newCurrency"> | ||
<?php foreach ( $currency_data as $currency ) : ?> | ||
<option value="<?php echo absint( $currency['id'] ); ?>" <?php selected( $iso, $currency['isocode'] ); ?>> | ||
<?php echo esc_html( $currency['country'] ); ?> (<?php echo esc_html( $currency['currency'] ); ?>) | ||
<?php foreach ( $currency_data as $country_id => $wpsc_country ) : ?> | ||
<option value="<?php echo absint( $country_id); ?>" <?php selected( $iso, $wpsc_country->get_isocode() ); ?>> | ||
<?php echo esc_html( $wpsc_country->get_name() ); ?> (<?php echo esc_html( $wpsc_country->get_currency() ); ?>) | ||
</option> | ||
<?php endforeach; ?> | ||
</select> | ||
|
@@ -214,9 +212,9 @@ function wpsc_price_control_forms() { | |
<td class="remove"><a href="#" class="wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td> | ||
<td> | ||
<select name="newCurrency[]" class="newCurrency"> | ||
<?php foreach ( (array) $currency_data as $currency ) { ?> | ||
<option value="<?php echo absint( $currency['id'] ); ?>"> | ||
<?php echo esc_html( $currency['country'] ); ?> | ||
<?php foreach ( $currency_data as $country_id => $wpsc_country ) { ?> | ||
<option value="<?php echo absint( $country_id ); ?>"> | ||
<?php echo esc_html( $wpsc_country->get_name() ); ?> | ||
</option> | ||
<?php } ?> | ||
</select> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -554,13 +554,14 @@ function wpsc_save_category_set( $category_id, $tt_id ) { | |
|
||
if ( ! empty( $_POST['countrylist2'] ) && ( $category_id > 0 ) ) { | ||
$AllSelected = false; | ||
$countryList = $wpdb->get_col( "SELECT `id` FROM `" . WPSC_TABLE_CURRENCY_LIST . "`" ); | ||
$countryList = wpsc_get_country_objects(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LIkewise, here, seems |
||
|
||
if ( $AllSelected != true ){ | ||
$all_counntry_ids = array_keys( $countryList ); | ||
$posted_countries = array_map( 'intval', $_POST['countrylist2'] ); | ||
$unselectedCountries = array_diff( $countryList, $posted_countries ); | ||
$unselectedCountries = array_diff( $all_counntry_ids, $posted_countries ); | ||
//find the countries that are selected | ||
$selectedCountries = array_intersect( $countryList, $posted_countries ); | ||
$selectedCountries = array_intersect( $all_counntry_ids, $posted_countries ); | ||
wpsc_update_categorymeta( $category_id, 'target_market', $selectedCountries ); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these tables removed? We talked in Slack about back compat concerns here...I might be missing something though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as deprecated is true they are still defined, and even installed if it a brand new installation. Also, ( when I finish up the last routine ) and changes made through $wpdb calls will also be automatically picked up by the code.
At some point when we want to turn off deprecated the the "legacy" database structures and constants will quietly go away without further action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the constants are defined (https://github.com/wp-e-commerce/WP-e-Commerce/pull/1865/files#diff-66e9d8bfe5d295da98d32c2d9c5a8d5cR251), but the WPDB properties are not?