Changeset 3278737
- Timestamp:
- 04/22/2025 07:18:59 AM (12 months ago)
- Location:
- gift-pack-for-woocommerce/trunk
- Files:
-
- 10 edited
-
README.txt (modified) (2 diffs)
-
admin/class-gift-pack-for-woocommerce-admin.php (modified) (2 diffs)
-
admin/js/gift-pack-for-woocommerce-admin.js (modified) (3 diffs)
-
admin/partials/gift-pack-for-woocommerce-admin-display.php (modified) (6 diffs)
-
gift-pack-for-woocommerce.php (modified) (2 diffs)
-
includes/class-gift-pack-for-woocommerce.php (modified) (3 diffs)
-
public/class-gift-pack-for-woocommerce-public.php (modified) (1 diff)
-
public/js/gift-pack-for-woocommerce-public.js (modified) (5 diffs)
-
public/partials/gift-pack-data-in-order.php (modified) (2 diffs)
-
public/partials/gift-pack-html.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gift-pack-for-woocommerce/trunk/README.txt
r3246471 r3278737 1 1 === Gift Pack for Woocommerce === 2 Contributors: itpathsolutions, mayur8991, shailu25, thakordarshil, jaiminp 2 Contributors: itpathsolutions, mayur8991, shailu25, thakordarshil, jaiminp, hirenbhanderi 3 3 Tags: woocommmerce,gift pack,gift wrapper,wordpress gift pack,gift wrap,gift 4 4 Donate link: https://www.itpathsolutions.com 5 5 Requires at least: 6.0 6 Tested up to: 6. 76 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 2.0. 18 Stable tag: 2.0.2 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 99 99 == Changelog == 100 100 101 = 2.0.2 = 102 103 *Release Date 22 April 2025* 104 105 * Compatibility - Ensured compatibility with the latest WordPress version 6.8 106 * Improvement - Removed the default character limit validation for the Gift Pack Note 107 101 108 = 2.0.1 = 102 109 -
gift-pack-for-woocommerce/trunk/admin/class-gift-pack-for-woocommerce-admin.php
r3246471 r3278737 515 515 } 516 516 517 if (function_exists('icl_object_id') && $this->current_language) { 518 519 $option_name = 'gpfw_gift_pack_message_text_to' . $this->current_language; 520 $existing_value = get_option($option_name); 521 522 if (!$existing_value) { 523 foreach (icl_get_languages('skip_missing=0') as $language) { 524 $lang_code = $language['language_code']; 525 $option_name = 'gpfw_gift_pack_message_text_to' . $lang_code; 526 527 if (isset($_POST['gpfw_gift_pack_message_text_to'])) { 528 $updated_gift_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text_to']); 529 update_option($option_name, $updated_gift_message_text); 530 } 531 } 532 } else { 533 $updated_gift_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text_to']); 534 update_option('gpfw_gift_pack_message_text_to' . $this->current_language, $updated_gift_message_text); 535 } 536 } else { 537 if (isset($_POST['gpfw_gift_pack_message_text_to'])) { 538 $updated_gift_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text_to']); 539 update_option('gpfw_gift_pack_message_text_to', $updated_gift_message_text); 540 } 541 } 542 543 if (function_exists('icl_object_id') && $this->current_language) { 544 $option_name = 'gpfw_gift_pack_message_text_from' . $this->current_language; 545 $existing_value = get_option($option_name); 546 547 if (!$existing_value) { 548 foreach (icl_get_languages('skip_missing=0') as $language) { 549 $lang_code = $language['language_code']; 550 $option_name = 'gpfw_gift_pack_message_text_from' . $lang_code; 551 552 if (isset($_POST['gpfw_gift_pack_message_text_from'])) { 553 $updated_gift_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text_from']); 554 update_option($option_name, $updated_gift_message_text); 555 } 556 } 557 } else { 558 $updated_gift_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text_from']); 559 update_option('gpfw_gift_pack_message_text_from' . $this->current_language, $updated_gift_message_text); 560 } 561 } else { 562 if (isset($_POST['gpfw_gift_pack_message_text_from'])) { 563 $updated_gift_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text_from']); 564 update_option('gpfw_gift_pack_message_text_from', $updated_gift_message_text); 565 } 566 } 567 517 568 // Set Gift Pack Image Label Text 518 569 … … 596 647 } 597 648 } 598 649 650 if (function_exists('icl_object_id') && $this->current_language) { 651 652 $option_name = 'gpfw_gift_pack_to_placeholder' . $this->current_language; 653 $existing_value = get_option($option_name); 654 if (!$existing_value) { 655 foreach (icl_get_languages('skip_missing=0') as $language) { 656 $lang_code = $language['language_code']; 657 $option_name = 'gpfw_gift_pack_to_placeholder' . $lang_code; 658 659 if (isset($_POST['gpfw_gift_pack_to_placeholder'])) { 660 $updated_gift_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_to_placeholder']); 661 update_option($option_name, $updated_gift_note_placeholder); 662 } 663 } 664 } else { 665 $updated_gift_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_to_placeholder']); 666 update_option('gpfw_gift_pack_to_placeholder' . $this->current_language, $updated_gift_note_placeholder); 667 } 668 } else { 669 if (isset($_POST['gpfw_gift_pack_to_placeholder'])) { 670 $updated_gift_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_to_placeholder']); 671 update_option('gpfw_gift_pack_to_placeholder', $updated_gift_note_placeholder); 672 } 673 } 674 675 if (function_exists('icl_object_id') && $this->current_language) { 676 677 $option_name = 'gpfw_gift_pack_from_placeholder' . $this->current_language; 678 $existing_value = get_option($option_name); 679 if (!$existing_value) { 680 foreach (icl_get_languages('skip_missing=0') as $language) { 681 $lang_code = $language['language_code']; 682 $option_name = 'gpfw_gift_pack_from_placeholder' . $lang_code; 683 684 if (isset($_POST['gpfw_gift_pack_from_placeholder'])) { 685 $updated_gift_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_from_placeholder']); 686 update_option($option_name, $updated_gift_note_placeholder); 687 } 688 } 689 } else { 690 $updated_gift_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_from_placeholder']); 691 update_option('gpfw_gift_pack_from_placeholder' . $this->current_language, $updated_gift_note_placeholder); 692 } 693 } else { 694 if (isset($_POST['gpfw_gift_pack_from_placeholder'])) { 695 $updated_gift_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_from_placeholder']); 696 update_option('gpfw_gift_pack_from_placeholder', $updated_gift_note_placeholder); 697 } 698 } 699 700 599 701 // Add Gift Pack Image 600 702 if (function_exists('icl_object_id') && $this->current_language) { -
gift-pack-for-woocommerce/trunk/admin/js/gift-pack-for-woocommerce-admin.js
r3246471 r3278737 53 53 if (jQuery(this).is(':checked')) { 54 54 jQuery('#gpfw_gift_pack_to_require').closest('.global_price_value').hide(); 55 jQuery('#gpfw_gift_pack_message_text_to').closest('.global_price_value').hide(); 56 jQuery('#gpfw_gift_pack_to_placeholder').closest('.global_price_value').hide(); 55 57 } else { 56 58 jQuery('#gpfw_gift_pack_to_require').closest('.global_price_value').show(); 59 jQuery('#gpfw_gift_pack_message_text_to').closest('.global_price_value').show(); 60 jQuery('#gpfw_gift_pack_to_placeholder').closest('.global_price_value').show(); 57 61 } 58 62 }); … … 61 65 if (jQuery(this).is(':checked')) { 62 66 jQuery('#gpfw_gift_pack_from_require').closest('.global_price_value').hide(); 67 jQuery('#gpfw_gift_pack_message_text_from').closest('.global_price_value').hide(); 68 jQuery('#gpfw_gift_pack_from_placeholder').closest('.global_price_value').hide(); 63 69 } else { 64 70 jQuery('#gpfw_gift_pack_from_require').closest('.global_price_value').show(); 71 jQuery('#gpfw_gift_pack_message_text_from').closest('.global_price_value').show(); 72 jQuery('#gpfw_gift_pack_from_placeholder').closest('.global_price_value').show(); 65 73 } 66 74 }); … … 70 78 jQuery('#gpfw_gift_pack_note_require').closest('.global_price_value').hide(); 71 79 jQuery('#gpfw_enable_gift_pack_note_limit').closest('.global_price_value').hide(); 80 jQuery('#gpfw_gift_pack_message_text').closest('.global_price_value').hide(); 81 jQuery('#gpfw_gift_pack_note_placeholder').closest('.global_price_value').hide(); 82 72 83 } else { 73 84 jQuery('#gpfw_gift_pack_note_require').closest('.global_price_value').show(); 74 85 jQuery('#gpfw_enable_gift_pack_note_limit').closest('.global_price_value').show(); 86 jQuery('#gpfw_gift_pack_message_text').closest('.global_price_value').show(); 87 jQuery('#gpfw_gift_pack_note_placeholder').closest('.global_price_value').show(); 75 88 } 76 89 }); -
gift-pack-for-woocommerce/trunk/admin/partials/gift-pack-for-woocommerce-admin-display.php
r3246471 r3278737 114 114 </div> 115 115 116 <!--Gift Pack Greeting Label-->117 <?php118 $current_language = apply_filters('wpml_current_language', NULL);119 if ($current_language) {120 $gpfw_gift_pack_message_text_option_name = 'gpfw_gift_pack_message_text' . $current_language;121 122 if (isset($_POST['gpfw_gift_pack_message_text'])) {123 $updated_gift_wrap_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text']);124 update_option($gpfw_gift_pack_message_text_option_name, $updated_gift_wrap_message_text);125 }126 127 $gpfw_gift_pack_message_text = get_option($gpfw_gift_pack_message_text_option_name);128 } else {129 $gpfw_gift_pack_message_text = get_option('gpfw_gift_pack_message_text');130 }131 ?>132 <div class="global_price_value">133 <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Greeting Label:', 'gift-pack-for-woocommerce'); ?><br />134 <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small>135 </div>136 <div class="gpfw_gift_value">137 <input type="text" name="gpfw_gift_pack_message_text" id="gpfw_gift_price" value="<?php echo esc_attr($gpfw_gift_pack_message_text); ?>" placeholder="<?php esc_html_e("Enter your Greeting", "gift-pack-for-woocommerce"); ?>">138 </div>139 </div>140 116 141 117 <!--Gift Pack Images Label--> … … 187 163 </div> 188 164 </div> 189 190 191 <!--Placeholder Texts for Greeting Message-->192 <?php $current_language = apply_filters('wpml_current_language', NULL);193 if ($current_language) {194 $gift_price_option_name = 'gpfw_gift_pack_note_placeholder' . $current_language;195 196 if (isset($_POST['gpfw_gift_pack_note_placeholder'])) {197 $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_pack_note_placeholder']);198 update_option($gift_price_option_name, $updated_gift_price);199 }200 201 $gpfw_gift_pack_note_placeholder = get_option($gift_price_option_name);202 } else {203 $gpfw_gift_pack_note_placeholder = get_option('gpfw_gift_pack_note_placeholder');204 }205 $current_language = apply_filters('wpml_current_language', NULL);206 if ($current_language) {207 $gpfw_gift_pack_note_placeholder = 'gpfw_gift_pack_note_placeholder' . $current_language;208 if (isset($_POST['gpfw_gift_pack_note_placeholder'])) {209 $updated_gift_pack_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_note_placeholder']);210 update_option($gpfw_gift_pack_note_placeholder, $updated_gift_pack_note_placeholder);211 }212 $gpfw_gift_pack_note_placeholder = get_option($gpfw_gift_pack_note_placeholder);213 } ?>214 <div class="global_price_value">215 <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Placeholder Texts for Greeting Message:', 'gift-pack-for-woocommerce'); ?><br />216 <small><?php esc_html_e('Used in Product Details', 'gift-pack-for-woocommerce'); ?></small>217 </div>218 <div class="gpfw_gift_value">219 <input type="text" name="gpfw_gift_pack_note_placeholder" id="gpfw_gift_price" value="<?php echo esc_attr($gpfw_gift_pack_note_placeholder); ?>" placeholder="<?php esc_html_e("Placeholder Texts for Greeting Message", "gift-pack-for-woocommerce"); ?>">220 </div>221 </div>222 223 165 <!--Gift Wrap Label--> 224 166 <?php … … 367 309 </label> 368 310 </div> 369 <div class="global_price_value">370 <div class="global_price_title backend_field_title"><?php esc_html_e('Disable Gift Pack (From):','gift-pack-for-woocommerce');?></div>371 <label class="global_price_meta">372 <input type="checkbox" name="gpfw_disable_gift_pack_from" id="gpfw_disable_gift_pack_from" value="1" <?php if($gpfw_options['gpfw_disable_gift_pack_from']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>>373 <span class="slider round"></span>374 </label>375 </div>376 <div class="global_price_value">377 <div class="global_price_title backend_field_title"><?php esc_html_e('Disable Gift Pack (Note):','gift-pack-for-woocommerce');?></div>378 <label class="global_price_meta">379 <input type="checkbox" name="gpfw_disable_gift_pack_note" id="gpfw_disable_gift_pack_note" value="1" <?php if($gpfw_options['gpfw_disable_gift_pack_note']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>>380 <span class="slider round"></span>381 </label>382 </div>383 384 311 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_to']) ? 'none' : ''; ?>"> 385 312 <div class="global_price_title backend_field_title"><?php esc_html_e('Require Gift Pack (To):','gift-pack-for-woocommerce');?></div> … … 390 317 </div> 391 318 319 <?php $current_language = apply_filters('wpml_current_language', NULL); 320 if ($current_language) { 321 $gpfw_gift_pack_message_text_option_name = 'gpfw_gift_pack_message_text_to' . $current_language; 322 if (isset($_POST['gpfw_gift_pack_message_text_to'])) { 323 $gpfw_gift_pack_message_text_to = sanitize_text_field($_POST['gpfw_gift_pack_message_text_to']); 324 update_option($gpfw_gift_pack_message_text_option_name, $gpfw_gift_pack_message_text_to); 325 } 326 327 $gpfw_gift_pack_message_text_to = get_option($gpfw_gift_pack_message_text_option_name); 328 } else { 329 $gpfw_gift_pack_message_text_to = get_option('gpfw_gift_pack_message_text_to'); 330 } ?> 331 332 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_to']) ? 'none' : ''; ?>"> 333 <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Greeting Label (TO):', 'gift-pack-for-woocommerce'); ?><br /> 334 <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small> 335 </div> 336 <div class="gpfw_gift_value"> 337 <input type="text" name="gpfw_gift_pack_message_text_to" id="gpfw_gift_pack_message_text_to" value="<?php echo esc_attr($gpfw_gift_pack_message_text_to); ?>" placeholder="<?php esc_html_e("Enter your Greeting", "gift-pack-for-woocommerce"); ?>"> 338 </div> 339 </div> 340 <!--Placeholder Texts for Greeting Message--> 341 <?php if ($current_language) { 342 $gift_price_option_name = 'gpfw_gift_pack_to_placeholder' . $current_language; 343 344 if (isset($_POST['gpfw_gift_pack_to_placeholder'])) { 345 $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_pack_to_placeholder']); 346 update_option($gift_price_option_name, $updated_gift_price); 347 } 348 349 $gpfw_gift_pack_to_placeholder = get_option($gift_price_option_name); 350 } else { 351 $gpfw_gift_pack_to_placeholder = get_option('gpfw_gift_pack_to_placeholder'); 352 } 353 if ($current_language) { 354 $gpfw_gift_pack_to_placeholder = 'gpfw_gift_pack_to_placeholder' . $current_language; 355 if (isset($_POST['gpfw_gift_pack_to_placeholder'])) { 356 $gpfw_gift_pack_to_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_to_placeholder']); 357 update_option($gpfw_gift_pack_to_placeholder, $gpfw_gift_pack_to_placeholder); 358 } 359 $gpfw_gift_pack_to_placeholder = get_option($gpfw_gift_pack_to_placeholder); 360 } ?> 361 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_to']) ? 'none' : ''; ?>"> 362 <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Placeholder Texts for Greeting Message (TO):', 'gift-pack-for-woocommerce'); ?><br /> 363 <small><?php esc_html_e('Used in Product Details', 'gift-pack-for-woocommerce'); ?></small> 364 </div> 365 <div class="gpfw_gift_value"> 366 <input type="text" name="gpfw_gift_pack_to_placeholder" id="gpfw_gift_pack_to_placeholder" value="<?php echo esc_attr($gpfw_gift_pack_to_placeholder); ?>" placeholder="<?php esc_html_e("Placeholder Texts for Greeting Message", "gift-pack-for-woocommerce"); ?>"> 367 </div> 368 </div> 369 <div class="global_price_value"> 370 <div class="global_price_title backend_field_title"><?php esc_html_e('Disable Gift Pack (From):','gift-pack-for-woocommerce');?></div> 371 <label class="global_price_meta"> 372 <input type="checkbox" name="gpfw_disable_gift_pack_from" id="gpfw_disable_gift_pack_from" value="1" <?php if($gpfw_options['gpfw_disable_gift_pack_from']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>> 373 <span class="slider round"></span> 374 </label> 375 </div> 392 376 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_from']) ? 'none' : ''; ?>"> 393 <div class="global_price_title backend_field_title"><?php esc_html_e('Require Gift Pack (From)?:','gift-pack-for-woocommerce');?></div>377 <div class="global_price_title backend_field_title"><?php esc_html_e('Require Gift Pack (From)?:','gift-pack-for-woocommerce');?></div> 394 378 <label class="global_price_meta"> 395 379 <input type="checkbox" name="gpfw_gift_pack_from_require" id="gpfw_gift_pack_from_require" value="1" <?php if($gpfw_options['gpfw_gift_pack_from_require']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>> … … 397 381 </label> 398 382 </div> 383 <?php 384 if ($current_language) { 385 $gpfw_gift_pack_message_text_option_name = 'gpfw_gift_pack_message_text_from' . $current_language; 386 387 if (isset($_POST['gpfw_gift_pack_message_text_from'])) { 388 $gpfw_gift_pack_message_text_from = sanitize_text_field($_POST['gpfw_gift_pack_message_text_from']); 389 echo $gpfw_gift_pack_message_text_from; exit(); 390 update_option($gpfw_gift_pack_message_text_option_name, $gpfw_gift_pack_message_text_from); 391 } 392 393 $gpfw_gift_pack_message_text_from = get_option($gpfw_gift_pack_message_text_option_name); 394 } else { 395 $gpfw_gift_pack_message_text_from = get_option('gpfw_gift_pack_message_text_from'); 396 } ?> 397 398 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_from']) ? 'none' : ''; ?>"> 399 <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Greeting Label (From):', 'gift-pack-for-woocommerce'); ?><br /> 400 <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small> 401 </div> 402 <div class="gpfw_gift_value"> 403 <input type="text" name="gpfw_gift_pack_message_text_from" id="gpfw_gift_pack_message_text_from" value="<?php echo esc_attr($gpfw_gift_pack_message_text_from); ?>" placeholder="<?php esc_html_e("Enter your Greeting", "gift-pack-for-woocommerce"); ?>"> 404 </div> 405 </div> 406 <!--Placeholder Texts for Greeting Message--> 407 <?php if ($current_language) { 408 $gift_price_option_name = 'gpfw_gift_pack_from_placeholder' . $current_language; 409 410 if (isset($_POST['gpfw_gift_pack_from_placeholder'])) { 411 $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_pack_from_placeholder']); 412 update_option($gift_price_option_name, $updated_gift_price); 413 } 414 415 $gpfw_gift_pack_from_placeholder = get_option($gift_price_option_name); 416 } else { 417 $gpfw_gift_pack_from_placeholder = get_option('gpfw_gift_pack_from_placeholder'); 418 } 419 420 if ($current_language) { 421 $gpfw_gift_pack_from_placeholder = 'gpfw_gift_pack_from_placeholder' . $current_language; 422 if (isset($_POST['gpfw_gift_pack_from_placeholder'])) { 423 $updated_gift_pack_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_from_placeholder']); 424 update_option($gpfw_gift_pack_from_placeholder, $updated_gift_pack_note_placeholder); 425 } 426 $gpfw_gift_pack_from_placeholder = get_option($gpfw_gift_pack_from_placeholder); 427 } ?> 428 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_from']) ? 'none' : ''; ?>"> 429 <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Placeholder Texts for Greeting Message (From):', 'gift-pack-for-woocommerce'); ?><br /> 430 <small><?php esc_html_e('Used in Product Details', 'gift-pack-for-woocommerce'); ?></small> 431 </div> 432 <div class="gpfw_gift_value"> 433 <input type="text" name="gpfw_gift_pack_from_placeholder" id="gpfw_gift_pack_from_placeholder" value="<?php echo esc_attr($gpfw_gift_pack_from_placeholder); ?>" placeholder="<?php esc_html_e("Placeholder Texts for Greeting Message", "gift-pack-for-woocommerce"); ?>"> 434 </div> 435 </div> 436 437 <div class="global_price_value"> 438 <div class="global_price_title backend_field_title"><?php esc_html_e('Disable Gift Pack (Note):','gift-pack-for-woocommerce');?></div> 439 <label class="global_price_meta"> 440 <input type="checkbox" name="gpfw_disable_gift_pack_note" id="gpfw_disable_gift_pack_note" value="1" <?php if($gpfw_options['gpfw_disable_gift_pack_note']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>> 441 <span class="slider round"></span> 442 </label> 443 </div> 444 399 445 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_note']) ? 'none' : ''; ?>"> 400 <div class="global_price_title backend_field_title"><?php esc_html_e('Required Gift Pack (Note)?:','gift-pack-for-woocommerce');?></div>446 <div class="global_price_title backend_field_title"><?php esc_html_e('Required Gift Pack (Note)?:','gift-pack-for-woocommerce');?></div> 401 447 <label class="global_price_meta"> 402 448 <input type="checkbox" name="gpfw_gift_pack_note_require" id="gpfw_gift_pack_note_require" value="1" <?php if($gpfw_options['gpfw_gift_pack_note_require']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>> … … 413 459 </label> 414 460 </div> 461 462 <?php if ($current_language) { 463 $gpfw_gift_pack_message_text_option_name = 'gpfw_gift_pack_message_text' . $current_language; 464 465 if (isset($_POST['gpfw_gift_pack_message_text'])) { 466 $updated_gift_wrap_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text']); 467 update_option($gpfw_gift_pack_message_text_option_name, $updated_gift_wrap_message_text); 468 } 469 470 $gpfw_gift_pack_message_text = get_option($gpfw_gift_pack_message_text_option_name); 471 } else { 472 $gpfw_gift_pack_message_text = get_option('gpfw_gift_pack_message_text'); 473 } ?> 474 475 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_note']) ? 'none' : ''; ?>"> 476 <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Greeting Label (Note):', 'gift-pack-for-woocommerce'); ?><br /> 477 <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small> 478 </div> 479 <div class="gpfw_gift_value"> 480 <input type="text" name="gpfw_gift_pack_message_text" id="gpfw_gift_pack_message_text" value="<?php echo esc_attr($gpfw_gift_pack_message_text); ?>" placeholder="<?php esc_html_e("Enter your Greeting", "gift-pack-for-woocommerce"); ?>"> 481 </div> 482 </div> 483 484 <!--Placeholder Texts for Greeting Message--> 485 <?php if ($current_language) { 486 $gift_price_option_name = 'gpfw_gift_pack_note_placeholder' . $current_language; 487 488 if (isset($_POST['gpfw_gift_pack_note_placeholder'])) { 489 $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_pack_note_placeholder']); 490 update_option($gift_price_option_name, $updated_gift_price); 491 } 492 493 $gpfw_gift_pack_note_placeholder = get_option($gift_price_option_name); 494 } else { 495 $gpfw_gift_pack_note_placeholder = get_option('gpfw_gift_pack_note_placeholder'); 496 } 497 $current_language = apply_filters('wpml_current_language', NULL); 498 if ($current_language) { 499 $gpfw_gift_pack_note_placeholder = 'gpfw_gift_pack_note_placeholder' . $current_language; 500 if (isset($_POST['gpfw_gift_pack_note_placeholder'])) { 501 $updated_gift_pack_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_note_placeholder']); 502 update_option($gpfw_gift_pack_note_placeholder, $updated_gift_pack_note_placeholder); 503 } 504 $gpfw_gift_pack_note_placeholder = get_option($gpfw_gift_pack_note_placeholder); 505 } ?> 506 <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_note']) ? 'none' : ''; ?>"> 507 <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Placeholder Texts for Greeting Message:', 'gift-pack-for-woocommerce'); ?><br /> 508 <small><?php esc_html_e('Used in Product Details', 'gift-pack-for-woocommerce'); ?></small> 509 </div> 510 <div class="gpfw_gift_value"> 511 <input type="text" name="gpfw_gift_pack_note_placeholder" id="gpfw_gift_pack_note_placeholder" value="<?php echo esc_attr($gpfw_gift_pack_note_placeholder); ?>" placeholder="<?php esc_html_e("Placeholder Texts for Greeting Message", "gift-pack-for-woocommerce"); ?>"> 512 </div> 513 </div> 514 415 515 </div> 416 516 -
gift-pack-for-woocommerce/trunk/gift-pack-for-woocommerce.php
r3246471 r3278737 17 17 * Plugin URI: https://wordpress.org/plugins/gift-pack-for-woocommerce/ 18 18 * Description: Allow customers add gift pack/wrapping to individual products from product pages 19 * Version: 2.0. 119 * Version: 2.0.2 20 20 * Author: IT Path Solutions 21 21 * Author URI: https://www.itpathsolutions.com/ … … 37 37 * Rename this for your plugin and update it as you release new versions. 38 38 */ 39 define( 'GIFT_PACK_FOR_WOOCOMMERCE_VERSION', '2.0. 1' );39 define( 'GIFT_PACK_FOR_WOOCOMMERCE_VERSION', '2.0.2' ); 40 40 41 41 /** -
gift-pack-for-woocommerce/trunk/includes/class-gift-pack-for-woocommerce.php
r3246471 r3278737 47 47 * @var string $plugin_name The string used to uniquely identify this plugin. 48 48 */ 49 49 50 protected $plugin_name; 50 51 … … 227 228 $options['gpfw_gift_pack_message_text'] = get_option($gpfw_gift_pack_message_text); 228 229 230 $gpfw_gift_pack_message_text_to = 'gpfw_gift_pack_message_text_to' . $current_language; 231 $options['gpfw_gift_pack_message_text_to'] = get_option($gpfw_gift_pack_message_text_to); 232 233 $gpfw_gift_pack_message_text_from = 'gpfw_gift_pack_message_text_from' . $current_language; 234 $options['gpfw_gift_pack_message_text_from'] = get_option($gpfw_gift_pack_message_text_from); 235 236 229 237 $gift_wrap_global_text = 'gift_wrap_text' . $current_language; 230 238 $options['gift_wrap_text'] = get_option( $gift_wrap_global_text ); … … 236 244 $options['gpfw_gift_pack_note_placeholder'] = get_option( $gift_wrap_global_note_placeholder ); 237 245 246 $gpfw_gift_pack_to_placeholder = 'gpfw_gift_pack_to_placeholder' . $current_language; 247 $options['gpfw_gift_pack_to_placeholder'] = get_option( $gpfw_gift_pack_to_placeholder ); 248 249 $gpfw_gift_pack_from_placeholder = 'gpfw_gift_pack_from_placeholder' . $current_language; 250 $options['gpfw_gift_pack_from_placeholder'] = get_option( $gpfw_gift_pack_from_placeholder ); 251 238 252 $gift_wrap_global_text_label = 'gpfw_gift_wrap_text_label' . $current_language; 239 253 $options['gpfw_gift_wrap_text_label'] = get_option( $gift_wrap_global_text_label ); -
gift-pack-for-woocommerce/trunk/public/class-gift-pack-for-woocommerce-public.php
r3246471 r3278737 292 292 } 293 293 if( isset( $cart_item['gpfw_gift_pack_to'] ) ) { 294 295 if($this->gpfw_options['gpfw_gift_pack_message_text ']!=''){296 $gpfw_gift_pack_message_text = $this->gpfw_options['gpfw_gift_pack_message_text'];297 } 298 else{ 299 $gpfw_gift_pack_message_text = __("Giftpack To","gift-pack-for-woocommerce");300 } 301 $cart_item_data[] = array( "name" => $gpfw_gift_pack_message_text , "value" => $cart_item['gpfw_gift_pack_to'] );294 295 if($this->gpfw_options['gpfw_gift_pack_message_text_to']!=''){ 296 $gpfw_gift_pack_message_text_to = $this->gpfw_options['gpfw_gift_pack_message_text_to']; 297 } 298 else{ 299 $gpfw_gift_pack_message_text_to = __("Giftpack To","gift-pack-for-woocommerce"); 300 } 301 $cart_item_data[] = array( "name" => $gpfw_gift_pack_message_text_to, "value" => $cart_item['gpfw_gift_pack_to'] ); 302 302 } 303 303 304 304 if( isset( $cart_item['gpfw_gift_pack_from'] ) ) { 305 305 306 if($this->gpfw_options['gpfw_gift_pack_message_text ']!=''){307 $gpfw_gift_pack_message_text = $this->gpfw_options['gpfw_gift_pack_message_text'];308 } 309 else{ 310 $gpfw_gift_pack_message_text = __("Giftpack From","gift-pack-for-woocommerce");311 } 312 $cart_item_data[] = array( "name" => $gpfw_gift_pack_message_text , "value" => $cart_item['gpfw_gift_pack_from'] );306 if($this->gpfw_options['gpfw_gift_pack_message_text_from']!=''){ 307 $gpfw_gift_pack_message_text_from = $this->gpfw_options['gpfw_gift_pack_message_text_from']; 308 } 309 else{ 310 $gpfw_gift_pack_message_text_from = __("Giftpack From","gift-pack-for-woocommerce"); 311 } 312 $cart_item_data[] = array( "name" => $gpfw_gift_pack_message_text_from, "value" => $cart_item['gpfw_gift_pack_from'] ); 313 313 } 314 314 -
gift-pack-for-woocommerce/trunk/public/js/gift-pack-for-woocommerce-public.js
r3246471 r3278737 42 42 $(document).on('change',gpfw_option_input,function(){ 43 43 44 44 _this = jQuery(this); 45 45 if($(this).prop('checked') === true) { 46 46 var variable_pro = false; … … 80 80 if(json_obj.gpfw_sale && $('div.woocommerce-variation-price .price ins').length){ 81 81 $('.woocommerce-variation-price .price ins').html(json_obj.gift_pack_global_price_html); 82 } 83 else if(json_obj.gpfw_sale == 0 && $('div.woocommerce-variation-price .price ins').length == 0 && $('div.woocommerce-variation-price .price').length){ 82 } else if(json_obj.gpfw_sale == 0 && $('div.woocommerce-variation-price .price ins').length == 0 && $('div.woocommerce-variation-price .price').length){ 84 83 $('.woocommerce-variation-price .price').html(json_obj.gift_pack_global_price_html); 85 } 86 else if(json_obj.gpfw_sale == 0 && $('div.woocommerce-variation-price .price').length == 0 && $('p.price ins').length){ 84 } else if(json_obj.gpfw_sale == 0 && $('div.woocommerce-variation-price .price').length == 0 && $('p.price ins').length){ 87 85 $('p.price ins').html(json_obj.gift_pack_global_price_html); 88 } 89 else if(json_obj.gpfw_sale == 0 && $('div.woocommerce-variation-price .price').length == 0 && $('p.price').length && $('p.price ins').length == 0){ 86 } else if(json_obj.gpfw_sale == 0 && $('div.woocommerce-variation-price .price').length == 0 && $('p.price').length && $('p.price ins').length == 0){ 90 87 $('.price').html(json_obj.gift_pack_global_price_html); 91 } 92 else{ 88 } else{ 93 89 $('p.price ins').html(json_obj.gift_pack_global_price_html); 94 90 } … … 98 94 if($('p.price ins').length == 1){ 99 95 $('.price ins').html(json_obj.gift_pack_global_price_html); 100 } 101 else{ 102 103 $('.woocommerce-Price-amount.amount').parent().html(json_obj.gift_pack_global_price_html); 96 } else{ 97 if(jQuery('div[data-is-descendent-of-single-product-template="true"] .woocommerce-Price-amount.amount').length){ 98 $('div[data-is-descendent-of-single-product-template="true"] .woocommerce-Price-amount.amount').parent().html(json_obj.gift_pack_global_price_html); 99 } else { 100 $(_this).closest('form').closest('div').find('.woocommerce-Price-amount.amount').parent().html(json_obj.gift_pack_global_price_html); 101 } 104 102 } 105 103 } … … 119 117 var gpfw_productID = $('input[name="variation_id"]').val(); 120 118 var variable_pro = true; 121 } 122 else{ 119 } else { 123 120 var gpfw_productID = $('button[name="add-to-cart"]').val(); 124 121 if (typeof gpfw_productID === 'undefined') { … … 159 156 $('.price ins').html(json_obj.gift_pack_global_price_html); 160 157 } else { 161 $('.woocommerce-Price-amount.amount').parent().html(json_obj.gift_pack_global_price_html); 158 if(jQuery('div[data-is-descendent-of-single-product-template="true"] .woocommerce-Price-amount.amount').length){ 159 $('div[data-is-descendent-of-single-product-template="true"] .woocommerce-Price-amount.amount').parent().html(json_obj.gift_pack_global_price_html); 160 } else { 161 $(_this).closest('form').closest('div').find('.woocommerce-Price-amount.amount').parent().html(json_obj.gift_pack_global_price_html); 162 } 162 163 } 163 164 } -
gift-pack-for-woocommerce/trunk/public/partials/gift-pack-data-in-order.php
r3246471 r3278737 29 29 $item->update_meta_data( $gift_wrap_text, $gift_pack_prices ); 30 30 } 31 /* GiftPack Message Label */ 31 32 if($this->gpfw_options['gpfw_gift_pack_message_text_to']!=''){ 33 $gpfw_gift_pack_message_text_to = sanitize_text_field($this->gpfw_options['gpfw_gift_pack_message_text_to']); 34 } 35 else{ 36 $gpfw_gift_pack_message_text_to = __("Giftpack TO","gift-pack-for-woocommerce"); 37 } 38 39 if( isset( $values['gpfw_gift_pack_to'] ) ) { 40 $item->update_meta_data( $gpfw_gift_pack_message_text_to, $values['gpfw_gift_pack_to'] ); 41 } 42 43 if($this->gpfw_options['gpfw_gift_pack_message_text_from']!=''){ 44 $gpfw_gift_pack_message_text_from = sanitize_text_field($this->gpfw_options['gpfw_gift_pack_message_text_from']); 45 } 46 else{ 47 $gpfw_gift_pack_message_text_from = __("Giftpack Form","gift-pack-for-woocommerce"); 48 } 49 50 if( isset( $values['gpfw_gift_pack_from'] ) ) { 51 $item->update_meta_data( $gpfw_gift_pack_message_text_from, $values['gpfw_gift_pack_from'] ); 52 } 53 54 /* GiftPack Message Label */ 32 55 if($this->gpfw_options['gpfw_gift_pack_message_text']!=''){ 33 56 $gpfw_gift_pack_message_text = sanitize_text_field($this->gpfw_options['gpfw_gift_pack_message_text']); … … 36 59 $gpfw_gift_pack_message_text = __("Giftpack Note","gift-pack-for-woocommerce"); 37 60 } 38 /* GiftPack Note */61 /* GiftPack Note */ 39 62 if( isset( $values['gpfw_gift_pack_note'] ) ) { 40 63 $item->update_meta_data( $gpfw_gift_pack_message_text, $values['gpfw_gift_pack_note'] ); 41 64 } 42 43 if( isset( $values['gpfw_gift_pack_to'] ) ) { 44 $gpfw_gift_pack_message_to = __("Giftpack to","gift-pack-for-woocommerce"); 45 $item->update_meta_data( $gpfw_gift_pack_message_to, $values['gpfw_gift_pack_to'] ); 46 } 47 if( isset( $values['gpfw_gift_pack_from'] ) ) { 48 $gpfw_gift_pack_message_from = __("Giftpack from","gift-pack-for-woocommerce"); 49 $item->update_meta_data( $gpfw_gift_pack_message_from, $values['gpfw_gift_pack_from'] ); 50 } 51 /* GiftPack Image Label */ 65 66 /* GiftPack Image Label */ 52 67 if($this->gpfw_options['gpfw_gift_pack_image_text']!=''){ 53 68 $gpfw_gift_pack_image_text = sanitize_text_field($this->gpfw_options['gpfw_gift_pack_image_text']); -
gift-pack-for-woocommerce/trunk/public/partials/gift-pack-html.php
r3246471 r3278737 180 180 if ($gpfw_object['gpfw_disable_gift_pack_to'] == '') { 181 181 182 $to = ($gpfw_object['gpfw_gift_pack_to_require']) ? 'required' : '' ; 183 182 184 $html .= '<div class="gpfw_giftpack_note"><div class="gpfw_giftpack_val"><input type="text" class="gpfw-gift-pack-note" name="gpfw-gift-pack-to" placeholder="' . ($gpfw_object['gpfw_gift_pack_to_placeholder'] == '' ? __("Gift Pack To", "gift-pack-for-woocommerce") : esc_html($gpfw_object['gpfw_gift_pack_to_placeholder'])) . '" 183 value="" ></div>';185 value="" '.$to.'></div>'; 184 186 } 185 187 186 188 if ($gpfw_object['gpfw_disable_gift_pack_from'] == '') { 187 189 190 $from = ($gpfw_object['gpfw_gift_pack_from_require']) ? 'required' : '' ; 191 188 192 $html .= '<div class="gpfw_giftpack_val"><input type="text" class="gpfw-gift-pack-note" name="gpfw-gift-pack-from" placeholder="' . ($gpfw_object['gpfw_gift_pack_from_placeholder'] == '' ? __("Gift Pack From ", "gift-pack-for-woocommerce") : esc_html($gpfw_object['gpfw_gift_pack_from_placeholder'])) . '" 189 value="" ></div>';193 value="" '.$from.'></div>'; 190 194 } 191 195 192 196 if ($gpfw_object['gpfw_disable_gift_pack_note'] == '') { 197 198 $note = ($gpfw_object['gpfw_gift_pack_note_require']) ? 'required' : '' ; 199 193 200 194 201 $note_max_var = $gpfw_object['gpfw_enable_gift_pack_note_limit'] && !empty($gpfw_object['gpfw_choose_gift_limit']) ? $gpfw_object['gpfw_choose_gift_limit'] : '1000'; … … 196 203 $html .= ' 197 204 <div class="gpfw_giftpack_val"><textarea class="gpfw-gift-pack-note" name="gpfw-gift-pack-note" placeholder="' . ($gpfw_object['gpfw_gift_pack_note_placeholder'] == '' ? __("Gift Pack Note", "gift-pack-for-woocommerce") : esc_html($gpfw_object['gpfw_gift_pack_note_placeholder'])) . '" 198 value="" minlength="5" maxlength="'.$note_max_var.'"></textarea>205 value="" maxlength="'.$note_max_var.'" '.$note.'></textarea> 199 206 </div>'; 200 207 }
Note: See TracChangeset
for help on using the changeset viewer.