- File:
-
- 1 edited
-
woo-bulk-editor/trunk/ext/bulk/bulk.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
woo-bulk-editor/trunk/ext/bulk/bulk.php
r2844667 r2970262 1 1 <?php 2 2 if (!defined('ABSPATH')) { 3 3 exit; // Exit if accessed directly 4 4 } 5 5 6 6 final class WOOBE_BULK extends WOOBE_EXT { 7 7 8 8 protected $slug = 'bulk'; //unique 9 9 public $text_keys = array(); 10 10 public $num_keys = array(); 11 11 public $other_keys = array(); 12 12 13 13 public function __construct() { 14 14 15 15 $this->init_bulk_keys(); 16 16 17 17 add_action('woobe_ext_scripts', array($this, 'woobe_ext_scripts'), 1); 18 18 add_action('woobe_tools_panel_buttons_end', array($this, 'woobe_tools_panel_buttons_end'), 1); 19 19 20 20 //ajax 21 21 add_action('wp_ajax_woobe_bulk_products_count', array($this, 'woobe_bulk_products_count'), 1); 22 22 add_action('wp_ajax_woobe_bulk_products', array($this, 'woobe_bulk_products'), 1); 23 23 add_action('wp_ajax_woobe_bulk_finish', array($this, 'woobe_bulk_finish'), 1); 24 24 add_action('wp_ajax_woobe_bulk_draw_gallery_btn', array($this, 'woobe_bulk_draw_gallery_btn'), 1); 25 25 add_action('wp_ajax_woobe_bulk_draw_download_files_btn', array($this, 'woobe_bulk_draw_download_files_btn'), 1); 26 26 add_action('wp_ajax_woobe_bulk_draw_cross_sells_btn', array($this, 'woobe_bulk_draw_cross_sells_btn'), 1); 27 27 add_action('wp_ajax_woobe_bulk_draw_upsell_ids_btn', array($this, 'woobe_bulk_draw_upsell_ids_btn'), 1); 28 28 add_action('wp_ajax_woobe_bulk_draw_grouped_ids_btn', array($this, 'woobe_bulk_draw_grouped_ids_btn'), 1); 29 29 add_action('wp_ajax_woobe_bulk_get_att_terms', array($this, 'woobe_bulk_get_att_terms'), 1); 30 30 31 31 add_action('wp_ajax_woobe_bulk_delete_products_count', array($this, 'woobe_bulk_delete_products_count'), 1); 32 32 add_action('wp_ajax_woobe_bulk_delete_products', array($this, 'woobe_bulk_delete_products'), 1); 33 33 34 34 add_action('woobe_bulk_going', array($this, 'woobe_bulk_going'), 10, 2); 35 35 36 36 //tabs 37 37 $this->add_tab($this->slug, 'top_panel', esc_html__('Bulk Edit', 'woo-bulk-editor'), 'pencil'); 38 38 add_action('woobe_ext_top_panel_' . $this->slug, array($this, 'woobe_ext_panel'), 1); 39 39 } 40 40 41 41 public function woobe_ext_scripts() { 42 42 wp_enqueue_script('woobe_ext_' . $this->slug, $this->get_ext_link() . 'assets/js/' . $this->slug . '.js', array(), WOOBE_VERSION); 43 43 wp_enqueue_style('woobe_ext_' . $this->slug, $this->get_ext_link() . 'assets/css/' . $this->slug . '.css', array(), WOOBE_VERSION); 44 44 ?> 45 45 <script> 46 46 lang.<?php echo $this->slug ?> = {}; 47 47 lang.<?php echo $this->slug ?>.want_to_bulk = "<?php echo esc_html__('Will be edited next:', 'woo-bulk-editor') ?>"; 48 48 lang.<?php echo $this->slug ?>.want_to_delete = "<?php echo esc_html__('Sure? Delete products?', 'woo-bulk-editor') ?>"; 49 49 lang.<?php echo $this->slug ?>.deleting = "<?php echo esc_html__('Bulk deleting', 'woo-bulk-editor') ?>"; 50 50 lang.<?php echo $this->slug ?>.deleted = "<?php echo esc_html__('Product(s) deleted!', 'woo-bulk-editor') ?>"; 51 51 lang.<?php echo $this->slug ?>.bulking = "<?php echo esc_html__('Bulk editing', 'woo-bulk-editor') ?> ..."; 52 52 lang.<?php echo $this->slug ?>.bulked = "<?php echo esc_html__('Product(s) edited! Table redrawing ...', 'woo-bulk-editor') ?>"; 53 53 lang.<?php echo $this->slug ?>.bulked2 = "<?php echo esc_html__('Product(s) edited!', 'woo-bulk-editor') ?>"; 54 54 lang.<?php echo $this->slug ?>.bulk_is_going = "<?php echo esc_html__('ATTENTION: Bulk operation is going!', 'woo-bulk-editor') ?>"; 55 55 </script> 56 56 <?php 57 57 } 58 58 59 59 public function woobe_tools_panel_buttons_end() { 60 60 global $WOOBE; 61 61 ?> 62 62 | <span> 63 63 <?php echo WOOBE_HELPER::draw_advanced_switcher(0, 'woobe_bind_editing', '', array('true' => esc_html__('binded editing', 'woo-bulk-editor'), 'false' => esc_html__('binded editing', 'woo-bulk-editor')), array('true' => 1, 'false' => 0), 'js_check_woobe_bind_editing', 'woobe_bind_editing'); ?> 64 64 65 65 <?php 66 66 $bind_tooltip = ''; 67 67 if ($WOOBE->show_notes) { 68 68 $fields = $WOOBE->settings->get_fields(); 69 69 if (!empty($fields)) { 70 70 $bind_tooltip = []; 71 71 foreach ($fields as $field_key => $f) { 72 72 if ($f['direct']) { 73 73 $t = strip_tags($f['title']); 74 74 if (!empty($t) AND $field_key != 'ID') { 75 75 $bind_tooltip[] = $t; 76 76 } 77 77 } 78 78 } 79 79 80 80 $bind_tooltip = sprintf(esc_html__('In FREE version of the plugin you can change only next fields: %s', 'woo-bulk-editor'), implode(', ', $bind_tooltip)); 81 81 } 82 82 } 83 83 ?> 84 84 85 85 <?php echo WOOBE_HELPER::draw_tooltip(esc_html__('In this mode to the all selected products will be set the value of a product field which been edited', 'woo-bulk-editor') . '. ' . $bind_tooltip) ?> 86 86 87 87 </span> 88 88 <?php 89 89 } 90 90 91 91 public function woobe_ext_panel() { 92 92 $data = array(); 93 93 $data['shop_manager_visibility'] = $this->settings->get_shop_manager_visibility(); 94 94 $data['text_keys'] = $this->text_keys; 95 95 $data['num_keys'] = $this->num_keys; 96 96 $data['other_keys'] = $this->other_keys; 97 97 $data['settings_fields'] = $this->settings->get_fields(); 98 98 echo WOOBE_HELPER::render_html($this->get_ext_path() . 'views/panel.php', $data); 99 99 } 100 100 101 101 //ajax 102 102 public function woobe_bulk_products_count() { 103 103 if (!current_user_can('manage_woocommerce')) { 104 104 die('0'); 105 105 } 106 106 107 if (!isset($_REQUEST['bulk_form_nonce']) || !wp_verify_nonce($_REQUEST['bulk_form_nonce'], 'woobe_bulk_form_nonce')) { 108 die('0'); 109 } 107 110 //*** 108 111 109 112 $bulk_data = array(); 110 113 111 114 if (!isset($_REQUEST['woobe_bind_editing'])) { 112 115 parse_str($_REQUEST['bulk_data'], $bulk_data); 113 116 114 117 $bulk_data = WOOBE_HELPER::sanitize_array($bulk_data); 115 118 } else { 116 119 //binded editing operation works 117 120 if (is_array($_REQUEST['val'])) { 118 121 $value = WOOBE_HELPER::sanitize_array($_REQUEST['val']); 119 122 } else { 120 123 $value = wp_kses($_REQUEST['val'], wp_kses_allowed_html('post')); 121 124 $value = str_replace("&", "&", $value); 122 125 } 123 126 124 127 125 128 $field_key = sanitize_text_field($_REQUEST['field']); 126 129 127 130 //*** 128 131 129 132 $bulk_data['woobe_bulk'] = array( 130 133 'is' => array( 131 134 $field_key => 1 132 135 ), 133 136 $field_key => array( 134 137 'value' => $value, 135 138 'behavior' => sanitize_text_field($_REQUEST['behavior']) 136 139 ) 137 140 ); 138 141 } 139 142 140 143 141 144 $this->storage->set_val('woobe_bulk_' . WOOBE_HELPER::sanitize_bulk_key($_REQUEST['bulk_key']), $bulk_data['woobe_bulk']); 142 145 143 146 if (!isset($_REQUEST['no_filter'])) { 144 147 //get count of filtered - doesn work if bulk for checked products 145 148 $products = $this->products->gets(array( 146 149 'fields' => 'ids', 147 150 'no_found_rows' => true 148 151 )); 149 152 echo json_encode($products->posts); 150 153 } 151 154 152 155 //*** 153 156 154 157 do_action('woobe_bulk_started', WOOBE_HELPER::sanitize_bulk_key($_REQUEST['bulk_key'])); 155 158 156 159 exit; 157 160 } 158 161 159 162 public function woobe_bulk_delete_products_count() { 160 163 if (!current_user_can('manage_woocommerce')) { 161 164 die('0'); 162 165 } 163 166 if (!isset($_REQUEST['bulk_form_nonce']) || !wp_verify_nonce($_REQUEST['bulk_form_nonce'], 'woobe_bulk_form_nonce')) { 167 die('0'); 168 } 164 169 $bulk_data = array(); 165 170 166 171 if (!isset($_REQUEST['woobe_bind_editing'])) { 167 172 parse_str($_REQUEST['bulk_data'], $bulk_data); 168 173 $bulk_data = WOOBE_HELPER::sanitize_array($bulk_data); 169 174 } else { 170 175 //binded editing operation works 171 176 if (is_array($_REQUEST['val'])) { 172 177 $value = WOOBE_HELPER::sanitize_array($_REQUEST['val']); 173 178 } else { 174 179 $value = wp_kses($_REQUEST['val'], wp_kses_allowed_html('post')); 175 180 } 176 181 177 182 $field_key = sanitize_text_field($_REQUEST['field']); 178 183 179 184 //*** 180 185 181 186 $bulk_data['woobe_bulk'] = array( 182 187 'is' => array( 183 188 $field_key => 1 184 189 ), 185 190 $field_key => array( 186 191 'value' => $value, 187 192 'behavior' => sanitize_text_field($_REQUEST['behavior']) 188 193 ) 189 194 ); 190 195 } 191 196 192 197 193 198 $this->storage->set_val('woobe_bulk_' . WOOBE_HELPER::sanitize_bulk_key($_REQUEST['bulk_key']), $bulk_data['woobe_bulk']); 194 199 195 200 if (!isset($_REQUEST['no_filter'])) { 196 201 //get count of filtered - doesn work if bulk for checked products 197 202 $products = $this->products->gets(array( 198 203 'fields' => 'ids', 199 204 'no_found_rows' => true 200 205 )); 201 206 echo json_encode($products->posts); 202 207 } 203 208 204 209 exit; 205 210 } 206 211 207 212 public function woobe_bulk_delete_products() { 208 213 if (!current_user_can('manage_woocommerce')) { 209 214 die('0'); 210 215 } 211 216 if (!isset($_REQUEST['products_ids'])) { 212 217 die('0'); 213 218 } 219 220 if (!isset($_REQUEST['bulk_form_nonce']) || !wp_verify_nonce($_REQUEST['bulk_form_nonce'], 'woobe_bulk_form_nonce')) { 221 die('0'); 222 } 214 223 215 224 if (is_array($_REQUEST['products_ids'])) { 216 225 $is_variations_solo = intval($_REQUEST['woobe_show_variations']); 217 226 218 227 $products_ids = array_map(function ($item) { 219 228 return intval($item); //sanitize intval 220 229 }, $_REQUEST['products_ids']); 221 230 222 231 //as we want to change variations only but have ids of parents - lets get variations ids 223 232 if ($is_variations_solo AND!empty($products_ids)) { 224 233 $vars_ids = array(); 225 234 foreach ($products_ids as $product_id) { 226 235 $product = $this->products->get_product($product_id); 227 236 if ($product->is_type('variable')) { 228 237 $children = $product->get_children(); 229 238 if (!empty($children)) { 230 239 $vars_ids = array_merge($vars_ids, $children); 231 240 } 232 241 } 233 242 } 234 243 $products_ids = array_unique(array_merge($products_ids, $vars_ids)); 235 244 } 236 245 $woobe_bulk = $this->storage->get_val('woobe_bulk_' . WOOBE_HELPER::sanitize_bulk_key($_REQUEST['bulk_key'])); 237 246 238 247 foreach ($products_ids as $id) { 239 248 if ($is_variations_solo) { 240 249 241 250 //lets check that currenct variation has the same attributes combination 242 251 if (isset($woobe_bulk['combination_attributes']) AND!empty($woobe_bulk['combination_attributes'])) { 243 252 244 253 $variation = $this->products->get_product($id); 245 254 $attributes = $variation->get_attributes(); 246 255 247 256 //*** 248 257 249 258 $go = FALSE; 250 259 251 260 //*** 252 261 253 262 if (!empty($attributes)) { 254 263 foreach ($woobe_bulk['combination_attributes'] as $comb) { 255 264 //lets look is $attributes the same set of attributes as in $comb 256 265 $ak_att = array_keys($attributes); 257 266 $ak_cv = array_keys($comb); 258 267 259 268 //fix for non-latin symbols 260 269 if (!empty($ak_att)) { 261 270 $ak_att = array_map('urldecode', $ak_att); 262 271 } 263 272 264 273 //fix for non-latin symbols 265 274 if (!empty($ak_cv)) { 266 275 $ak_cv = array_map('urldecode', $ak_cv); 267 276 } 268 277 269 278 sort($ak_att); 270 279 sort($ak_cv); 271 280 272 281 if ($ak_att === $ak_cv) { 273 $av_att = array_values($attributes); 274 $av_cv = array_values($comb); 282 283 $new_attributes = $attributes; 284 $new_comb = $comb; 285 if (in_array('-1',$comb)){ 286 $delete_keys = array_keys($comb, '-1',); 287 288 foreach ($delete_keys as $d_key) { 289 if (isset($new_attributes[$d_key])) { 290 unset($new_attributes[$d_key]); 291 unset($new_comb[$d_key]); 292 } 293 } 294 295 } 296 297 $av_att = array_values($new_attributes); 298 $av_cv = array_values($new_comb); 275 299 276 300 //fix for non-latin symbols 277 301 if (!empty($ak_att)) { 278 302 $av_att = array_map('urldecode', $av_att); 279 303 } 280 304 281 305 282 306 if (!empty($av_cv)) { 283 307 $av_cv = array_map('urldecode', $av_cv); 284 308 } 285 309 286 310 sort($av_att); 287 311 sort($av_cv); 312 288 313 if ($av_att === $av_cv) { 289 314 $go = TRUE; 290 315 break; 291 316 } 292 317 } 293 318 } 294 319 } 295 320 296 321 //*** 297 322 298 323 if (!$go) { 299 324 continue; 300 325 } 301 326 } 302 327 } 303 328 //wp_delete_post($id,false); 304 329 wp_trash_post(intval($id)); 305 330 } 306 331 } else { 307 332 die('0'); 308 333 } 309 334 310 335 die(json_encode($_REQUEST['products_ids'])); 311 336 exit; 312 337 } 313 338 314 339 //ajax 315 340 public function woobe_bulk_products() { 316 341 if (!current_user_can('manage_woocommerce')) { 317 342 die('0'); 318 343 } 319 344 320 345 if (!isset($_REQUEST['products_ids'])) { 321 346 die('0'); 322 347 } 323 348 if (!isset($_REQUEST['bulk_form_nonce']) || !wp_verify_nonce($_REQUEST['bulk_form_nonce'], 'woobe_bulk_form_nonce')) { 349 die('0'); 350 } 324 351 //*** 325 352 326 353 $fields = $this->settings->get_fields(); 327 354 $woobe_bulk = $this->storage->get_val('woobe_bulk_' . WOOBE_HELPER::sanitize_bulk_key($_REQUEST['bulk_key'])); 328 355 //key for history bulk opearation, not related to products keys 329 356 $_REQUEST['woobe_bulk_key'] = WOOBE_HELPER::sanitize_bulk_key($_REQUEST['bulk_key']); 330 357 331 358 $is_variations_solo = intval($_REQUEST['woobe_show_variations']); 332 359 $products_ids = $_REQUEST['products_ids']; //sanitize in cycle below 333 360 //*** 334 361 //as we want to change variations only but have ids of parents - lets get variations ids 335 362 if ($is_variations_solo AND!empty($products_ids)) { 336 363 $vars_ids = array(); 337 364 foreach ($products_ids as $product_id) { 338 365 $product_id = intval($product_id); //sanitize 339 366 340 367 $product = $this->products->get_product($product_id); 341 368 if ($product->is_type('variable')) { 342 369 $children = $product->get_children(); 343 370 if (!empty($children)) { 344 371 $vars_ids = array_merge($vars_ids, $children); 345 372 } 346 373 } 347 374 } 348 375 349 376 $products_ids = array_unique(array_merge($products_ids, $vars_ids)); 350 377 } 351 378 352 379 //*** 353 380 354 381 if (isset($woobe_bulk['is']) AND!empty($woobe_bulk['is']) AND!empty($products_ids)) { 355 382 356 383 //*** 357 384 358 385 foreach ($woobe_bulk['is'] as $field_key => $is) { 359 386 360 387 if ($fields[$field_key]['edit_view'] === 'calendar') { 361 388 362 389 363 390 if (!is_int($woobe_bulk[$field_key]['value']) AND (isset($fields[$field_key]["field_type"]) AND $fields[$field_key]["field_type"] == "meta")) { 364 391 $woobe_bulk[$field_key]['value'] = strtotime($woobe_bulk[$field_key]['value']); // - wrong way 365 392 } else { 366 393 $woobe_bulk[$field_key]['value'] = $this->products->normalize_calendar_date($woobe_bulk[$field_key]['value'], $field_key); 367 394 } 368 395 } 369 396 370 397 //*** 371 398 //speedfix 372 399 wp_defer_term_counting(false); 373 400 wp_defer_comment_counting(true); 374 401 375 402 //*** 376 403 377 404 if (intval($is) === 1) { 378 405 379 406 foreach ($products_ids as $product_id) { 380 407 381 408 if ($is_variations_solo) { 382 409 //if enabled editing of variations only parent-products are ignored 383 410 $product = $this->products->get_product($product_id); 384 411 if (!$product->is_type('variation')) { 385 412 continue; 386 413 } 387 414 388 415 //lets check that currenct variation has the same attributes combination 389 416 if (isset($woobe_bulk['combination_attributes']) AND!empty($woobe_bulk['combination_attributes'])) { 390 417 391 418 $variation = $this->products->get_product($product_id); 392 419 $attributes = $variation->get_attributes(); 393 420 394 421 //*** 395 422 396 423 $go = FALSE; 397 424 398 425 //*** 399 426 400 427 if (!empty($attributes)) { 401 428 foreach ($woobe_bulk['combination_attributes'] as $comb) { 402 429 //lets look is $attributes the same set of attributes as in $comb 403 430 $ak_att = array_keys($attributes); 404 431 $ak_cv = array_keys($comb); 405 432 406 433 //fix for non-latin symbols 407 434 if (!empty($ak_att)) { 408 435 $ak_att = array_map('urldecode', $ak_att); 409 436 } 410 437 411 438 //fix for non-latin symbols 412 439 if (!empty($ak_cv)) { 413 440 $ak_cv = array_map('urldecode', $ak_cv); 414 441 } 415 442 416 443 sort($ak_att); 417 444 sort($ak_cv); 418 445 419 446 if ($ak_att === $ak_cv) { 420 447 $new_attributes = $attributes; 421 448 $new_comb = $comb; 422 449 if (in_array('-1',$comb)){ 423 450 $delete_keys = array_keys($comb, '-1',); 424 451 425 452 foreach ($delete_keys as $d_key) { 426 453 if (isset($new_attributes[$d_key])) { 427 454 unset($new_attributes[$d_key]); 428 455 unset($new_comb[$d_key]); 429 456 } 430 457 } 431 458 432 459 } 433 460 434 461 $av_att = array_values($new_attributes); 435 462 $av_cv = array_values($new_comb); 436 463 437 464 //fix for non-latin symbols 438 465 if (!empty($ak_att)) { 439 466 $av_att = array_map('urldecode', $av_att); 440 467 } 441 468 442 469 if (!empty($av_cv)) { 443 470 $av_cv = array_map('urldecode', $av_cv); 444 471 } 445 472 446 473 sort($av_att); 447 474 sort($av_cv); 448 475 if ($av_att === $av_cv) { 449 476 $go = TRUE; 450 477 break; 451 478 } 452 479 } 453 480 } 454 481 } 455 482 456 483 //*** 457 484 458 485 if (!$go) { 459 486 continue; 460 487 } 461 488 } 462 489 } 463 490 464 491 //*** 465 492 466 493 467 494 switch ($field_key) { 468 495 case 'post_title': 469 496 case 'post_content': 470 497 case 'post_excerpt': 471 498 case 'post_name': 472 499 case 'purchase_note': 473 500 case 'sku': 474 501 case 'tax_class': 475 502 case 'backorders': 476 503 case 'sold_individually': 477 504 case 'reviews_allowed': 478 505 case 'product_url': 479 506 case 'button_text': 480 507 $this->_process_text_data($woobe_bulk, $field_key, $product_id); 481 508 break; 482 509 483 510 case 'post_status': 484 511 case 'stock_status': 485 512 case 'manage_stock': 486 513 case 'tax_status': 487 514 case 'catalog_visibility': 488 515 case 'product_type': 489 516 case 'featured': 490 517 case 'virtual': 491 518 case 'downloadable': 492 519 case 'download_files': 493 520 case 'gallery': 494 521 case 'upsell_ids': 495 522 case 'cross_sell_ids': 496 523 case 'grouped_ids': 497 524 case 'post_date': 498 525 if (intval($woobe_bulk[$field_key]['value']) !== -1) { 499 526 $this->products->update_page_field($product_id, $field_key, $woobe_bulk[$field_key]['value']); 500 527 } 501 528 break; 502 529 case 'attribute_visibility': 503 530 504 531 if (!isset($woobe_bulk[$field_key]['value']) OR!is_array($woobe_bulk[$field_key]['value'])) { 505 532 506 533 $woobe_bulk[$field_key]['value'] = array(); 507 534 } 508 535 if (!isset($woobe_bulk[$field_key]['visible'])) { 509 536 $woobe_bulk[$field_key]['visible'] = 1; 510 537 } 511 538 $this->products->set_product_attributes_visible($product_id, $woobe_bulk[$field_key]['value'], $woobe_bulk[$field_key]['visible']); 512 539 513 540 break; 514 541 case 'regular_price': 515 542 case 'sale_price': 516 543 case 'stock_quantity': 517 544 case 'download_expiry': 518 545 case 'download_limit': 519 546 case 'date_on_sale_from': 520 547 case 'date_on_sale_to': 521 548 case 'weight': 522 549 case 'length': 523 550 case 'width': 524 551 case 'height': 525 552 case 'product_shipping_class': 526 553 case 'menu_order': 527 554 case 'post_author': 528 555 case 'total_sales': 529 556 case 'review_count': 530 557 case 'average_rating': 531 558 $this->_process_number_data($woobe_bulk, $field_key, $product_id); 532 559 break; 533 560 534 561 default: 535 562 break; 536 563 } 537 564 538 565 //*** 539 566 540 567 if (isset($fields[$field_key]) AND $fields[$field_key]['field_type'] === 'taxonomy') { 541 568 //if (!empty($woobe_bulk[$field_key]['value'])) { 542 569 do_action('woobe_before_update_page_field', $field_key, $product_id, 0); //for the History 543 570 if (!isset($woobe_bulk[$field_key]['behavior'])) { 544 571 $woobe_bulk[$field_key]['behavior'] = ""; 545 572 } 546 573 switch ($woobe_bulk[$field_key]['behavior']) { 547 574 case 'append': 548 575 if (is_taxonomy_hierarchical($field_key)) { 549 576 wp_set_post_terms($product_id, $woobe_bulk[$field_key]['value'], $field_key, true); 550 577 } else { 551 578 //product_tag for example 552 579 foreach ($woobe_bulk[$field_key]['value'] as $term_id) { 553 580 $t = get_term_by('id', $term_id, $field_key); 554 581 wp_set_post_terms($product_id, $t->slug, $field_key, true); 555 582 } 556 583 } 557 584 break; 558 585 case 'replace': 559 586 case 'new': 560 587 if (is_taxonomy_hierarchical($field_key)) { 561 588 wp_set_post_terms($product_id, $woobe_bulk[$field_key]['value'], $field_key, false); 562 589 } else { 563 590 //product_tag for example 564 591 $append = false; //clean previous by first one then append 565 592 if (!empty($woobe_bulk[$field_key]['value']) AND is_array($woobe_bulk[$field_key]['value'])) { 566 593 foreach ($woobe_bulk[$field_key]['value'] as $term_id) { 567 594 $t = get_term_by('id', $term_id, $field_key); 568 595 wp_set_post_terms($product_id, $t->slug, $field_key, $append); 569 596 $append = true; 570 597 } 571 598 } 572 599 } 573 600 break; 574 601 case 'remove': 575 602 foreach ($woobe_bulk[$field_key]['value'] as $term_id) { 576 603 $t = get_term_by('id', $term_id, $field_key); 577 604 wp_remove_object_terms($product_id, $t->slug, $field_key); 578 605 } 579 606 break; 580 607 } 581 608 //} 582 609 } 583 610 584 611 //*** 585 612 586 613 if (isset($fields[$field_key]) AND $fields[$field_key]['field_type'] === 'attribute') { 587 614 if (!isset($woobe_bulk[$field_key]['value'])) { 588 615 $woobe_bulk[$field_key]['value'] = ''; 589 616 } 590 617 do_action('woobe_before_update_page_field', $field_key, $product_id, 0); //for the History 591 618 $this->products->set_product_attributes($product_id, $field_key, $woobe_bulk[$field_key]['value'], $woobe_bulk[$field_key]['behavior']); 592 619 } 593 620 594 621 //*** 595 622 596 623 if (isset($fields[$field_key]) AND $fields[$field_key]['field_type'] === 'meta') { 597 624 switch ($fields[$field_key]['type']) { 598 625 case 'string': 599 626 600 627 //if data is serialized in ine string 601 628 if ($fields[$field_key]['edit_view'] == 'meta_popup_editor') { 602 629 if (!is_array($woobe_bulk[$field_key]['value'])) { 603 630 604 631 //if not else parsed 605 632 parse_str($woobe_bulk[$field_key]['value'], $meta_val); 606 633 607 634 $woobe_bulk[$field_key]['value'] = $this->products->process_jsoned_meta_data($meta_val); 608 635 } 609 636 } 610 637 //*** 611 638 if ($fields[$field_key]['edit_view'] == 'gallery_popup_editor') { 612 639 613 640 if (!is_array($woobe_bulk[$field_key]['value'])) { 614 641 //if not else parsed 615 642 parse_str($woobe_bulk[$field_key]['value'], $meta_val); 616 643 if (!empty($meta_val['woobe_gallery_images'])) { 617 644 $woobe_bulk[$field_key]['value'] = $meta_val; 618 645 } 619 646 } 620 647 621 648 } 622 649 //*** 623 650 624 651 if ($fields[$field_key]['edit_view'] !== 'switcher') { 625 652 $this->_process_text_data($woobe_bulk, $field_key, $product_id); 626 653 } else { 627 654 if (intval($woobe_bulk[$field_key]['value']) !== -1) { 628 655 $this->products->update_page_field($product_id, $field_key, intval($woobe_bulk[$field_key]['value'])); 629 656 } 630 657 } 631 658 break; 632 659 633 660 case 'number': 634 661 $this->_process_number_data($woobe_bulk, $field_key, $product_id); 635 662 break; 636 663 637 664 default: 638 665 break; 639 666 } 640 667 } 641 668 } 642 669 } 643 670 } 644 671 645 672 do_action('woobe_bulk_going', sanitize_text_field($_REQUEST['woobe_bulk_key']), count($products_ids)); 646 673 } 647 674 648 675 649 676 650 677 die('done'); 651 678 } 652 679 653 680 public function woobe_bulk_going($bulk_key, $products_count) { 654 681 $count_key = 'woobe_bulk_' . strtolower($bulk_key) . '_count'; 655 682 $count_now = intval($this->storage->get_val($count_key)); 656 683 $this->storage->set_val($count_key, $products_count + $count_now); 657 684 } 658 685 659 686 private function _process_text_data($woobe_bulk, $field_key, $product_id) { 660 687 //if (!empty($woobe_bulk[$field_key]['value'])) { 661 688 $val = $this->products->get_post_field($product_id, $field_key); 662 689 $woobe_bulk[$field_key]['value'] = $this->products->string_macros($woobe_bulk[$field_key]['value'], $field_key, $product_id); 663 690 switch ($woobe_bulk[$field_key]['behavior']) { 664 691 case 'append': 665 692 $val = $this->products->string_replacer($val . $woobe_bulk[$field_key]['value'], $product_id); 666 693 break; 667 694 case 'prepend': 668 695 $val = $this->products->string_replacer($woobe_bulk[$field_key]['value'] . $val, $product_id); 669 696 break; 670 697 case 'new': 671 698 $val = $this->products->string_replacer($woobe_bulk[$field_key]['value'], $product_id); 672 699 break; 673 700 case 'replace': 674 701 $replace_to = $this->products->string_replacer($woobe_bulk[$field_key]['replace_to'], $product_id); 675 702 $replace_from = $this->products->string_replacer($woobe_bulk[$field_key]['value'], $product_id); 676 703 677 704 //fix for apostrophe 678 705 $replace_from = str_replace("\'", "'", $replace_from); 679 706 680 707 if ($woobe_bulk[$field_key]['case'] == 'ignore') { 681 708 $val = str_ireplace($replace_from, $replace_to, $val); 682 709 } else { 683 710 $val = str_replace($replace_from, $replace_to, $val); 684 711 /* 685 712 * https://stackoverflow.com/questions/19317493/php-preg-replace-case-insensitive-match-with-case-sensitive-replacement 686 713 $val = preg_replace_callback('/\b' . $replace_from . '\b/i', function($matches) use ($replace_to) { 687 714 $i = 0; 688 715 return join('', array_map(function($char) use ($matches, &$i) { 689 716 return ctype_lower($matches[0][$i++]) ? strtolower($char) : strtoupper($char); 690 717 }, str_split($replace_to))); 691 718 }, $val); 692 719 * 693 720 */ 694 721 } 695 722 696 723 break; 697 724 } 698 725 699 726 //*** 700 727 $empty_exceptions = array('tax_class'); //setting empty values is possible with this fields 701 728 702 729 $can = true; //!empty($val); 703 730 704 731 if (in_array($field_key, $empty_exceptions)) { 705 732 $can = true; 706 733 } 707 734 708 735 if ($can) { 709 736 710 737 $val = $this->products->update_page_field($product_id, $field_key, $val); 711 738 } 712 739 //} 713 740 } 714 741 715 742 private function _process_number_data($woobe_bulk, $field_key, $product_id) { 716 743 if ($woobe_bulk[$field_key]['behavior'] != 'new') { 717 744 $val = floatval($this->products->get_post_field($product_id, $field_key)); 718 745 } 719 746 720 747 //*** 721 748 722 749 switch ($woobe_bulk[$field_key]['behavior']) { 723 750 case 'new': 724 751 $val = floatval($woobe_bulk[$field_key]['value']); 725 752 break; 726 753 727 754 case 'invalue': 728 755 $val += floatval($woobe_bulk[$field_key]['value']); 729 756 break; 730 757 731 758 case 'devalue': 732 759 $val -= floatval($woobe_bulk[$field_key]['value']); 733 760 break; 734 761 735 762 case 'inpercent': 736 763 $val = $val + $val * floatval($woobe_bulk[$field_key]['value']) / 100; 737 764 break; 738 765 739 766 case 'depercent': 740 767 $val = $val - $val * floatval($woobe_bulk[$field_key]['value']) / 100; 741 768 break; 742 769 743 770 case 'devalue_regular_price': 744 771 //for sale_price only 745 $val = $this->products->get_post_field($product_id, 'regular_price') - floatval($woobe_bulk[$field_key]['value']);772 $val = floatval($this->products->get_post_field($product_id, 'regular_price')) - floatval($woobe_bulk[$field_key]['value']); 746 773 break; 747 774 748 775 case 'depercent_regular_price': 749 776 //for sale_price only 750 $val = $this->products->get_post_field($product_id, 'regular_price');777 $val = floatval($this->products->get_post_field($product_id, 'regular_price')); 751 778 $val = $val - $val * floatval($woobe_bulk[$field_key]['value']) / 100; 752 779 break; 753 780 754 781 case 'invalue_sale_price': 755 782 //for regular_price only 756 $val = $this->products->get_post_field($product_id, 'sale_price') + floatval($woobe_bulk[$field_key]['value']);783 $val = floatval($this->products->get_post_field($product_id, 'sale_price') + floatval($woobe_bulk[$field_key]['value'])); 757 784 break; 758 785 759 786 case 'inpercent_sale_price': 760 787 //for regular_price only 761 $val = $this->products->get_post_field($product_id, 'sale_price');788 $val = floatval($this->products->get_post_field($product_id, 'sale_price')); 762 789 $val = $val + $val * floatval($woobe_bulk[$field_key]['value']) / 100; 763 790 break; 764 791 } 765 792 766 793 if (isset($_REQUEST['num_formula_action']) AND isset($_REQUEST['num_formula_value']) AND $_REQUEST['num_formula_value'] != '-1') { 767 794 $v_key = esc_textarea($_REQUEST['num_formula_value']); 768 795 $action = esc_textarea($_REQUEST['num_formula_action']); 769 796 $v_data = floatval(get_post_meta($product_id, $v_key, true)); 770 797 771 798 switch ($action) { 772 799 case '-': 773 800 $val = $val - $v_data; 774 801 break; 775 802 case '*': 776 803 $val = $val * $v_data; 777 804 break; 778 805 case '/': 779 806 if ($v_data == 0) { 780 807 $v_data = 1; 781 808 } 782 809 $val = $val / $v_data; 783 810 break; 784 811 785 812 default: 786 813 $val = $val + $v_data; 787 814 break; 788 815 } 789 816 } 790 817 791 818 if (isset($_REQUEST['num_rand_data']) && is_array($_REQUEST['num_rand_data'])) { 792 819 $rand_data = wc_clean($_REQUEST['num_rand_data']); 793 820 if (isset($rand_data['from']) && isset($rand_data['to']) && ($rand_data['from'] != $rand_data['to']) && ($rand_data['from'] < $rand_data['to'])) { 794 821 $from = (float)$rand_data['from']; 795 822 $to = (float)$rand_data['to']; 796 823 $decimal = 1; 797 824 if (isset($rand_data['decimal'])) { 798 825 $decimal = (int)$rand_data['decimal']; 799 826 } 800 827 $action = '+'; 801 828 if (isset($rand_data['action'])) { 802 829 $action = $rand_data['action']; 803 830 } 804 831 805 832 $rand_val = rand($from * $decimal, $to * $decimal)/$decimal; 806 833 switch ($action) { 807 834 case '-': 808 835 $val = $val - $rand_val; 809 836 break; 810 837 case '*': 811 838 $val = $val * $rand_val; 812 839 break; 813 840 case '/': 814 841 if ($rand_val == 0) { 815 842 $rand_val = 1; 816 843 } 817 844 $val = $val / $rand_val; 818 845 break; 819 846 820 847 default: 821 848 $val = $val + $rand_val; 822 849 break; 823 850 } 824 851 825 852 } 826 853 } 827 854 828 855 //*** 829 856 830 857 $convert = TRUE; 831 858 if ($field_key == 'sale_price') { 832 859 //sale price CAN NOT be more OR even equal to the regular price 833 860 if ($val >= $this->products->get_post_field($product_id, 'regular_price')) { 834 861 $convert = FALSE; 835 862 } 836 863 //to delete sale price 837 864 if ($val <= 0) { 838 865 $val = -1; 839 866 $val = $this->products->update_page_field($product_id, $field_key, $val); 840 867 $convert = FALSE; 841 868 } 842 869 } 843 870 844 871 //*** 845 872 846 873 if ($convert) { 847 874 $val = $this->products->update_page_field($product_id, $field_key, floatval($val)); 848 875 } 849 876 } 850 877 851 878 public function woobe_bulk_finish() { 852 879 do_action('woobe_bulk_finished', WOOBE_HELPER::sanitize_bulk_key($_REQUEST['bulk_key'])); 853 880 $count_key = 'woobe_bulk_' . WOOBE_HELPER::sanitize_bulk_key($_REQUEST['bulk_key']) . '_count'; 854 881 die($this->storage->get_val($count_key) . ''); 855 882 } 856 883 857 884 private function init_bulk_keys() { 858 885 859 886 $fields = woobe_get_fields(); 860 887 861 888 $this->text_keys = array( 862 889 'post_title' => array( 863 890 'title' => esc_html__('title', 'woo-bulk-editor'), 864 891 'css_classes' => isset($fields['post_title']['css_classes']) ? $fields['post_title']['css_classes'] : '' 865 892 ), 866 893 'post_content' => array( 867 894 'title' => esc_html__('description', 'woo-bulk-editor'), 868 895 'css_classes' => isset($fields['post_content']['css_classes']) ? $fields['post_content']['css_classes'] : '' 869 896 ), 870 897 'post_excerpt' => array( 871 898 'title' => esc_html__('short description', 'woo-bulk-editor'), 872 899 'css_classes' => isset($fields['post_excerpt']['css_classes']) ? $fields['post_excerpt']['css_classes'] : '' 873 900 ), 874 901 'post_name' => array( 875 902 'title' => esc_html__('product slug', 'woo-bulk-editor'), 876 903 'css_classes' => isset($fields['post_name']['css_classes']) ? $fields['post_name']['css_classes'] : '' 877 904 ), 878 905 'sku' => array( 879 906 'title' => esc_html__('SKU', 'woo-bulk-editor'), 880 907 'css_classes' => isset($fields['sku']['css_classes']) ? $fields['sku']['css_classes'] : '' 881 908 ) 882 909 ); 883 910 884 911 $this->other_keys = array( 885 912 'post_status' => array( 886 913 'title' => esc_html__('post status', 'woo-bulk-editor'), 887 914 'options' => $fields['post_status']['select_options'], 888 915 'direct' => $fields['post_status']['direct'], 889 916 'css_classes' => isset($fields['post_status']['css_classes']) ? $fields['post_status']['css_classes'] : '' 890 917 ), 891 918 'stock_status' => array( 892 919 'title' => esc_html__('stock status', 'woo-bulk-editor'), 893 920 'options' => $fields['stock_status']['select_options'], 894 921 'direct' => $fields['stock_status']['direct'], 895 922 'css_classes' => isset($fields['stock_status']['css_classes']) ? $fields['stock_status']['css_classes'] : '' 896 923 ), 897 924 'tax_status' => array( 898 925 'title' => esc_html__('tax status', 'woo-bulk-editor'), 899 926 'options' => $fields['tax_status']['select_options'], 900 927 'direct' => $fields['tax_status']['direct'], 901 928 'css_classes' => isset($fields['tax_status']['css_classes']) ? $fields['tax_status']['css_classes'] : '' 902 929 ), 903 930 'catalog_visibility' => array( 904 931 'title' => esc_html__('catalog visibility', 'woo-bulk-editor'), 905 932 'options' => $fields['catalog_visibility']['select_options'], 906 933 'direct' => $fields['catalog_visibility']['direct'], 907 934 'css_classes' => isset($fields['catalog_visibility']['css_classes']) ? $fields['catalog_visibility']['css_classes'] : '' 908 935 ), 909 936 'product_type' => array( 910 937 'title' => esc_html__('product type', 'woo-bulk-editor'), 911 938 'options' => $fields['product_type']['select_options'], 912 939 'direct' => $fields['product_type']['direct'], 913 940 'css_classes' => isset($fields['product_type']['css_classes']) ? $fields['product_type']['css_classes'] : '' 914 941 ), 915 942 'featured' => array( 916 943 'title' => esc_html__('featured', 'woo-bulk-editor'), 917 944 'options' => $fields['featured']['select_options'], 918 945 'direct' => $fields['featured']['direct'], 919 946 'css_classes' => isset($fields['featured']['css_classes']) ? $fields['featured']['css_classes'] : '' 920 947 ), 921 948 ); 922 949 //*** 923 950 924 951 $options1 = array( 925 952 'invalue' => esc_html__('increase by value', 'woo-bulk-editor'), 926 953 'devalue' => esc_html__('decrease by value', 'woo-bulk-editor'), 927 954 'inpercent' => esc_html__('increase by %', 'woo-bulk-editor'), 928 955 'depercent' => esc_html__('decrease by %', 'woo-bulk-editor'), 929 956 'new' => esc_html__('set new', 'woo-bulk-editor') 930 957 ); 931 958 932 959 $options2 = array( 933 960 'invalue' => esc_html__('increase by value', 'woo-bulk-editor'), 934 961 'devalue' => esc_html__('decrease by value', 'woo-bulk-editor'), 935 962 'delete' => esc_html__('delete', 'woo-bulk-editor'), 936 963 'new' => esc_html__('set new', 'woo-bulk-editor') 937 964 ); 938 965 939 966 //*** 940 967 941 968 $this->num_keys = array( 942 969 'regular_price' => array( 943 970 'title' => esc_html__('regular price', 'woo-bulk-editor'), 944 971 'direct' => $fields['regular_price']['direct'], 945 972 'options' => array( 946 973 'invalue' => esc_html__('increase by value', 'woo-bulk-editor'), 947 974 'devalue' => esc_html__('decrease by value', 'woo-bulk-editor'), 948 975 'inpercent' => esc_html__('increase by %', 'woo-bulk-editor'), 949 976 'depercent' => esc_html__('decrease by %', 'woo-bulk-editor'), 950 977 'inpercent_sale_price' => esc_html__('sale price plus %', 'woo-bulk-editor'), 951 978 'invalue_sale_price' => esc_html__('sale price plus value', 'woo-bulk-editor'), 952 979 'new' => esc_html__('set new', 'woo-bulk-editor') 953 980 ), 954 981 'css_classes' => isset($fields['regular_price']['css_classes']) ? $fields['regular_price']['css_classes'] : '' 955 982 ), 956 983 'sale_price' => array( 957 984 'title' => esc_html__('sale price', 'woo-bulk-editor'), 958 985 'direct' => $fields['sale_price']['direct'], 959 986 'options' => array( 960 987 'invalue' => esc_html__('increase by value', 'woo-bulk-editor'), 961 988 'devalue' => esc_html__('decrease by value', 'woo-bulk-editor'), 962 989 'inpercent' => esc_html__('increase by %', 'woo-bulk-editor'), 963 990 'depercent' => esc_html__('decrease by %', 'woo-bulk-editor'), 964 991 'depercent_regular_price' => esc_html__('regular price minus %', 'woo-bulk-editor'), 965 992 'devalue_regular_price' => esc_html__('regular price minus value', 'woo-bulk-editor'), 966 993 'new' => esc_html__('set new', 'woo-bulk-editor') 967 994 ), 968 995 'css_classes' => isset($fields['sale_price']['css_classes']) ? $fields['sale_price']['css_classes'] : '' 969 996 ), 970 997 'stock_quantity' => array( 971 998 'title' => esc_html__('in stock quantity', 'woo-bulk-editor'), 972 999 'direct' => $fields['stock_quantity']['direct'], 973 1000 'options' => $options2, 974 1001 'css_classes' => isset($fields['stock_quantity']['css_classes']) ? $fields['stock_quantity']['css_classes'] : '' 975 1002 ), 976 1003 'download_expiry' => array( 977 1004 'title' => esc_html__('download expiry', 'woo-bulk-editor'), 978 1005 'direct' => $fields['download_expiry']['direct'], 979 1006 'options' => $options2, 980 1007 'css_classes' => isset($fields['download_expiry']['css_classes']) ? $fields['download_expiry']['css_classes'] : '' 981 1008 ), 982 1009 'download_limit' => array( 983 1010 'title' => esc_html__('download limit', 'woo-bulk-editor'), 984 1011 'direct' => $fields['download_limit']['direct'], 985 1012 'options' => $options2, 986 1013 'css_classes' => isset($fields['download_limit']['css_classes']) ? $fields['download_limit']['css_classes'] : '' 987 1014 ) 988 1015 ); 989 1016 } 990 1017 991 1018 //ajax 992 1019 public function woobe_bulk_draw_gallery_btn() { 993 1020 $images = []; 994 1021 parse_str($_REQUEST['images'], $images); //sanitize below in array_map 995 1022 $data = array(); 996 1023 $woobe_gallery_images = isset($images['woobe_gallery_images']) ? $images['woobe_gallery_images'] : array(); 997 1024 //sanitizing to intval 998 1025 $woobe_gallery_images = array_map(function ($item) { 999 1026 return intval($item); //sanitize intval 1000 1027 }, $woobe_gallery_images); 1001 1028 1002 1029 $data['html'] = WOOBE_HELPER::draw_gallery_popup_editor_btn(sanitize_text_field($_REQUEST['field']), 0, $woobe_gallery_images); 1003 1030 $data['images_ids'] = implode(',', $woobe_gallery_images); //for any case, but now we not need it because updating of products applies by serialized data 1004 1031 1005 1032 1006 1033 die(json_encode($data)); 1007 1034 } 1008 1035 1009 1036 //ajax 1010 1037 public function woobe_bulk_draw_download_files_btn() { 1011 1038 $files = []; 1012 1039 parse_str($_REQUEST['files'], $files); 1013 1040 $files = WOOBE_HELPER::sanitize_array($files); 1014 1041 $count = 0; 1015 1042 1016 1043 if (isset($files['_wc_file_names'])) { 1017 1044 $count = count($files['_wc_file_names']); 1018 1045 } 1019 1046 1020 1047 echo WOOBE_HELPER::draw_downloads_popup_editor_btn(sanitize_text_field($_REQUEST['field']), 0, $count); 1021 1048 1022 1049 exit; 1023 1050 } 1024 1051 1025 1052 //ajax 1026 1053 public function woobe_bulk_draw_cross_sells_btn() { 1027 1054 $products = []; 1028 1055 parse_str($_REQUEST['products'], $products); 1029 1056 1030 1057 $ids = array(); 1031 1058 if (isset($products['woobe_prod_ids'])) { 1032 1059 $ids = $products['woobe_prod_ids']; 1033 1060 } 1034 1061 1035 1062 $ids = array_map(function ($item) { 1036 1063 return intval($item); //sanitize intval 1037 1064 }, $ids); 1038 1065 1039 1066 echo WOOBE_HELPER::draw_cross_sells_popup_editor_btn(sanitize_text_field($_REQUEST['field']), 0, $ids); 1040 1067 1041 1068 exit; 1042 1069 } 1043 1070 1044 1071 //ajax 1045 1072 public function woobe_bulk_draw_upsell_ids_btn() { 1046 1073 $products = []; 1047 1074 parse_str($_REQUEST['products'], $products); 1048 1075 1049 1076 $ids = array(); 1050 1077 if (isset($products['woobe_prod_ids'])) { 1051 1078 $ids = array_map(function ($item) { 1052 1079 return intval($item); //sanitize intval 1053 1080 }, $products['woobe_prod_ids']); 1054 1081 } 1055 1082 1056 1083 echo WOOBE_HELPER::draw_upsells_popup_editor_btn($_REQUEST['field'], 0, $ids); 1057 1084 1058 1085 exit; 1059 1086 } 1060 1087 1061 1088 //ajax 1062 1089 public function woobe_bulk_draw_grouped_ids_btn() { 1063 1090 $products = []; 1064 1091 parse_str($_REQUEST['products'], $products); //sanitize below 1065 1092 1066 1093 $ids = array(); 1067 1094 if (isset($products['woobe_prod_ids'])) { 1068 1095 $ids = array_map(function ($item) { 1069 1096 return intval($item); //sanitize intval 1070 1097 }, $products['woobe_prod_ids']); 1071 1098 } 1072 1099 1073 1100 echo WOOBE_HELPER::draw_grouped_popup_editor_btn(sanitize_text_field($_REQUEST['field']), 0, $ids); 1074 1101 1075 1102 exit; 1076 1103 } 1077 1104 1078 1105 //ajax 1079 1106 public function woobe_bulk_get_att_terms() { 1080 1107 1081 1108 $drop_downs = ''; 1082 1109 if (!empty($_REQUEST['attributes'])) { 1083 1110 foreach ($_REQUEST['attributes'] as $pa) { 1084 1111 $pa = sanitize_text_field($pa); //sanitize attribute name 1085 1112 1086 1113 $terms = WOOBE_HELPER::get_taxonomies_terms_hierarchy($pa); 1087 1114 if (!empty($terms)) { 1088 1115 $options = array(); 1089 1116 $options[''] = esc_html__('not selected', 'woo-bulk-editor'); 1090 1117 $options['-1'] = esc_html__('Any', 'woo-bulk-editor'); 1091 1118 foreach ($terms as $t) { 1092 1119 $options[$t['slug']] = $t['name']; 1093 1120 } 1094 1121 1095 1122 $drop_downs .= WOOBE_HELPER::draw_select(array( 1096 1123 'field' => 0, 1097 1124 'product_id' => 0, 1098 1125 'class' => '', 1099 1126 'options' => $options, 1100 1127 'name' => 'woobe_bulk[combination_attributes][' . sanitize_text_field($_REQUEST['hash_key']) . '][' . $pa . ']' 1101 1128 )); 1102 1129 } 1103 1130 } 1104 1131 } 1105 1132 1106 1133 die($drop_downs); 1107 1134 } 1108 1135 1109 1136 }
Note: See TracChangeset
for help on using the changeset viewer.