Plugin Directory

Changeset 3278737


Ignore:
Timestamp:
04/22/2025 07:18:59 AM (12 months ago)
Author:
itpathsolutions
Message:

2.0.2

*Release Date 22 April 2025*

  • Compatibility - Ensured compatibility with the latest WordPress version 6.8
  • Improvement - Removed the default character limit validation for the Gift Pack Note
Location:
gift-pack-for-woocommerce/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • gift-pack-for-woocommerce/trunk/README.txt

    r3246471 r3278737  
    11=== Gift Pack for Woocommerce   ===
    2 Contributors: itpathsolutions, mayur8991, shailu25, thakordarshil, jaiminp
     2Contributors: itpathsolutions, mayur8991, shailu25, thakordarshil, jaiminp, hirenbhanderi
    33Tags: woocommmerce,gift pack,gift wrapper,wordpress gift pack,gift wrap,gift
    44Donate link: https://www.itpathsolutions.com
    55Requires at least: 6.0
    6 Tested up to: 6.7
     6Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 2.0.1
     8Stable tag: 2.0.2
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    9999== Changelog ==
    100100
     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
    101108= 2.0.1 =
    102109
  • gift-pack-for-woocommerce/trunk/admin/class-gift-pack-for-woocommerce-admin.php

    r3246471 r3278737  
    515515        }
    516516       
     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       
    517568        // Set Gift Pack Image Label Text
    518569       
     
    596647            }
    597648        }
    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
    599701        // Add Gift Pack Image
    600702        if (function_exists('icl_object_id') && $this->current_language) {
  • gift-pack-for-woocommerce/trunk/admin/js/gift-pack-for-woocommerce-admin.js

    r3246471 r3278737  
    5353                if (jQuery(this).is(':checked')) {
    5454                    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();
    5557                } else {
    5658                    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();
    5761                }
    5862            });
     
    6165                if (jQuery(this).is(':checked')) {
    6266                    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();
    6369                } else {
    6470                    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();
    6573                }
    6674            });
     
    7078                    jQuery('#gpfw_gift_pack_note_require').closest('.global_price_value').hide();
    7179                    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                   
    7283                } else {
    7384                    jQuery('#gpfw_gift_pack_note_require').closest('.global_price_value').show();
    7485                    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();
    7588                }
    7689            });
  • gift-pack-for-woocommerce/trunk/admin/partials/gift-pack-for-woocommerce-admin-display.php

    r3246471 r3278737  
    114114                </div>
    115115
    116                 <!--Gift Pack Greeting Label-->
    117                 <?php
    118                     $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>
    140116
    141117                <!--Gift Pack Images Label-->
     
    187163                    </div>
    188164                </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 
    223165                <!--Gift Wrap Label-->
    224166                    <?php
     
    367309                    </label>
    368310                </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 
    384311                <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_to']) ? 'none' : ''; ?>">
    385312                    <div class="global_price_title backend_field_title"><?php esc_html_e('Require Gift Pack (To):','gift-pack-for-woocommerce');?></div>
     
    390317                </div>
    391318
     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>
    392376                <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>
    394378                    <label class="global_price_meta">
    395379                        <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 '';?>>
     
    397381                    </label>
    398382                </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               
    399445                <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>
    401447                    <label class="global_price_meta">
    402448                        <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 '';?>>
     
    413459                    </label>
    414460                </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
    415515            </div>
    416516
  • gift-pack-for-woocommerce/trunk/gift-pack-for-woocommerce.php

    r3246471 r3278737  
    1717 * Plugin URI:        https://wordpress.org/plugins/gift-pack-for-woocommerce/
    1818 * Description:       Allow customers add gift pack/wrapping to individual products from product pages
    19  * Version:           2.0.1
     19 * Version:           2.0.2
    2020 * Author:            IT Path Solutions
    2121 * Author URI:        https://www.itpathsolutions.com/
     
    3737 * Rename this for your plugin and update it as you release new versions.
    3838 */
    39 define( 'GIFT_PACK_FOR_WOOCOMMERCE_VERSION', '2.0.1' );
     39define( 'GIFT_PACK_FOR_WOOCOMMERCE_VERSION', '2.0.2' );
    4040
    4141/**
  • gift-pack-for-woocommerce/trunk/includes/class-gift-pack-for-woocommerce.php

    r3246471 r3278737  
    4747     * @var      string    $plugin_name    The string used to uniquely identify this plugin.
    4848     */
     49
    4950    protected $plugin_name;
    5051
     
    227228        $options['gpfw_gift_pack_message_text'] = get_option($gpfw_gift_pack_message_text);
    228229
     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
    229237        $gift_wrap_global_text = 'gift_wrap_text' . $current_language;
    230238        $options['gift_wrap_text'] = get_option( $gift_wrap_global_text );
     
    236244        $options['gpfw_gift_pack_note_placeholder'] = get_option( $gift_wrap_global_note_placeholder );
    237245
     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
    238252        $gift_wrap_global_text_label = 'gpfw_gift_wrap_text_label' . $current_language;
    239253        $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  
    292292        }
    293293        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'] );
    302302        }
    303303
    304304        if( isset( $cart_item['gpfw_gift_pack_from'] ) ) {
    305305
    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'] );
    313313        }
    314314
  • gift-pack-for-woocommerce/trunk/public/js/gift-pack-for-woocommerce-public.js

    r3246471 r3278737  
    4242    $(document).on('change',gpfw_option_input,function(){
    4343
    44 
     44        _this = jQuery(this);
    4545        if($(this).prop('checked') === true) {
    4646            var variable_pro = false;
     
    8080                    if(json_obj.gpfw_sale && $('div.woocommerce-variation-price .price ins').length){
    8181                        $('.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){
    8483                        $('.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){
    8785                        $('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){
    9087                        $('.price').html(json_obj.gift_pack_global_price_html);
    91                     }
    92                     else{
     88                    } else{
    9389                        $('p.price ins').html(json_obj.gift_pack_global_price_html);
    9490                    }
     
    9894                    if($('p.price ins').length == 1){
    9995                        $('.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                        }
    104102                    }
    105103                }
     
    119117                var gpfw_productID = $('input[name="variation_id"]').val();
    120118                var variable_pro = true;
    121             }
    122             else{
     119            } else {
    123120                var gpfw_productID = $('button[name="add-to-cart"]').val();
    124121                if (typeof gpfw_productID === 'undefined') {
     
    159156                        $('.price ins').html(json_obj.gift_pack_global_price_html);
    160157                    } 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                        }
    162163                    }
    163164                }
  • gift-pack-for-woocommerce/trunk/public/partials/gift-pack-data-in-order.php

    r3246471 r3278737  
    2929      $item->update_meta_data( $gift_wrap_text, $gift_pack_prices );
    3030    }
    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 */
    3255    if($this->gpfw_options['gpfw_gift_pack_message_text']!=''){
    3356      $gpfw_gift_pack_message_text = sanitize_text_field($this->gpfw_options['gpfw_gift_pack_message_text']);
     
    3659      $gpfw_gift_pack_message_text = __("Giftpack Note","gift-pack-for-woocommerce");
    3760    }   
    38         /* GiftPack Note */
     61    /* GiftPack Note */
    3962    if( isset( $values['gpfw_gift_pack_note'] ) ) {
    4063      $item->update_meta_data( $gpfw_gift_pack_message_text, $values['gpfw_gift_pack_note'] );
    4164    }
    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 */
    5267    if($this->gpfw_options['gpfw_gift_pack_image_text']!=''){
    5368      $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  
    180180    if ($gpfw_object['gpfw_disable_gift_pack_to'] == '') {
    181181
     182        $to = ($gpfw_object['gpfw_gift_pack_to_require']) ? 'required' : '' ;
     183
    182184        $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>';
    184186    }
    185187   
    186188    if ($gpfw_object['gpfw_disable_gift_pack_from'] == '') {
    187189
     190        $from = ($gpfw_object['gpfw_gift_pack_from_require']) ? 'required' : '' ;
     191
    188192        $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>';
    190194    }
    191195
    192196    if ($gpfw_object['gpfw_disable_gift_pack_note'] == '') {
     197       
     198        $note = ($gpfw_object['gpfw_gift_pack_note_require']) ? 'required' : '' ;
     199
    193200
    194201        $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';
     
    196203        $html .= '
    197204            <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>
    199206        </div>';
    200207    }
Note: See TracChangeset for help on using the changeset viewer.