Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaastrup committed Mar 5, 2021
1 parent 7521efb commit 71d8bdb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion admin/class-wooss-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function field_for_request_shipments($order)
if (null == $wooss_origin_street) {
$wooss_origin_street = $wc_store_address;
}
$wooss_origin_states_selected = get_option('sendbox_data')['wooss_state_dropdown'];
$wooss_origin_states_selected = get_option('sendbox_data')['wooss_state_name'];
if (null == $wooss_origin_states_selected) {
$wooss_origin_states_selected = '';
}
Expand Down
10 changes: 1 addition & 9 deletions includes/assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@
e.preventDefault();
var formDetails = $('form').serializeJSON();
console.log(formDetails.wooss);
//wooss_basic_auth = $("input[name='wooss_basic_auth'").val();
//sendbox_auth_token = formDetails.sendbox_auth_token
//console.log($('form').serializeJSON());
/* sendbox_refresh_token = $("input[name='sendbox_refresh_token']").val();
console.log(sendbox_auth_token, sendbox_refresh_token)
sendbox_app_id = $("input[name='sendbox_app_id']").val();
sendbox_client_secret = $("input[name='sendbox_client_secret']").val();
*/
function reloadPage() {
window.location.reload();
}
Expand Down Expand Up @@ -112,7 +104,7 @@
var wooss_button_save = $("button.button-primary.wooss_save_button");
wooss_button_save.on("submit click", function (e) {
e.preventDefault();
var wooss_state_name = $("select.wooss_state_dropdown").val();
var wooss_state_name = $("select.wooss_state_name").val();
var wooss_country = $("select.wooss_country_select").val();
var wooss_city = $("input[name='wooss_city']").val();
var wooss_street = $("input[name='wooss_street']").val();
Expand Down
29 changes: 20 additions & 9 deletions includes/class-wooss-shipping-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function calculate_shipping($package = array())

$origin_country = "Nigeria";//get_option('wooss_country');

$origin_state = get_option('sendbox_data')['wooss_state_dropdown'];
$origin_state = get_option('sendbox_data')['wooss_state_name'];

$origin_street = get_option('sendbox_data')['wooss_street'];

Expand Down Expand Up @@ -322,9 +322,9 @@ function wooss_form_fields()
if (null == $wooss_store_address) {
$wooss_store_address = $wc_store_address;
}
$wooss_states_selected = get_option('wooss_states_selected');
$wooss_states_selected = get_option('wooss_state_name');
if (null == $wooss_states_selected) {
$wooss_states_selected = '';
$wooss_states_selected = 'no_state';
}
$wooss_country = get_option('wooss_country');
if (null == $wooss_country) {
Expand Down Expand Up @@ -436,14 +436,23 @@ function wooss_form_fields()
<strong><label for="wooss_state"><?php esc_attr_e('State : ', 'wooss'); ?></label></strong>
</td>
<td>

<?php
echo "<select class='wooss_state_dropdown wooss_fields wooss_selected' name='wooss[wooss_state_dropdown]'>";
$p_holder ="--Select State--";
echo "<select class='wooss_state_name wooss_fields wooss_selected' name='wooss[wooss_state_name]'>";
echo '<option value="no_state">'.$p_holder.'</option>';
foreach ($nigeria_states as $state) {
$states_selected = (preg_match("/$wooss_states_selected/", $state) == true) ? 'selected="selected"' : '';
echo "<option value='$state' $states_selected>$state</option>";

echo "<option value='$state'>$state</option>";

}
echo '</select>';
?>
?>
<script>
jQuery(document).ready(function (){
jQuery("select[name = 'wooss[wooss_state_name]']").val("<?php echo $wooss_states_selected; ?>");
})
</script>
</td>
</tr>

Expand Down Expand Up @@ -538,7 +547,7 @@ function connect_to_sendbox()
);
$response_code_from_api = $api_call->get_api_response_code($api_url, $args, 'GET');
//$response_body_from_profile_api = $api_call->get_api_response_body($api_url, $args, 'GET');
//var_dump($response_body_from_profile_api);
//var_dump($response_code_from_api);
if (200 === $response_code_from_api) {
$response_code = 1;
//update_option('wooss_connexion_status', $response_code);
Expand Down Expand Up @@ -568,9 +577,11 @@ function save_fields_by_ajax()
if (isset($_POST['data']) && wp_verify_nonce($_POST['security'], 'wooss-ajax-security-nonce')) {
$data = wp_unslash($_POST['data']);
$sendbox_data = get_option("sendbox_data");
$new_sendbox_data = array_merge($sendbox_data, $data);
$new_sendbox_data = array_merge($sendbox_data, $data);
//var_dump($new_sendbox_data);
update_option('sendbox_data', $new_sendbox_data);

$operation_success = 1;

}

Expand Down
2 changes: 1 addition & 1 deletion wooss.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Plugin Name: Sendbox Shipping
* Plugin URI: #
* Description: This is a woocommerce plugin that enables you ship from your store in Nigeria to anywhere in the world.
* Version: 3.2.1
* Version: 3.2.2
* Author: sendbox
* Author URI: https://sendbox.ng/
* License: GPL-2.0+
Expand Down

0 comments on commit 71d8bdb

Please sign in to comment.