@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
| 1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
| 2 | + exit; |
|
| 3 | +} |
|
| 2 | 4 | class wps_message_mdl { |
| 3 | 5 | |
| 4 | 6 | function __construct() { } |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
| 1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
| 2 | + exit; |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Ajax request management file |
| 4 | 6 | * |
@@ -466,12 +468,10 @@ discard block |
||
| 466 | 468 | wpshop_payment::set_payment_transaction_number($order_id, $transaction_id); |
| 467 | 469 | } |
| 468 | 470 | $result = json_encode(array(true,'')); |
| 469 | - } |
|
| 470 | - else { |
|
| 471 | + } else { |
|
| 471 | 472 | $result = json_encode(array(false,__('Choose a payment method and/or type a transaction number', 'wpshop'))); |
| 472 | 473 | } |
| 473 | - } |
|
| 474 | - else { |
|
| 474 | + } else { |
|
| 475 | 475 | $result = json_encode(array(false,__('Bad order identifier', 'wpshop'))); |
| 476 | 476 | } |
| 477 | 477 | echo json_encode($result); |
@@ -488,8 +488,7 @@ discard block |
||
| 488 | 488 | if ( !empty($order_id) ) { |
| 489 | 489 | $result = (array(true, '<h1>'.__('Tracking number','wpshop').'</h1><p>'.__('Enter a tracking number, or leave blank:','wpshop').'</p><input type="hidden" value="'.$order_id.'" name="oid" /><input type="text" name="trackingNumber" /><br /><br /><p>'.__('Enter a tracking link, or leave blank: (http included)','wpshop').'</p><input type="text" name="trackingLink" /><br /><br /><input type="submit" data-nonce="' . esc_attr( wp_create_nonce( 'wpshop_change_order_state' ) ) . '" class="button-primary sendTrackingNumber" value="'.__('Send','wpshop').'" /> <input type="button" class="button-secondary closeAlert" value="'.__('Cancel','wpshop').'" />')); |
| 490 | 490 | |
| 491 | - } |
|
| 492 | - else { |
|
| 491 | + } else { |
|
| 493 | 492 | $result = json_encode(array(false, __('Order reference error', 'wpshop'))); |
| 494 | 493 | } |
| 495 | 494 | echo json_encode($result); |
@@ -528,16 +527,14 @@ discard block |
||
| 528 | 527 | $output_shipping_box = ob_get_clean(); |
| 529 | 528 | |
| 530 | 529 | $result = array( true, $order_state, $output_shipping_box, $output_payment_box_class, $output_payment_box_content ); |
| 531 | - } |
|
| 532 | - else { |
|
| 530 | + } else { |
|
| 533 | 531 | wpshop_payment::setOrderPaymentStatus($order_id, $order_state); |
| 534 | 532 | |
| 535 | 533 | $result = array(true, $order_state, __($order_status[$order_state], 'wpshop')); |
| 536 | 534 | } |
| 537 | 535 | update_post_meta($order_id, '_order_postmeta', $order); |
| 538 | 536 | update_post_meta($order_id, '_wpshop_order_status', $order_state); |
| 539 | - } |
|
| 540 | - else { |
|
| 537 | + } else { |
|
| 541 | 538 | $result = array(false, __('Incorrect order request', 'wpshop')); |
| 542 | 539 | } |
| 543 | 540 | |
@@ -623,8 +620,7 @@ discard block |
||
| 623 | 620 | unset($tpl_component); |
| 624 | 621 | |
| 625 | 622 | echo json_encode(array(true, str_replace('optionsUpdate', 'options', $output))); |
| 626 | - } |
|
| 627 | - else { |
|
| 623 | + } else { |
|
| 628 | 624 | echo json_encode(array(false, __('The value you entered already exist', 'wpshop'))); |
| 629 | 625 | } |
| 630 | 626 | die(); |
@@ -669,13 +665,11 @@ discard block |
||
| 669 | 665 | ); |
| 670 | 666 | $new_option_id = wp_insert_post($new_post); |
| 671 | 667 | $input_def['valueToPut'] = 'index'; |
| 672 | - } |
|
| 673 | - else { |
|
| 668 | + } else { |
|
| 674 | 669 | $result_status = false; |
| 675 | 670 | $result = __('This value already exist for this attribute', 'wpshop'); |
| 676 | 671 | } |
| 677 | - } |
|
| 678 | - else { |
|
| 672 | + } else { |
|
| 679 | 673 | /** Check if the given value does not exist */ |
| 680 | 674 | $query = $wpdb->prepare("SELECT * FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE (label = %s OR value = %s) AND attribute_id = %d AND status = 'valid'", str_replace(",", ".", $attribute_options_label), $attribute_options_value, $attribute->id); |
| 681 | 675 | $existing_values = $wpdb->get_results($query); |
@@ -691,8 +685,7 @@ discard block |
||
| 691 | 685 | /** Add the new value into database */ |
| 692 | 686 | $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('creation_date' => current_time('mysql', 0), 'status' => 'valid', 'attribute_id' => $attribute->id, 'position' => $position, 'label' => str_replace(",", ".", stripslashes($attribute_options_label)), 'value' => stripslashes($attribute_options_value))); |
| 693 | 687 | $new_option_id = $wpdb->insert_id; |
| 694 | - } |
|
| 695 | - else { |
|
| 688 | + } else { |
|
| 696 | 689 | $result_status = false; |
| 697 | 690 | $result = __('This value already exist for this attribute', 'wpshop'); |
| 698 | 691 | } |
@@ -843,8 +836,7 @@ discard block |
||
| 843 | 836 | $combo_wp_type = wpshop_form::check_input_type($input_def, WPSHOP_DBT_ATTRIBUTE); |
| 844 | 837 | $result .= __('Choose the data type to use for this attribute', 'wpshop') . '<a href="#" title="'.sprintf(__('If the type you want to use is not in the list below. You have to create it by using %s menu', 'wpshop'), __('Entities', 'wpshop')).'" class="wpshop_infobulle_marker">?</a><div class="wpshop_cls wpshop_attribute_select_data_type_internal_list">'.$combo_wp_type.'</div>'; |
| 845 | 838 | $result .= '<input type="hidden" value="no" name="delete_items_of_entity" id="delete_items_of_entity" /><input type="hidden" value="no" name="delete_entity" id="delete_entity" />'; |
| 846 | - } |
|
| 847 | - else { |
|
| 839 | + } else { |
|
| 848 | 840 | $result .= '<input type="hidden" value="' . $attribute->default_value . '" name="internal_data" id="internal_data" />'; |
| 849 | 841 | |
| 850 | 842 | unset($input_def); |
@@ -901,8 +893,7 @@ discard block |
||
| 901 | 893 | } |
| 902 | 894 | } |
| 903 | 895 | } |
| 904 | - } |
|
| 905 | - else { |
|
| 896 | + } else { |
|
| 906 | 897 | $post_list = query_posts(array('post_type' => $internal_data_type)); |
| 907 | 898 | if (!empty($post_list)) { |
| 908 | 899 | $p=1; |
@@ -911,8 +902,7 @@ discard block |
||
| 911 | 902 | $last_insert = $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('status'=>'valid', 'creation_date'=>current_time('mysql',0), 'attribute_id'=>$current_attribute, 'position'=>$p, 'value'=>$post->post_name, 'label'=>$post->post_title)); |
| 912 | 903 | if(is_int($last_insert) && $delete_items_of_entity){ |
| 913 | 904 | wp_delete_post($post->ID, true); |
| 914 | - } |
|
| 915 | - else{ |
|
| 905 | + } else{ |
|
| 916 | 906 | $error = true; |
| 917 | 907 | } |
| 918 | 908 | $p++; |
@@ -976,13 +966,11 @@ discard block |
||
| 976 | 966 | } |
| 977 | 967 | $result = true; |
| 978 | 968 | $result_output = '<p class="wpshop_duplicate_attribute_result" ><a href="' . admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING . '&action=edit&id=' . $new_attribute_id) . '" >' . __('Edit the new attribute', 'wpshop') . '</a></p>'; |
| 979 | - } |
|
| 980 | - else { |
|
| 969 | + } else { |
|
| 981 | 970 | $result = false; |
| 982 | 971 | $result_output = __('An error occured while duplicating attribute', 'wpshop'); |
| 983 | 972 | } |
| 984 | - } |
|
| 985 | - else { |
|
| 973 | + } else { |
|
| 986 | 974 | $result = false; |
| 987 | 975 | $result_output = __('This attribute has already been duplicate to this entity', 'wpshop'); |
| 988 | 976 | } |
@@ -1012,8 +1000,7 @@ discard block |
||
| 1012 | 1000 | /* Test if we want display the group unit list OR the unit list */ |
| 1013 | 1001 | if ( $selected_list == 'group unit' ) { |
| 1014 | 1002 | $list = wpshop_attributes_unit::get_unit_group(); |
| 1015 | - } |
|
| 1016 | - else { |
|
| 1003 | + } else { |
|
| 1017 | 1004 | $list = wpshop_attributes_unit::get_unit_list_for_group($group); |
| 1018 | 1005 | } |
| 1019 | 1006 | |
@@ -1021,8 +1008,7 @@ discard block |
||
| 1021 | 1008 | $response .= '<option value="' . $unit->id . '" '. ( ($current_group == $unit->id && $selected_list == 'group unit') ? 'selected="selected"' : '' ).'>' . $unit->name . '</option>'; |
| 1022 | 1009 | } |
| 1023 | 1010 | $result = array(true, $response); |
| 1024 | - } |
|
| 1025 | - else { |
|
| 1011 | + } else { |
|
| 1026 | 1012 | $result = array(false, __('Incorrect order request', 'wpshop')); |
| 1027 | 1013 | } |
| 1028 | 1014 | |
@@ -1061,14 +1047,12 @@ discard block |
||
| 1061 | 1047 | $sub_modif .= $column_name; |
| 1062 | 1048 | if( !empty($columns->Field) && ($columns->Field == $column_name) ){ |
| 1063 | 1049 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Field has been created', 'wpshop') . '" title="' . __('Field has been created', 'wpshop') . '" class="db_added_field_check" />'; |
| 1064 | - } |
|
| 1065 | - else{ |
|
| 1050 | + } else{ |
|
| 1066 | 1051 | $sub_modif .= '<img src="' . admin_url('images/no.png') . '" alt="' . __('Field does not exist', 'wpshop') . '" title="' . __('Field does not exist', 'wpshop') . '" class="db_added_field_check" />'; |
| 1067 | 1052 | $error_nb++; |
| 1068 | 1053 | if ( !empty($error_list[$plugin_db_version]) ) { |
| 1069 | 1054 | $error_list[$plugin_db_version] += 1; |
| 1070 | - } |
|
| 1071 | - else { |
|
| 1055 | + } else { |
|
| 1072 | 1056 | $error_list[$plugin_db_version] = 1; |
| 1073 | 1057 | } |
| 1074 | 1058 | } |
@@ -1086,8 +1070,7 @@ discard block |
||
| 1086 | 1070 | $sub_modif .= $column_name; |
| 1087 | 1071 | if(empty($columns) || ($columns->Field != $column_name)){ |
| 1088 | 1072 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Field has been deleted', 'wpshop') . '" title="' . __('Field has been deleted', 'wpshop') . '" class="db_deleted_field_check" />'; |
| 1089 | - } |
|
| 1090 | - else{ |
|
| 1073 | + } else{ |
|
| 1091 | 1074 | $sub_modif .= '<img src="' . admin_url('images/no.png') . '" alt="' . __('Field exists', 'wpshop') . '" title="' . __('Field exists', 'wpshop') . '" class="db_deleted_field_check" />'; |
| 1092 | 1075 | $error_nb++; |
| 1093 | 1076 | $error_list[$plugin_db_version] += 1; |
@@ -1109,8 +1092,7 @@ discard block |
||
| 1109 | 1092 | $changed_key = 'type'; |
| 1110 | 1093 | if($columns->Type == $field_infos['type']){ |
| 1111 | 1094 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Field has been created', 'wpshop') . '" title="' . __('Field has been created', 'wpshop') . '" class="db_added_field_check" />'; |
| 1112 | - } |
|
| 1113 | - else{ |
|
| 1095 | + } else{ |
|
| 1114 | 1096 | $sub_modif .= '<img src="' . admin_url('images/no.png') . '" alt="' . __('Field does not exist', 'wpshop') . '" title="' . __('Field does not exist', 'wpshop') . '" class="db_added_field_check" />'; |
| 1115 | 1097 | $error_nb++; |
| 1116 | 1098 | $error_list[$plugin_db_version] += 1; |
@@ -1122,8 +1104,7 @@ discard block |
||
| 1122 | 1104 | $changed_key = 'original_name'; |
| 1123 | 1105 | if($columns->Field == $field_infos['field']){ |
| 1124 | 1106 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Field has been created', 'wpshop') . '" title="' . __('Field has been created', 'wpshop') . '" class="db_added_field_check" />'; |
| 1125 | - } |
|
| 1126 | - else{ |
|
| 1107 | + } else{ |
|
| 1127 | 1108 | $sub_modif .= '<img src="' . admin_url('images/no.png') . '" alt="' . __('Field does not exist', 'wpshop') . '" title="' . __('Field does not exist', 'wpshop') . '" class="db_added_field_check" />'; |
| 1128 | 1109 | $error_nb++; |
| 1129 | 1110 | $error_list[$plugin_db_version] += 1; |
@@ -1146,8 +1127,7 @@ discard block |
||
| 1146 | 1127 | $sub_modif .= $column_name; |
| 1147 | 1128 | if((empty($columns)) || ($columns->Column_name != $column_name)){ |
| 1148 | 1129 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Index has been deleted', 'wpshop') . '" title="' . __('Index has been deleted', 'wpshop') . '" class="db_deleted_index_check" />'; |
| 1149 | - } |
|
| 1150 | - else{ |
|
| 1130 | + } else{ |
|
| 1151 | 1131 | $sub_modif .= '<img src="' . admin_url('images/no.png') . '" alt="' . __('Index does not exists', 'wpshop') . '" title="' . __('Index does not exists', 'wpshop') . '" class="db_deleted_index_check" />'; |
| 1152 | 1132 | $error_nb++; |
| 1153 | 1133 | $error_list[$plugin_db_version] += 1; |
@@ -1166,8 +1146,7 @@ discard block |
||
| 1166 | 1146 | $sub_modif .= $column_name; |
| 1167 | 1147 | if(($columns->Column_name == $column_name) || ($columns->Key_name == $column_name)){ |
| 1168 | 1148 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Index has been created', 'wpshop') . '" title="' . __('Index has been created', 'wpshop') . '" class="db_added_index_check" />'; |
| 1169 | - } |
|
| 1170 | - else{ |
|
| 1149 | + } else{ |
|
| 1171 | 1150 | $sub_modif .= '<img src="' . admin_url('images/no.png') . '" alt="' . __('Index does not exist', 'wpshop') . '" title="' . __('Index does not exist', 'wpshop') . '" class="db_added_index_check" />'; |
| 1172 | 1151 | $error_nb++; |
| 1173 | 1152 | $error_list[$plugin_db_version] += 1; |
@@ -1186,14 +1165,12 @@ discard block |
||
| 1186 | 1165 | $table_exists = $wpdb->query($query); |
| 1187 | 1166 | if($table_exists == 1){ |
| 1188 | 1167 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Table has been created', 'wpshop') . '" title="' . __('Table has been created', 'wpshop') . '" class="db_table_check" />'; |
| 1189 | - } |
|
| 1190 | - else{ |
|
| 1168 | + } else{ |
|
| 1191 | 1169 | $sub_modif .= '<img src="' . admin_url('images/no.png') . '" alt="' . __('Table has not been created', 'wpshop') . '" title="' . __('Table has not been created', 'wpshop') . '" class="db_table_check" />'; |
| 1192 | 1170 | $error_nb++; |
| 1193 | 1171 | if ( !empty($error_list[$plugin_db_version]) ) { |
| 1194 | 1172 | $error_list[$plugin_db_version] += 1; |
| 1195 | - } |
|
| 1196 | - else { |
|
| 1173 | + } else { |
|
| 1197 | 1174 | $error_list[$plugin_db_version] = 1; |
| 1198 | 1175 | } |
| 1199 | 1176 | } |
@@ -1214,21 +1191,17 @@ discard block |
||
| 1214 | 1191 | $error_nb++; |
| 1215 | 1192 | if ( !empty($error_list[$plugin_db_version]) ) { |
| 1216 | 1193 | $error_list[$plugin_db_version] += 1; |
| 1217 | - } |
|
| 1218 | - else { |
|
| 1194 | + } else { |
|
| 1219 | 1195 | $error_list[$plugin_db_version] = 1; |
| 1220 | 1196 | } |
| 1221 | - } |
|
| 1222 | - elseif($table_exists == 1){ |
|
| 1197 | + } elseif($table_exists == 1){ |
|
| 1223 | 1198 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Table has been renamed', 'wpshop') . '" title="' . __('Table has been renamed', 'wpshop') . '" class="db_rename_table_check" />'; |
| 1224 | - } |
|
| 1225 | - else{ |
|
| 1199 | + } else{ |
|
| 1226 | 1200 | $sub_modif .= '<img src="' . admin_url('images/no.png') . '" alt="' . __('Table has not been renamed', 'wpshop') . '" title="' . __('Table has not been renamed', 'wpshop') . '" class="db_rename_table_check" />'; |
| 1227 | 1201 | $error_nb++; |
| 1228 | 1202 | if ( !empty($error_list[$plugin_db_version]) ) { |
| 1229 | 1203 | $error_list[$plugin_db_version] += 1; |
| 1230 | - } |
|
| 1231 | - else { |
|
| 1204 | + } else { |
|
| 1232 | 1205 | $error_list[$plugin_db_version] = 1; |
| 1233 | 1206 | } |
| 1234 | 1207 | } |
@@ -1250,24 +1223,20 @@ discard block |
||
| 1250 | 1223 | $error_nb++; |
| 1251 | 1224 | if ( !empty($error_list[$plugin_db_version]) ) { |
| 1252 | 1225 | $error_list[$plugin_db_version] += 1; |
| 1253 | - } |
|
| 1254 | - else { |
|
| 1226 | + } else { |
|
| 1255 | 1227 | $error_list[$plugin_db_version] = 1; |
| 1256 | 1228 | } |
| 1257 | - } |
|
| 1258 | - else{ |
|
| 1229 | + } else{ |
|
| 1259 | 1230 | $deleted_table_result = '<img src="' . EVA_IMG_ICONES_PLUGIN_URL . 'warning_vs.gif" alt="' . __('Table has not been deleted', 'wpshop') . '" title="' . __('Table has not been renamed', 'wpshop') . '" class="db_deleted_table_check" />'; |
| 1260 | 1231 | $warning_nb++; |
| 1261 | 1232 | if ( !empty($warning_list[$plugin_db_version]) ) { |
| 1262 | 1233 | $warning_list[$plugin_db_version] += 1; |
| 1263 | - } |
|
| 1264 | - else { |
|
| 1234 | + } else { |
|
| 1265 | 1235 | $warning_list[$plugin_db_version] = 1; |
| 1266 | 1236 | } |
| 1267 | 1237 | } |
| 1268 | 1238 | $sub_modif .= $deleted_table_result; |
| 1269 | - } |
|
| 1270 | - else{ |
|
| 1239 | + } else{ |
|
| 1271 | 1240 | $sub_modif .= '<img src="' . admin_url('images/yes.png') . '" alt="' . __('Table has been deleted', 'wpshop') . '" title="' . __('Table has been deleted', 'wpshop') . '" class="db_deleted_table_check" />'; |
| 1272 | 1241 | } |
| 1273 | 1242 | $sub_modif .= ' / '; |
@@ -1367,8 +1336,7 @@ discard block |
||
| 1367 | 1336 | |
| 1368 | 1337 | if ( $has_error ) { |
| 1369 | 1338 | $output_error .= wpshop_display::display_template_element('wpshop_admin_tools_default_datas_check_main_element', $tpl_component, array(), 'admin'); |
| 1370 | - } |
|
| 1371 | - else { |
|
| 1339 | + } else { |
|
| 1372 | 1340 | $output_ok .= wpshop_display::display_template_element('wpshop_admin_tools_default_datas_check_main_element', $tpl_component, array(), 'admin'); |
| 1373 | 1341 | } |
| 1374 | 1342 | } |
@@ -1544,8 +1512,7 @@ discard block |
||
| 1544 | 1512 | if ( $last_histo === false ) { |
| 1545 | 1513 | $has_error = true; |
| 1546 | 1514 | $error_count++; |
| 1547 | - } |
|
| 1548 | - else { |
|
| 1515 | + } else { |
|
| 1549 | 1516 | $wpdb->delete( WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . $attributeType, array( 'value_id' => $attribute_histo->value_id ) ); |
| 1550 | 1517 | } |
| 1551 | 1518 | } |
@@ -1564,8 +1531,7 @@ discard block |
||
| 1564 | 1531 | if ( $new_value === false ) { |
| 1565 | 1532 | $has_error = true; |
| 1566 | 1533 | $error_count++; |
| 1567 | - } |
|
| 1568 | - else { |
|
| 1534 | + } else { |
|
| 1569 | 1535 | /** Save new atribute values in product metadata */ |
| 1570 | 1536 | $current_product_metadata = get_post_meta( $element->ID, '_wpshop_product_metadata', true); |
| 1571 | 1537 | $current_product_metadata[$to_attribute->code] = $element->value; |
@@ -1581,23 +1547,19 @@ discard block |
||
| 1581 | 1547 | if ( !$has_error ) { |
| 1582 | 1548 | $response['status'] = true; |
| 1583 | 1549 | $response['error'] = __('Transfert between attribute is done', 'wpshop'); |
| 1584 | - } |
|
| 1585 | - else { |
|
| 1550 | + } else { |
|
| 1586 | 1551 | $response['status'] = false; |
| 1587 | 1552 | $response['error'] = sprinttf( __('There are %d error that occured while copying value through attributes', 'wpshop'), $error_count); |
| 1588 | 1553 | } |
| 1589 | - } |
|
| 1590 | - else { |
|
| 1554 | + } else { |
|
| 1591 | 1555 | $response['status'] = false; |
| 1592 | 1556 | $response['error'] = __('There are no element corresponding to attribute choosen to copy from', 'wpshop'); |
| 1593 | 1557 | } |
| 1594 | - } |
|
| 1595 | - else { |
|
| 1558 | + } else { |
|
| 1596 | 1559 | $response['status'] = false; |
| 1597 | 1560 | $response['error'] = __('Both attribute must have same data type to be updated', 'wpshop'); |
| 1598 | 1561 | } |
| 1599 | - } |
|
| 1600 | - else { |
|
| 1562 | + } else { |
|
| 1601 | 1563 | $response['status'] = false; |
| 1602 | 1564 | $response['error'] = __('You have to choose attributes in order to update values', 'wpshop'); |
| 1603 | 1565 | } |
@@ -1696,8 +1658,7 @@ discard block |
||
| 1696 | 1658 | if ( !empty($wps_update_att_for_variation_required_state) && ($wps_update_att_for_variation_required_state != 'no_changes') ) { |
| 1697 | 1659 | if ( $wps_update_att_for_variation_required_state == 'yes') { |
| 1698 | 1660 | $meta_value['options']['required_attributes'][$attribute->code] = $attribute->code; |
| 1699 | - } |
|
| 1700 | - else if ( !empty($meta_value['options']['required_attributes']) && !empty($meta_value['options']['required_attributes'][$attribute->code]) ) { |
|
| 1661 | + } else if ( !empty($meta_value['options']['required_attributes']) && !empty($meta_value['options']['required_attributes'][$attribute->code]) ) { |
|
| 1701 | 1662 | unset($meta_value['options']['required_attributes'][$attribute->code]); |
| 1702 | 1663 | } |
| 1703 | 1664 | } |
@@ -1708,8 +1669,7 @@ discard block |
||
| 1708 | 1669 | if ( !empty($text_from) && ($text_from != 'no_changes') ) { |
| 1709 | 1670 | if ( $text_from == 'yes' ) { |
| 1710 | 1671 | $meta_value['options']['price_display']['text_from'] = 'on'; |
| 1711 | - } |
|
| 1712 | - else if( !empty($meta_value['options']['price_display']['text_from']) ) { |
|
| 1672 | + } else if( !empty($meta_value['options']['price_display']['text_from']) ) { |
|
| 1713 | 1673 | unset($meta_value['options']['price_display']['text_from']); |
| 1714 | 1674 | } |
| 1715 | 1675 | } |
@@ -1718,8 +1678,7 @@ discard block |
||
| 1718 | 1678 | if ( !empty($lower_price) && ($lower_price != 'no_changes') ) { |
| 1719 | 1679 | if ( $lower_price == 'yes' ) { |
| 1720 | 1680 | $meta_value['options']['price_display']['lower_price'] = 'on'; |
| 1721 | - } |
|
| 1722 | - else if( !empty($meta_value['options']['price_display']['lower_price']) ) { |
|
| 1681 | + } else if( !empty($meta_value['options']['price_display']['lower_price']) ) { |
|
| 1723 | 1682 | unset($meta_value['options']['price_display']['lower_price']); |
| 1724 | 1683 | } |
| 1725 | 1684 | } |
@@ -1800,20 +1759,16 @@ discard block |
||
| 1800 | 1759 | $activate_attribute_for_addon = $wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('status' => 'valid'), array('code' => $addons_list[$addon_name][3])); |
| 1801 | 1760 | } |
| 1802 | 1761 | $state = true; |
| 1803 | - } |
|
| 1804 | - else { |
|
| 1762 | + } else { |
|
| 1805 | 1763 | $result = array(false, __('An error occured','wpshop'), __('Desactivated','wpshop')); |
| 1806 | 1764 | } |
| 1807 | - } |
|
| 1808 | - else { |
|
| 1765 | + } else { |
|
| 1809 | 1766 | $result = array(false, __('The activating code is invalid', 'wpshop'), __('Desactivated','wpshop')); |
| 1810 | 1767 | } |
| 1811 | - } |
|
| 1812 | - else { |
|
| 1768 | + } else { |
|
| 1813 | 1769 | $result = array(false, __('The addon to activate is invalid', 'wpshop'), __('Desactivated','wpshop')); |
| 1814 | 1770 | } |
| 1815 | - } |
|
| 1816 | - else { |
|
| 1771 | + } else { |
|
| 1817 | 1772 | $result = array(false, __('An error occured','wpshop'), __('Desactivated','wpshop')); |
| 1818 | 1773 | } |
| 1819 | 1774 | $activated_class = unserialize(WPSHOP_ADDONS_STATES_CLASS); |
@@ -1841,12 +1796,10 @@ discard block |
||
| 1841 | 1796 | if ( update_option(WPSHOP_ADDONS_OPTION_NAME, $extra_options) ) { |
| 1842 | 1797 | $result = array(true, __('The addon has been desactivated successfully', 'wpshop'), __('Desactivated','wpshop')); |
| 1843 | 1798 | $state = false; |
| 1844 | - } |
|
| 1845 | - else { |
|
| 1799 | + } else { |
|
| 1846 | 1800 | $result = array(false, __('An error occured','wpshop'), __('Activated','wpshop')); |
| 1847 | 1801 | } |
| 1848 | - } |
|
| 1849 | - else { |
|
| 1802 | + } else { |
|
| 1850 | 1803 | $result = array(false, __('The addon to desactivate is invalid', 'wpshop'), __('Activated','wpshop')); |
| 1851 | 1804 | } |
| 1852 | 1805 | } |
@@ -1885,8 +1838,7 @@ discard block |
||
| 1885 | 1838 | $submitOrderInfos = !empty( $_POST['submitOrderInfos'] ) ? (int) $_POST['submitOrderInfos'] : 0; |
| 1886 | 1839 | if( !empty($submitOrderInfos) ) { |
| 1887 | 1840 | $value = $attribute[$attribute->data_type][$attribute->code]; |
| 1888 | - } |
|
| 1889 | - else { |
|
| 1841 | + } else { |
|
| 1890 | 1842 | $value = ''; |
| 1891 | 1843 | if ( $attribute->code != 'user_pass') { |
| 1892 | 1844 | $code = $attribute->code; |
@@ -1957,16 +1909,14 @@ discard block |
||
| 1957 | 1909 | |
| 1958 | 1910 | if ( $wpshop_format_result ) { |
| 1959 | 1911 | $data = empty($data) ? __('No match', 'wpshop') : $data; |
| 1960 | - } |
|
| 1961 | - else { |
|
| 1912 | + } else { |
|
| 1962 | 1913 | if ( !empty($data) ) { |
| 1963 | 1914 | $temp_data = $data; |
| 1964 | 1915 | unset( $data ); |
| 1965 | 1916 | foreach ( $temp_data as $post) { |
| 1966 | 1917 | $data[$post->ID] = $post->ID . ' - ' . $post->post_title; |
| 1967 | 1918 | } |
| 1968 | - } |
|
| 1969 | - else { |
|
| 1919 | + } else { |
|
| 1970 | 1920 | $data = array(); |
| 1971 | 1921 | } |
| 1972 | 1922 | } |
@@ -2031,8 +1981,7 @@ discard block |
||
| 2031 | 1981 | $product_title = ( !empty($parent_post) && !empty($parent_post->post_title) ) ? $parent_post->post_title : ''; |
| 2032 | 1982 | $product_description = ( !empty($parent_post) && !empty($parent_post->post_content) ) ? $parent_post->post_content : ''; |
| 2033 | 1983 | $product_img = ( !empty($parent_post->ID) ) ? get_the_post_thumbnail( $parent_post->ID, 'thumbnail') : ''; |
| 2034 | - } |
|
| 2035 | - else { |
|
| 1984 | + } else { |
|
| 2036 | 1985 | $product_title = $product->post_title; |
| 2037 | 1986 | $product_description = $product->post_content; |
| 2038 | 1987 | $product_img = get_the_post_thumbnail( $product_id, 'thumbnail'); |
@@ -2046,8 +1995,7 @@ discard block |
||
| 2046 | 1995 | |
| 2047 | 1996 | echo json_encode( array(true) ); |
| 2048 | 1997 | die(); |
| 2049 | - } |
|
| 2050 | - else { |
|
| 1998 | + } else { |
|
| 2051 | 1999 | $return = $wpshop_cart->add_to_cart( $product_to_add_to_cart, array( $new_pid => $product_qty ), $wpshop_cart_type ); |
| 2052 | 2000 | } |
| 2053 | 2001 | |
@@ -2064,8 +2012,7 @@ discard block |
||
| 2064 | 2012 | require_once(wpshop_display::get_template_file($tpl_way_to_take[1])); |
| 2065 | 2013 | $succes_message_box = ob_get_contents(); |
| 2066 | 2014 | ob_end_clean(); |
| 2067 | - } |
|
| 2068 | - else { |
|
| 2015 | + } else { |
|
| 2069 | 2016 | $succes_message_box = wpshop_display::display_template_element($template_part, array('PRODUCT_ID' => $product_id)); |
| 2070 | 2017 | } |
| 2071 | 2018 | unset($tpl_component); |
@@ -2082,12 +2029,10 @@ discard block |
||
| 2082 | 2029 | |
| 2083 | 2030 | if ( !empty($product_to_add_to_cart[$new_pid]['variations']) && count($product_to_add_to_cart[$new_pid]['variations']) < 2 ) { |
| 2084 | 2031 | $idp = $product_to_add_to_cart[$new_pid]['variations'][0]; |
| 2085 | - } |
|
| 2086 | - else { |
|
| 2032 | + } else { |
|
| 2087 | 2033 | if( strstr( $new_pid, '__') ) { |
| 2088 | 2034 | $idp = $new_pid; |
| 2089 | - } |
|
| 2090 | - else { |
|
| 2035 | + } else { |
|
| 2091 | 2036 | $idp = $product_to_add_to_cart[$new_pid]['id']; |
| 2092 | 2037 | } |
| 2093 | 2038 | } |
@@ -2112,8 +2057,7 @@ discard block |
||
| 2112 | 2057 | if ( !empty($related_products) ) { |
| 2113 | 2058 | // $linked_products = '<h2>'.__('Linked products', 'wpshop').'</h2>'; |
| 2114 | 2059 | $linked_products .= '<div class="modal_product_related">' .do_shortcode( '[wpshop_related_products pid="' .$product_id. '" sorting="no"]' ).'</div>'; |
| 2115 | - } |
|
| 2116 | - else { |
|
| 2060 | + } else { |
|
| 2117 | 2061 | $linked_products = ''; |
| 2118 | 2062 | } |
| 2119 | 2063 | |
@@ -2123,8 +2067,7 @@ discard block |
||
| 2123 | 2067 | $modal_footer_content = wpshop_display::display_template_element('wps_new_add_to_cart_confirmation_modal_footer', array( 'LINK_CART_PAGE' => wpshop_tools::get_page_id( get_permalink( get_option('wpshop_cart_page_id') ) ) ) ); |
| 2124 | 2068 | |
| 2125 | 2069 | $response = array( true, $succes_message_box, $action_after_add, $cart_page_url, $product_id, array($cart_animation_choice, $message_confirmation), array($product_img, $product_title, $linked_products, $product_price), $modal_content, $modal_footer_content ); |
| 2126 | - } |
|
| 2127 | - else { |
|
| 2070 | + } else { |
|
| 2128 | 2071 | $response = array( false, $return ); |
| 2129 | 2072 | } |
| 2130 | 2073 | |
@@ -2170,8 +2113,7 @@ discard block |
||
| 2170 | 2113 | } |
| 2171 | 2114 | $return = $wpshop_cart->set_product_qty( $product_id, $product_qty, $pid ); |
| 2172 | 2115 | $response[] = $return; |
| 2173 | - } |
|
| 2174 | - else { |
|
| 2116 | + } else { |
|
| 2175 | 2117 | $response[] = false; |
| 2176 | 2118 | $response[] = __('Parameters error.','wpshop'); |
| 2177 | 2119 | } |
@@ -2322,16 +2264,13 @@ discard block |
||
| 2322 | 2264 | $permalink_option = get_option('permalink_structure'); |
| 2323 | 2265 | if ( !empty($permalink_option) ) { |
| 2324 | 2266 | $cart_url = get_permalink( wpshop_tools::get_page_id( get_option('wpshop_signup_page_id') ) ).'?complete_sign_up=ok'; |
| 2325 | - } |
|
| 2326 | - else { |
|
| 2267 | + } else { |
|
| 2327 | 2268 | $cart_url = get_permalink( wpshop_tools::get_page_id(get_option('wpshop_signup_page_id') ) ).'&complete_sign_up=ok'; |
| 2328 | 2269 | } |
| 2329 | - } |
|
| 2330 | - else { |
|
| 2270 | + } else { |
|
| 2331 | 2271 | if ( !empty($_SESSION['cart']) ) { |
| 2332 | 2272 | $cart_url = get_permalink( wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id')) ); |
| 2333 | - } |
|
| 2334 | - else { |
|
| 2273 | + } else { |
|
| 2335 | 2274 | $cart_url = get_permalink( wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id')) ); |
| 2336 | 2275 | } |
| 2337 | 2276 | } |
@@ -2391,9 +2330,7 @@ discard block |
||
| 2391 | 2330 | $retour .= '<div class="wpshop_cls"></div>'; |
| 2392 | 2331 | $result = json_encode( array(true, $retour) ); |
| 2393 | 2332 | |
| 2394 | - } |
|
| 2395 | - |
|
| 2396 | - elseif ( !empty($order_postmeta) && !empty($order_postmeta['order_status']) && in_array($order_postmeta['order_status'], array('awaiting_payment', 'partially_paid'))) { |
|
| 2333 | + } elseif ( !empty($order_postmeta) && !empty($order_postmeta['order_status']) && in_array($order_postmeta['order_status'], array('awaiting_payment', 'partially_paid'))) { |
|
| 2397 | 2334 | $order_id = !empty( $_REQUEST['order_id'] ) ? (int) $_REQUEST['order_id'] : 0; |
| 2398 | 2335 | $order_info_postmeta = get_post_meta($order_id, '_order_info', true); |
| 2399 | 2336 | |
@@ -2409,8 +2346,7 @@ discard block |
||
| 2409 | 2346 | } |
| 2410 | 2347 | |
| 2411 | 2348 | $result = json_encode( array(true, $billing_form, $shipping_form, $current_customer_id) ); |
| 2412 | - } |
|
| 2413 | - else { |
|
| 2349 | + } else { |
|
| 2414 | 2350 | // Check the attribute set id of Billing Address |
| 2415 | 2351 | $query = $wpdb->prepare('SELECT id FROM ' .WPSHOP_DBT_ATTRIBUTE_SET. ' WHERE name = "' .__('Billing address', 'wpshop'). '"', ''); |
| 2416 | 2352 | $attribute_set_id = $wpdb->get_var($query); |
@@ -2472,8 +2408,7 @@ discard block |
||
| 2472 | 2408 | $user_id = wp_create_user( sanitize_user( $value ), wp_generate_password( 12, false ) ); |
| 2473 | 2409 | $query = $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_type = %s AND post_author = %d", WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, $user_id ); |
| 2474 | 2410 | $attribute_option_id = $wpdb->get_var( $query ); |
| 2475 | - } |
|
| 2476 | - else { |
|
| 2411 | + } else { |
|
| 2477 | 2412 | $entity_args = array( |
| 2478 | 2413 | 'post_type' => $attribute_default_value['default_value'], |
| 2479 | 2414 | 'post_title' => $value, |
@@ -2482,8 +2417,7 @@ discard block |
||
| 2482 | 2417 | ); |
| 2483 | 2418 | $attribute_option_id = wp_insert_post($entity_args); |
| 2484 | 2419 | } |
| 2485 | - } |
|
| 2486 | - else { |
|
| 2420 | + } else { |
|
| 2487 | 2421 | $wpdb->insert( WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('status'=>'valid', 'creation_date'=>current_time('mysql', 0), 'position' => 1, 'attribute_id'=>$attribute_def->id, 'value'=>$value, 'label'=>$value) ); |
| 2488 | 2422 | $attribute_option_id = $wpdb->insert_id; |
| 2489 | 2423 | } |
@@ -2572,8 +2506,7 @@ discard block |
||
| 2572 | 2506 | } |
| 2573 | 2507 | |
| 2574 | 2508 | echo json_encode( array( true, __('Element has been saved', 'wpshop'), $attribute_to_reload, $new_entity_id) ); |
| 2575 | - } |
|
| 2576 | - else { |
|
| 2509 | + } else { |
|
| 2577 | 2510 | echo json_encode( array(false, __('An error occured while adding your element', 'wpshop')) ); |
| 2578 | 2511 | } |
| 2579 | 2512 | |
@@ -2613,20 +2546,17 @@ discard block |
||
| 2613 | 2546 | if ( !empty($available_payement_method[0]) ) { |
| 2614 | 2547 | if ( $cart_type=='quotation' ) { |
| 2615 | 2548 | $checkout_payment_button = wpshop_display::display_template_element('wpshop_checkout_page_quotation_validation_button', array() ); |
| 2616 | - } |
|
| 2617 | - else { |
|
| 2549 | + } else { |
|
| 2618 | 2550 | $checkout_payment_button = wpshop_display::display_template_element('wpshop_checkout_page_validation_button', array() ); |
| 2619 | 2551 | } |
| 2620 | 2552 | } |
| 2621 | - } |
|
| 2622 | - else { |
|
| 2553 | + } else { |
|
| 2623 | 2554 | $checkout_payment_button = wpshop_display::display_template_element('wpshop_checkout_page_impossible_to_order', array()); |
| 2624 | 2555 | } |
| 2625 | 2556 | if( $address_type == 'billing_address') { |
| 2626 | 2557 | $billing_option = get_option( 'wpshop_billing_address' ); |
| 2627 | 2558 | $address_option = $billing_option['choice']; |
| 2628 | - } |
|
| 2629 | - else { |
|
| 2559 | + } else { |
|
| 2630 | 2560 | $shipping_address_option = get_option('wpshop_shipping_address_choice'); |
| 2631 | 2561 | $address_option = $shipping_address_option['choice']; |
| 2632 | 2562 | } |
@@ -2638,8 +2568,7 @@ discard block |
||
| 2638 | 2568 | |
| 2639 | 2569 | $edit_link = '<a href="' .get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))) . (strpos(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))), '?')===false ? '?' : '&') . 'action=editAddress&id='.$address_id.'" title="' .__('Edit', 'wpshop'). '">' .__('Edit', 'wpshop'). '</a>'; |
| 2640 | 2570 | $result = json_encode( array(true, $retour, $edit_link, $is_allowed_destination, $checkout_payment_button) ); |
| 2641 | - } |
|
| 2642 | - else { |
|
| 2571 | + } else { |
|
| 2643 | 2572 | $result = json_encode( array(false, 'missing_informations') ); |
| 2644 | 2573 | } |
| 2645 | 2574 | echo $result; |
@@ -2708,13 +2637,11 @@ discard block |
||
| 2708 | 2637 | wps_address::save_address_infos( $shipping_address); |
| 2709 | 2638 | } |
| 2710 | 2639 | $result = json_encode( array(true, __('Customer created', 'wpshop'), $user_id) ); |
| 2711 | - } |
|
| 2712 | - else { |
|
| 2640 | + } else { |
|
| 2713 | 2641 | $result = json_encode( array(false, __('A customer account is already created with this email address', 'wpshop')) ); |
| 2714 | 2642 | } |
| 2715 | 2643 | |
| 2716 | - } |
|
| 2717 | - else { |
|
| 2644 | + } else { |
|
| 2718 | 2645 | $result = json_encode( array(false, __('An email address is required', 'wpshop')) ); |
| 2719 | 2646 | } |
| 2720 | 2647 | echo $result; |
@@ -2742,8 +2669,7 @@ discard block |
||
| 2742 | 2669 | $wps_message = new wps_message_ctr(); |
| 2743 | 2670 | $wps_message->wpshop_prepared_email( $email, $model_name, array('order_id' => $order_id, 'order_key' => ( ( !empty($order_post_meta) && !empty($order_post_meta['order_key']) ) ? $order_post_meta['order_key'] : '' ), 'order_date' => ( ( !empty($order_post_meta) && !empty($order_post_meta['order_date']) ) ? $order_post_meta['order_date'] : '' ),'customer_first_name' => $first_name, 'customer_last_name' => $last_name) ); |
| 2744 | 2671 | $result = array('status' => true, 'response' => $wps_message->get_historic_message_by_type($message_type_id) ); |
| 2745 | - } |
|
| 2746 | - else { |
|
| 2672 | + } else { |
|
| 2747 | 2673 | $result = array('status' => false, 'response' => __('An error occured', 'wpshop') ); |
| 2748 | 2674 | } |
| 2749 | 2675 | echo json_encode($result); |
@@ -2770,8 +2696,7 @@ discard block |
||
| 2770 | 2696 | $n = WPSHOP_UPLOAD_URL.'/'.$name; |
| 2771 | 2697 | update_post_meta( $element_identifier, 'attribute_option_is_downloadable_', array('file_url' => $n)); |
| 2772 | 2698 | $result = '<a href="' .$n. '" target="_blank" download>' .$name. '</a>'; |
| 2773 | - } |
|
| 2774 | - else { |
|
| 2699 | + } else { |
|
| 2775 | 2700 | $result = ''; |
| 2776 | 2701 | } |
| 2777 | 2702 | echo $result; |
@@ -3000,12 +2925,10 @@ discard block |
||
| 3000 | 2925 | |
| 3001 | 2926 | $response = __( 'Direct payment link has been send', 'wpshop' ); |
| 3002 | 2927 | $status = true; |
| 3003 | - } |
|
| 3004 | - else { |
|
| 2928 | + } else { |
|
| 3005 | 2929 | $response = __( 'An error was occured', 'wpshop' ); |
| 3006 | 2930 | } |
| 3007 | - } |
|
| 3008 | - else { |
|
| 2931 | + } else { |
|
| 3009 | 2932 | $response = __( 'An error was occured, no Order ID defined', 'wpshop' ); |
| 3010 | 2933 | } |
| 3011 | 2934 | echo json_encode( array( 'status' => $status, 'response' => $response) ); |
@@ -3092,8 +3015,7 @@ discard block |
||
| 3092 | 3015 | $wpdb->insert( WPSHOP_DBT_ATTRIBUTE_VALUES_DECIMAL, array_merge( $common_datas, array( 'attribute_id' => 28, 'value' => $ht ) ) ); |
| 3093 | 3016 | $wpdb->insert( WPSHOP_DBT_ATTRIBUTE_VALUES_INTEGER, array_merge( $common_datas, array( 'attribute_id' => 29, 'value' => $the_tax->rate_id ) ) ); |
| 3094 | 3017 | $wpdb->insert( WPSHOP_DBT_ATTRIBUTE_VALUES_DECIMAL, array_merge( $common_datas, array( 'attribute_id' => 30, 'value' => $tax_amount ) ) ); |
| 3095 | - } |
|
| 3096 | - else { |
|
| 3018 | + } else { |
|
| 3097 | 3019 | $common_datas = array( |
| 3098 | 3020 | 'value_id' => null, |
| 3099 | 3021 | 'entity_type_id' => 5, |
@@ -3261,8 +3183,7 @@ discard block |
||
| 3261 | 3183 | if( !empty($element_definition['content'][$att]) ) { |
| 3262 | 3184 | $formatted_datas[$element_id]['content'][$att] = $element_definition['content'][$att]; |
| 3263 | 3185 | $controller_rows_array[ $att ] = true; |
| 3264 | - } |
|
| 3265 | - else { |
|
| 3186 | + } else { |
|
| 3266 | 3187 | $formatted_datas[$element_id]['content'][$att] = array(); |
| 3267 | 3188 | } |
| 3268 | 3189 | } |
@@ -3292,8 +3213,7 @@ discard block |
||
| 3292 | 3213 | if( $current_attribute->data_type_to_use == 'internal' ) { |
| 3293 | 3214 | $current_val = get_the_title($current_val); |
| 3294 | 3215 | $old_val = get_the_title($old_val); |
| 3295 | - } |
|
| 3296 | - else { |
|
| 3216 | + } else { |
|
| 3297 | 3217 | $query = $wpdb->prepare( 'SELECT label FROM '.WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS.' WHERE id=%d', $old_val); |
| 3298 | 3218 | $old_val = $wpdb->get_var( $query ); |
| 3299 | 3219 | $query = $wpdb->prepare( 'SELECT label FROM '.WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS.' WHERE id=%d', $current_val); |
@@ -3348,12 +3268,10 @@ discard block |
||
| 3348 | 3268 | update_option( WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES . '_' . $cat_id, $category_option ); |
| 3349 | 3269 | $response = '<img src="' .WPSHOP_DEFAULT_CATEGORY_PICTURE. '" alt="No picture" class="category_thumbnail_preview"/>'; |
| 3350 | 3270 | $status = true; |
| 3351 | - } |
|
| 3352 | - else { |
|
| 3271 | + } else { |
|
| 3353 | 3272 | $response = __( 'Category options are not defined', 'wpshop'); |
| 3354 | 3273 | } |
| 3355 | - } |
|
| 3356 | - else { |
|
| 3274 | + } else { |
|
| 3357 | 3275 | $response = __( 'Category ID is not defined', 'wpshop'); |
| 3358 | 3276 | } |
| 3359 | 3277 | echo json_encode( array( 'status' => $status, 'response' => $response) ); |
@@ -3385,8 +3303,7 @@ discard block |
||
| 3385 | 3303 | if ( $attributeSetSectionCreation == 'done' ) { |
| 3386 | 3304 | $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_SUCCES_ICON . '\' alt=\'action_success\' class=\'wpshopPageMessage_Icon\' />' . __('New section has been created successfully', 'wpshop'); |
| 3387 | 3305 | $more_script = 'wpshop_go_to("#attribute_group_'.$wpdb->insert_id.'")'; |
| 3388 | - } |
|
| 3389 | - else { |
|
| 3306 | + } else { |
|
| 3390 | 3307 | $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_ERROR_ICON . '\' alt=\'action_error\' class=\'wpshopPageMessage_Icon\' />' . __('An error occured while saving new section', 'wpshop'); |
| 3391 | 3308 | } |
| 3392 | 3309 | |
@@ -3414,10 +3331,11 @@ discard block |
||
| 3414 | 3331 | $attributeSetInfos['backend_display_type'] = $backend_display_type; |
| 3415 | 3332 | $attributeSetInfos['display_on_frontend'] = $display_on_frontend; |
| 3416 | 3333 | $attributeSetSectionCreation = wpshop_database::update($attributeSetInfos, $attributeSetSectionId, WPSHOP_DBT_ATTRIBUTE_GROUP); |
| 3417 | - if ( $attributeSetSectionCreation == 'done' ) |
|
| 3418 | - $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_SUCCES_ICON . '\' alt=\'action_success\' class=\'wpshopPageMessage_Icon\' />' . __('The section has been updated successfully', 'wpshop'); |
|
| 3419 | - else |
|
| 3420 | - $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_ERROR_ICON . '\' alt=\'action_error\' class=\'wpshopPageMessage_Icon\' />' . __('An error occured while updating the section', 'wpshop'); |
|
| 3334 | + if ( $attributeSetSectionCreation == 'done' ) { |
|
| 3335 | + $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_SUCCES_ICON . '\' alt=\'action_success\' class=\'wpshopPageMessage_Icon\' />' . __('The section has been updated successfully', 'wpshop'); |
|
| 3336 | + } else { |
|
| 3337 | + $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_ERROR_ICON . '\' alt=\'action_error\' class=\'wpshopPageMessage_Icon\' />' . __('An error occured while updating the section', 'wpshop'); |
|
| 3338 | + } |
|
| 3421 | 3339 | echo wpshop_attributes_set::attributeSetDetailsManagement($elementIdentifier) . '<script type="text/javascript" >wpshopShowMessage("' . $attributeSetSectionCreation_Result . '");hideShowMessage(5000);</script>'; |
| 3422 | 3340 | wp_die(); |
| 3423 | 3341 | } |
@@ -3437,9 +3355,9 @@ discard block |
||
| 3437 | 3355 | if ( $attributeSetSectionCreation == 'done' ) { |
| 3438 | 3356 | $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_SUCCES_ICON . '\' alt=\'action_success\' class=\'wpshopPageMessage_Icon\' />' . __('The section has been successfully been deleted', 'wpshop'); |
| 3439 | 3357 | $more_script.='jQuery("#attribute_group_'.$attributeSetSectionId.'").remove();'; |
| 3358 | + } else { |
|
| 3359 | + $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_ERROR_ICON . '\' alt=\'action_error\' class=\'wpshopPageMessage_Icon\' />' . __('An error occured while deleting the section', 'wpshop'); |
|
| 3440 | 3360 | } |
| 3441 | - else |
|
| 3442 | - $attributeSetSectionCreation_Result = '<img src=\'' . WPSHOP_ERROR_ICON . '\' alt=\'action_error\' class=\'wpshopPageMessage_Icon\' />' . __('An error occured while deleting the section', 'wpshop'); |
|
| 3443 | 3361 | echo '<script type="text/javascript" >wpshopShowMessage("' . $attributeSetSectionCreation_Result . '");hideShowMessage(5000);'.$more_script.'</script>'; |
| 3444 | 3362 | wp_die(); |
| 3445 | 3363 | } |
@@ -3505,8 +3423,7 @@ discard block |
||
| 3505 | 3423 | if($save_unit_result == 'done'){ |
| 3506 | 3424 | $save_output = wpshop_attributes_unit::elementList(); |
| 3507 | 3425 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action successful" src="' . WPSHOP_SUCCES_ICON . '" />' . __('The new unit has been saved succesfully', 'wpshop'); |
| 3508 | - } |
|
| 3509 | - else{ |
|
| 3426 | + } else{ |
|
| 3510 | 3427 | $save_output = wpshop_attributes_unit::elementEdition(); |
| 3511 | 3428 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action error" src="' . WPSHOP_ERROR_ICON . '" />' . __('An error occured during new unit saving', 'wpshop'); |
| 3512 | 3429 | } |
@@ -3542,8 +3459,7 @@ discard block |
||
| 3542 | 3459 | if ( $save_unit_result == 'done' ) { |
| 3543 | 3460 | $save_output = wpshop_attributes_unit::elementList(); |
| 3544 | 3461 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action successful" src="' . WPSHOP_SUCCES_ICON . '" />' . __('The unit has been saved succesfully', 'wpshop'); |
| 3545 | - } |
|
| 3546 | - else { |
|
| 3462 | + } else { |
|
| 3547 | 3463 | $save_output = wpshop_attributes_unit::elementEdition($attributeUnitId); |
| 3548 | 3464 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action error" src="' . WPSHOP_ERROR_ICON . '" />' . __('An error occured during unit saving', 'wpshop'); |
| 3549 | 3465 | } |
@@ -3563,8 +3479,7 @@ discard block |
||
| 3563 | 3479 | $save_unit_result = wpshop_database::update($attribute_unit_informations, $unit_id, WPSHOP_DBT_ATTRIBUTE_UNIT); |
| 3564 | 3480 | if ( $save_unit_result == 'done' ) { |
| 3565 | 3481 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action succesful" src="' . WPSHOP_SUCCES_ICON . '" />' . __('The unit has been deleted succesfully', 'wpshop'); |
| 3566 | - } |
|
| 3567 | - else { |
|
| 3482 | + } else { |
|
| 3568 | 3483 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action error" src="' . WPSHOP_ERROR_ICON . '" />' . __('An error occured during unit deletion', 'wpshop'); |
| 3569 | 3484 | } |
| 3570 | 3485 | |
@@ -3606,8 +3521,7 @@ discard block |
||
| 3606 | 3521 | if($save_unit_result == 'done'){ |
| 3607 | 3522 | $save_output = wpshop_attributes_unit::unit_group_list(); |
| 3608 | 3523 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action successful" src="' . WPSHOP_SUCCES_ICON . '" />' . __('The new unit group has been saved succesfully', 'wpshop'); |
| 3609 | - } |
|
| 3610 | - else{ |
|
| 3524 | + } else{ |
|
| 3611 | 3525 | $save_output = wpshop_attributes_unit::unit_group_edition(); |
| 3612 | 3526 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action error" src="' . WPSHOP_ERROR_ICON . '" />' . __('An error occured during new unit group saving', 'wpshop'); |
| 3613 | 3527 | } |
@@ -3630,8 +3544,7 @@ discard block |
||
| 3630 | 3544 | if($save_unit_result == 'done'){ |
| 3631 | 3545 | $save_output = wpshop_attributes_unit::unit_group_list(); |
| 3632 | 3546 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action successful" src="' . WPSHOP_SUCCES_ICON . '" />' . __('The unit group has been saved succesfully', 'wpshop'); |
| 3633 | - } |
|
| 3634 | - else{ |
|
| 3547 | + } else{ |
|
| 3635 | 3548 | $save_output = wpshop_attributes_unit::unit_group_edition($attributeUnitId); |
| 3636 | 3549 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action error" src="' . WPSHOP_ERROR_ICON . '" />' . __('An error occured during unit group saving', 'wpshop'); |
| 3637 | 3550 | } |
@@ -3651,8 +3564,7 @@ discard block |
||
| 3651 | 3564 | $save_unit_result = wpshop_database::update($attribute_unit_informations, $unit_id, WPSHOP_DBT_ATTRIBUTE_UNIT_GROUP); |
| 3652 | 3565 | if($save_unit_result == 'done'){ |
| 3653 | 3566 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action succesful" src="' . WPSHOP_SUCCES_ICON . '" />' . __('The unit group has been deleted succesfully', 'wpshop'); |
| 3654 | - } |
|
| 3655 | - else{ |
|
| 3567 | + } else{ |
|
| 3656 | 3568 | $save_message = '<img class="wpshopPageMessage_Icon" alt="action error" src="' . WPSHOP_ERROR_ICON . '" />' . __('An error occured during unit group deletion', 'wpshop'); |
| 3657 | 3569 | } |
| 3658 | 3570 | |
@@ -3681,7 +3593,9 @@ discard block |
||
| 3681 | 3593 | $data = wpshop_products::wpshop_get_product_by_criteria( $criteria, $cid, $products_id, $display_type, $order, $page_number, $products_per_page ); |
| 3682 | 3594 | if($data[0]) { |
| 3683 | 3595 | echo json_encode(array(true, do_shortcode($data[1]))); |
| 3684 | - } else echo json_encode(array(false,__('No product found','wpshop'))); |
|
| 3596 | + } else { |
|
| 3597 | + echo json_encode(array(false,__('No product found','wpshop'))); |
|
| 3598 | + } |
|
| 3685 | 3599 | wp_die(); |
| 3686 | 3600 | } |
| 3687 | 3601 | add_action( 'wp_ajax_wps_products_by_criteria', 'products_by_criteria' ); |
@@ -3708,10 +3622,10 @@ discard block |
||
| 3708 | 3622 | if (!empty($user_info->user_email)) { |
| 3709 | 3623 | $wps_message_ctr->wpshop_email($user_info->user_email, $title, $message, $save=true, $model_id=$post_id, $object=array()); |
| 3710 | 3624 | $array = array('result' => true, 'message' => ''); |
| 3625 | + } else { |
|
| 3626 | + $array = array('result' => true, 'message' => __('An error occured','wpshop')); |
|
| 3711 | 3627 | } |
| 3712 | - else $array = array('result' => true, 'message' => __('An error occured','wpshop')); |
|
| 3713 | - } |
|
| 3714 | - else { |
|
| 3628 | + } else { |
|
| 3715 | 3629 | $array = array('result' => false, 'message' => __('An error occured','wpshop')); |
| 3716 | 3630 | } |
| 3717 | 3631 | |
@@ -3740,12 +3654,10 @@ discard block |
||
| 3740 | 3654 | $wps_message_ctr->wpshop_email($data['mess_user_email'], $data['mess_title'], $data['mess_message'], $save=false, $object=array()); |
| 3741 | 3655 | |
| 3742 | 3656 | $array = array('result' => true, 'message' => ''); |
| 3743 | - } |
|
| 3744 | - else { |
|
| 3657 | + } else { |
|
| 3745 | 3658 | $array = array('result' => false, 'message' => __('An error occured','wpshop')); |
| 3746 | 3659 | } |
| 3747 | - } |
|
| 3748 | - else { |
|
| 3660 | + } else { |
|
| 3749 | 3661 | $array = array('result' => false, 'message' => __('An error occured','wpshop')); |
| 3750 | 3662 | } |
| 3751 | 3663 | |
@@ -3777,7 +3689,9 @@ discard block |
||
| 3777 | 3689 | $order = $wps_cart_ctr->calcul_cart_information(array()); |
| 3778 | 3690 | $wps_cart_ctr->store_cart_in_session($order); |
| 3779 | 3691 | echo json_encode(array(true, '')); |
| 3780 | - } else echo json_encode(array(false, $result['message'])); |
|
| 3692 | + } else { |
|
| 3693 | + echo json_encode(array(false, $result['message'])); |
|
| 3694 | + } |
|
| 3781 | 3695 | wp_die(); |
| 3782 | 3696 | } |
| 3783 | 3697 | add_action( 'wp_ajax_wps_cart_action_apply_coupon', 'applyCoupon' ); |