Plugin Directory

Changeset 3246471


Ignore:
Timestamp:
02/25/2025 01:31:32 PM (13 months ago)
Author:
itpathsolutions
Message:

2.0.1

*Release Date 25 February 2025*

  • Improvement – UI updates.
  • New – Added options to specify "To" and "From" fields for users.
  • New – Added an option to enable/disable gift wrapping for "To" and "From" fields.
  • Improvement – Improved compatibility with the default WordPress themes.
Location:
gift-pack-for-woocommerce
Files:
44 added
12 edited

Legend:

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

    r3169892 r3246471  
    44Donate link: https://www.itpathsolutions.com
    55Requires at least: 6.0
    6 Tested up to: 6.6
     6Tested up to: 6.7
    77Requires PHP: 7.4
    8 Stable tag: 2.0.0
     8Stable tag: 2.0.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    9999== Changelog ==
    100100
     101= 2.0.1 =
     102
     103*Release Date 25 February 2025*
     104
     105* Improvement – UI updates.
     106* New – Added options to specify "To" and "From" fields for users.
     107* New – Added an option to enable/disable gift wrapping for "To" and "From" fields.
     108* Improvement – Improved compatibility with the default WordPress themes.
     109
    101110= 2.0.0 =
    102111* Fix : Compatible with Loco Translate
  • gift-pack-for-woocommerce/trunk/admin/class-gift-pack-for-woocommerce-admin.php

    r3144054 r3246471  
    286286                }
    287287            }
     288               
     289
     290            $opt_gpfw_disable_gift_pack_to    = 'gpfw_disable_gift_pack_to' . $this->current_language;
     291            $opt_gpfw_disable_gift_pack_to_value = get_option($opt_gpfw_disable_gift_pack_to);
     292            if ( isset($opt_gpfw_disable_gift_pack_to_value) && $opt_gpfw_disable_gift_pack_to_value !== false) {
     293                $updated_disable_gift_pack_note = isset($_POST['gpfw_disable_gift_pack_to']) ? $_POST['gpfw_disable_gift_pack_to'] : '';
     294                update_option('gpfw_disable_gift_pack_to' . $this->current_language, sanitize_text_field($updated_disable_gift_pack_note) );
     295            } else {
     296                foreach (icl_get_languages('skip_missing=0') as $language) {
     297                    $lang_code   = $language['language_code'];
     298                    $option_name = 'gpfw_disable_gift_pack_to' . $lang_code;
     299                    if (isset($_POST['gpfw_disable_gift_pack_to'])) {
     300                        $updated_disable_gift_pack_note = sanitize_text_field(isset($_POST['gpfw_disable_gift_pack_to']) ? $_POST['gpfw_disable_gift_pack_to'] : '');
     301                        add_option($option_name, $updated_disable_gift_pack_note, null, 'no');
     302                    }
     303                }
     304            }
     305
     306            $opt_gpfw_disable_gift_pack_from    = 'gpfw_disable_gift_pack_from' . $this->current_language;
     307            $opt_gpfw_disable_gift_pack_from_value = get_option($opt_gpfw_disable_gift_pack_from);
     308            if ( isset($opt_gpfw_disable_gift_pack_from_value) && $opt_gpfw_disable_gift_pack_from_value !== false) {
     309                $updated_disable_gift_pack_note = isset($_POST['gpfw_disable_gift_pack_from']) ? $_POST['gpfw_disable_gift_pack_from'] : '';
     310                update_option('gpfw_disable_gift_pack_from' . $this->current_language, sanitize_text_field($updated_disable_gift_pack_note) );
     311            } else {
     312                foreach (icl_get_languages('skip_missing=0') as $language) {
     313                    $lang_code   = $language['language_code'];
     314                    $option_name = 'gpfw_disable_gift_pack_from' . $lang_code;
     315                    if (isset($_POST['gpfw_disable_gift_pack_from'])) {
     316                        $updated_disable_gift_pack_note = sanitize_text_field(isset($_POST['gpfw_disable_gift_pack_from']) ? $_POST['gpfw_disable_gift_pack_from'] : '');
     317                        add_option($option_name, $updated_disable_gift_pack_note, null, 'no');
     318                    }
     319                }
     320            }
     321
     322
     323
     324
     325            $opt_gpfw_disable_gift_pack_note    = 'gpfw_gift_pack_note_require' . $this->current_language;
     326            $opt_gpfw_disable_gift_pack_note_value = get_option($opt_gpfw_disable_gift_pack_note);
     327            if ( isset($opt_gpfw_disable_gift_pack_note_value) && $opt_gpfw_disable_gift_pack_note_value !== false) {
     328                $updated_disable_gift_pack_note = isset($_POST['gpfw_gift_pack_note_require']) ? $_POST['gpfw_gift_pack_note_require'] : '';
     329                update_option('gpfw_gift_pack_note_require' . $this->current_language, sanitize_text_field($updated_disable_gift_pack_note) );
     330            } else {
     331                foreach (icl_get_languages('skip_missing=0') as $language) {
     332                    $lang_code   = $language['language_code'];
     333                    $option_name = 'gpfw_gift_pack_note_require' . $lang_code;
     334                    if (isset($_POST['gpfw_gift_pack_note_require'])) {
     335                        $updated_disable_gift_pack_note = sanitize_text_field(isset($_POST['gpfw_gift_pack_note_require']) ? $_POST['gpfw_gift_pack_note_require'] : '');
     336                        add_option($option_name, $updated_disable_gift_pack_note, null, 'no');
     337                    }
     338                }
     339            }
     340
     341            $opt_gpfw_disable_gift_pack_to    = 'gpfw_gift_pack_to_require' . $this->current_language;
     342            $opt_gpfw_disable_gift_pack_to_value = get_option($opt_gpfw_disable_gift_pack_to);
     343
     344
     345            if ( isset($opt_gpfw_disable_gift_pack_to_value) && $opt_gpfw_disable_gift_pack_to_value !== false) {
     346                $updated_disable_gift_pack_note = isset($_POST['gpfw_gift_pack_to_require']) ? $_POST['gpfw_gift_pack_to_require'] : '';
     347                update_option('gpfw_gift_pack_to_require' . $this->current_language, sanitize_text_field($updated_disable_gift_pack_note) );
     348            } else {
     349                foreach (icl_get_languages('skip_missing=0') as $language) {
     350                    $lang_code   = $language['language_code'];
     351                    $option_name = 'gpfw_gift_pack_to_require' . $lang_code;
     352                    if (isset($_POST['gpfw_gift_pack_to_require'])) {
     353                        $updated_disable_gift_pack_note = sanitize_text_field(isset($_POST['gpfw_gift_pack_to_require']) ? $_POST['gpfw_gift_pack_to_require'] : '');
     354                        add_option($option_name, $updated_disable_gift_pack_note, null, 'no');
     355                    }
     356                }
     357            }
     358
     359            $opt_gpfw_disable_gift_pack_from    = 'gpfw_gift_pack_from_require' . $this->current_language;
     360            $opt_gpfw_disable_gift_pack_from_value = get_option($opt_gpfw_disable_gift_pack_from);
     361            if ( isset($opt_gpfw_disable_gift_pack_from_value) && $opt_gpfw_disable_gift_pack_from_value !== false) {
     362                $updated_disable_gift_pack_note = isset($_POST['gpfw_gift_pack_from_require']) ? $_POST['gpfw_gift_pack_from_require'] : '';
     363                update_option('gpfw_gift_pack_from_require' . $this->current_language, sanitize_text_field($updated_disable_gift_pack_note) );
     364            } else {
     365                foreach (icl_get_languages('skip_missing=0') as $language) {
     366                    $lang_code   = $language['language_code'];
     367                    $option_name = 'gpfw_gift_pack_from_require' . $lang_code;
     368                    if (isset($_POST['gpfw_gift_pack_from_require'])) {
     369                        $updated_disable_gift_pack_note = sanitize_text_field(isset($_POST['gpfw_gift_pack_from_require']) ? $_POST['gpfw_gift_pack_from_require'] : '');
     370                        add_option($option_name, $updated_disable_gift_pack_note, null, 'no');
     371                    }
     372                }
     373            }
    288374
    289375        } else {
     
    314400            } else {
    315401                add_option('gpfw_disable_gift_pack_note', sanitize_text_field($_POST['gpfw_disable_gift_pack_note']), null, 'no');
     402            }
     403
     404            if ($gpfw_options['gpfw_disable_gift_pack_to'] !== false) {
     405                update_option('gpfw_disable_gift_pack_to', sanitize_text_field($_POST['gpfw_disable_gift_pack_to']));
     406            } else {
     407                add_option('gpfw_disable_gift_pack_to', sanitize_text_field($_POST['gpfw_disable_gift_pack_to']), null, 'no');
     408            }
     409
     410            if ($gpfw_options['gpfw_disable_gift_pack_from'] !== false) {
     411                update_option('gpfw_disable_gift_pack_from', sanitize_text_field($_POST['gpfw_disable_gift_pack_from']));
     412            } else {
     413                add_option('gpfw_disable_gift_pack_from', sanitize_text_field($_POST['gpfw_disable_gift_pack_from']), null, 'no');
     414            }
     415
     416            if ($gpfw_options['gpfw_gift_pack_note_require'] !== false) {
     417                update_option('gpfw_gift_pack_note_require', sanitize_text_field($_POST['gpfw_gift_pack_note_require']));
     418            } else {
     419
     420                add_option('gpfw_gift_pack_note_require', sanitize_text_field($_POST['gpfw_gift_pack_note_require']), null, 'no');
     421            }
     422
     423
     424            if ($gpfw_options['gpfw_gift_pack_to_require'] !== false) {
     425                update_option('gpfw_gift_pack_to_require', sanitize_text_field($_POST['gpfw_gift_pack_to_require']));
     426            } else {
     427
     428                add_option('gpfw_gift_pack_to_require', sanitize_text_field($_POST['gpfw_gift_pack_to_require']), null, 'no');
     429            }
     430
     431
     432            if ($gpfw_options['gpfw_gift_pack_from_require'] !== false) {
     433                update_option('gpfw_gift_pack_from_require', sanitize_text_field($_POST['gpfw_gift_pack_from_require']));
     434            } else {
     435                add_option('gpfw_gift_pack_from_require', sanitize_text_field($_POST['gpfw_gift_pack_from_require']), null, 'no');
    316436            }
    317437        }
  • gift-pack-for-woocommerce/trunk/admin/css/gift-pack-for-woocommerce-admin.css

    r3005592 r3246471  
    9494    position: relative;
    9595}
     96
     97.gift_tabs {
     98    display: flex;
     99    gap: 10px;
     100    /* margin-bottom: 10px; */
     101}
     102.gift_tabs .tab-button {
     103   float: left;
     104    border: 1px solid #c3c4c7;
     105    border-bottom: none;
     106    margin-left: .5em;
     107    padding: 5px 10px;
     108    font-size: 14px;
     109    line-height: 1.71428571;
     110    font-weight: 600;
     111    background: #dcdcde;
     112    color: #50575e;
     113    text-decoration: none;
     114    white-space: nowrap
     115}
     116.gift_tabs .tab-button:hover, .gift_tabs .tab-button.active {
     117    border-bottom: 1px solid #f0f0f1;
     118    background: #f0f0f1;
     119    color: #000
     120}
     121
     122/* Style for tab content */
     123.gift_tab_content {
     124    display: none;
     125    padding: 15px;
     126    /* border: 1px solid #ddd; */
     127    /* background: #fff; */
     128}
     129.gift_tab_content.active {
     130    display: block;
     131}
     132
     133.global_price_value ul li,.global_price_value .popular-category .children .children {
     134    margin-bottom: 15px !important;
     135}
     136
     137.global_price_value .popular-category .children,.global_price_value .popular-category .children .children{
     138    margin: 20px 20px !important;
     139}
     140
     141.gift_tabs {
     142    border-bottom: 1px solid #c3c4c7;
     143    margin: 0;
     144    padding-top: 9px;
     145    padding-bottom: 0;
     146    line-height: inherit
     147}
     148
     149.gift_tabs button.tab-button.active {
     150    margin-bottom: -1px;
     151}
     152
     153
     154/******/
     155
     156
     157.global_price_meta {
     158  position: relative;
     159  display: inline-block;
     160  width: 60px !important;!i;!;
     161  height: 34px;
     162}
     163
     164.global_price_meta input {
     165  opacity: 0;
     166  width: 0;
     167  height: 0;
     168}
     169
     170.global_price_meta .slider {
     171  position: absolute;
     172  cursor: pointer;
     173  top: 0;
     174  left: 0;
     175  right: 0;
     176  bottom: 0;
     177  background-color: #ccc;
     178  -webkit-transition: .4s;
     179  transition: .4s;
     180}
     181
     182.global_price_meta .slider:before {
     183  position: absolute;
     184  content: "";
     185  height: 26px;
     186  width: 26px;
     187  left: 4px;
     188  bottom: 4px;
     189  background-color: white;
     190  -webkit-transition: .4s;
     191  transition: .4s;
     192}
     193
     194.global_price_meta input:checked + .slider {
     195  background-color: #2196F3;
     196}
     197
     198.global_price_meta input:focus + .slider {
     199  box-shadow: 0 0 1px #2196F3;
     200}
     201
     202.global_price_meta input:checked + .slider:before {
     203  -webkit-transform: translateX(26px);
     204  -ms-transform: translateX(26px);
     205  transform: translateX(26px);
     206}
     207
     208/* Rounded sliders */
     209.slider.round {
     210  border-radius: 34px;
     211}
     212
     213.slider.round:before {
     214  border-radius: 50%;
     215}
     216
    96217@media (max-width: 768px) {
    97218 
     
    102223        margin-bottom: 10px;
    103224    }
    104   }
    105   .global_price_value ul li,.global_price_value .popular-category .children .children {
    106     margin-bottom: 15px !important;
    107   }
    108   .global_price_value .popular-category .children,.global_price_value .popular-category .children .children{
    109     margin: 20px 20px !important;
    110   }
     225}
  • gift-pack-for-woocommerce/trunk/admin/js/gift-pack-for-woocommerce-admin.js

    r3144054 r3246471  
    4949                }
    5050            });
     51
     52            jQuery('#gpfw_disable_gift_pack_to').change(function() {
     53                if (jQuery(this).is(':checked')) {
     54                    jQuery('#gpfw_gift_pack_to_require').closest('.global_price_value').hide();
     55                } else {
     56                    jQuery('#gpfw_gift_pack_to_require').closest('.global_price_value').show();
     57                }
     58            });
     59
     60            jQuery('#gpfw_disable_gift_pack_from').change(function() {
     61                if (jQuery(this).is(':checked')) {
     62                    jQuery('#gpfw_gift_pack_from_require').closest('.global_price_value').hide();
     63                } else {
     64                    jQuery('#gpfw_gift_pack_from_require').closest('.global_price_value').show();
     65                }
     66            });
     67
     68            jQuery('#gpfw_disable_gift_pack_note').change(function() {
     69                if (jQuery(this).is(':checked')) {
     70                    jQuery('#gpfw_gift_pack_note_require').closest('.global_price_value').hide();
     71                    jQuery('#gpfw_enable_gift_pack_note_limit').closest('.global_price_value').hide();
     72                } else {
     73                    jQuery('#gpfw_gift_pack_note_require').closest('.global_price_value').show();
     74                    jQuery('#gpfw_enable_gift_pack_note_limit').closest('.global_price_value').show();
     75                }
     76            });
     77
     78
    5179        });
    5280            //  //Validation for price field of setting screen
     
    237265    return false;
    238266}
     267
     268function openTab(event, tabId) {
     269 
     270    let contents = document.querySelectorAll('.gift_tab_content');
     271    contents.forEach(content => content.classList.remove('active'));
     272    let buttons = document.querySelectorAll('.gift_tabs .tab-button');
     273    buttons.forEach(button => button.classList.remove('active'));
     274    document.getElementById(tabId).classList.add('active');
     275    event.currentTarget.classList.add('active');
     276}
  • gift-pack-for-woocommerce/trunk/admin/partials/gift-pack-for-woocommerce-admin-display.php

    r3144054 r3246471  
    2020    <h2 class="gift_pack_for_woocommerce_title"><?php esc_html_e( 'Gift Pack For Woocommerce' );?></h2>
    2121    <form method="post" action="<?php echo admin_url( 'admin-post.php' ); ?>" enctype="multipart/form-data">
     22        <div class="gift_tabs">
     23            <button type="button" class="tab-button active" onclick="openTab(event, 'gift_tab1')"><?php esc_html_e('General Settings','gift-pack-for-woocommerce'); ?> </button>
     24            <button type="button" class="tab-button" onclick="openTab(event, 'gift_tab2')"><?php esc_html_e('Note Settings','gift-pack-for-woocommerce'); ?> </button>
     25            <button type="button" class="tab-button" onclick="openTab(event, 'gift_tab3')"><?php esc_html_e('Visualization Settings','gift-pack-for-woocommerce');?></button>
     26        </div>
    2227        <input type="hidden" name="action" value="save_gpfw_update_settings" />
    2328        <div class="gift_packs_for_woocommerce">
    24         <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Choose your own gift pack/wrapper images ','gift-pack-for-woocommerce');?></div>
    25             <!-- Image Upload / Update -->
    26             <div class="gpfw_file_uploads">
    27                 <div class="gpfw_gallery_sec">
    28                     <ul class="gpfw_gallery_gallery_mtb">
     29
     30            <div id="gift_tab1" class="gift_tab_content active">
     31
     32                <div class="global_price_value gpfw_global_prices">
     33                    <div class="global_price_title backend_field_title"><?php esc_html_e('Enable Global Price:','gift-pack-for-woocommerce');?>
     34                        <br />
     35                        <small><?php esc_html_e( 'This price will apply to all products globally','gift-pack-for-woocommerce' );?></small>
     36                    </div>
     37
     38                    <div class="global_price_meta">
     39                        <label class="global_price_meta">
     40                            <input type="checkbox" name="gpfw_global_price" id="gpfw_global_price" value="1"
     41                            <?php if($gpfw_options['gpfw_global_price']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?> >
     42                            <span class="slider round"></span>
     43                        </label>
     44                    </div>
     45
     46                </div>
     47                <!--Gift Wrap Price-->
     48                <?php       
     49                    $current_language = apply_filters('wpml_current_language', NULL);
     50                    if ($current_language) {
     51                        $gift_price_option_name = 'gpfw_gift_price' . $current_language;
     52                        $gpfw_gift_price = get_option($gift_price_option_name);
     53
     54                        if (empty($gpfw_gift_price)) {
     55                            // If the stored value is empty, set a default value
     56                            $gpfw_gift_price = '10';
     57                            update_option($gift_price_option_name, $gpfw_gift_price);
     58                        }
     59
     60                        if (isset($_POST['gpfw_gift_price'])) {
     61                            $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_price']);
     62                            update_option($gift_price_option_name, $updated_gift_price);
     63                            $gpfw_gift_price = $updated_gift_price;
     64                        }
     65                    } else {
     66                        // Fallback if WPML is not active
     67                        $gpfw_gift_price = get_option('gpfw_gift_price');
     68
     69                        if (empty($gpfw_gift_price)) {
     70                            // If the stored value is empty, set a default value
     71                            $gpfw_gift_price = '10';
     72                            update_option('gpfw_gift_price', $gpfw_gift_price);
     73                        }
     74
     75                        if (isset($_POST['gpfw_gift_price'])) {
     76                            $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_price']);
     77                            update_option('gpfw_gift_price', $updated_gift_price);
     78                            $gpfw_gift_price = $updated_gift_price;
     79                        }
     80                    }
     81                ?>
     82                <div class="global_price_value">
     83                    <div class="gpfw_gift_price_value backend_field_title"><?php esc_html_e('Gift Wrap Price:', 'gift-pack-for-woocommerce'); ?></div>
     84                        <div class="gpfw_gift_value">
     85                            <input type="text" name="gpfw_gift_price" id="gpfw_gift_price" value="<?php echo esc_attr($gpfw_gift_price); ?>">
     86                        </div>
     87                </div>
     88
     89                <div class="global_price_value gpfw_global_prices"><h3><strong><?php esc_html_e('Change Default Labels:','gift-pack-for-woocommerce');?></strong></h3></div>
     90
     91                <!--Gift Wrap-->
     92                <?php
     93                    $current_language = apply_filters('wpml_current_language', NULL);
     94                    if ($current_language) {
     95                        $gift_wrap_text_option_name = 'gift_wrap_text' . $current_language;
     96
     97                    if (isset($_POST['gift_wrap_text'])) {
     98                        $updated_gift_wrap_text = sanitize_text_field($_POST['gift_wrap_text']);
     99                        update_option($gift_wrap_text_option_name, $updated_gift_wrap_text);
     100                    }
     101                    $gift_wrap_text = get_option($gift_wrap_text_option_name);
     102                    } else {
     103                    $gift_wrap_text = get_option('gift_wrap_text');
     104                    }
     105                ?>
     106
     107                <div class="global_price_value">
     108                    <div class="gpfw_gift_pack_wrap backend_field_title"><?php esc_html_e('Gift Wrap:', 'gift-pack-for-woocommerce'); ?><br />
     109                        <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small>
     110                    </div>
     111                    <div class="gpfw_gift_value">
     112                        <input type="text" name="gift_wrap_text" id="gift_wrap_text" value="<?php echo esc_attr($gift_wrap_text); ?>" placeholder="<?php esc_html_e("Enter your Gift Wrap Text", "gift-pack-for-woocommerce"); ?>">
     113                    </div>
     114                </div>
     115
     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>
     140
     141                <!--Gift Pack Images Label-->
     142                <?php
     143                    $current_language = apply_filters('wpml_current_language', NULL);
     144
     145                    if ($current_language) {
     146                    $gpfw_gift_pack_image_text_option_name = 'gpfw_gift_pack_image_text' . $current_language;
     147
     148                    if (isset($_POST['gpfw_gift_pack_image_text'])) {
     149                        $updated_gift_wrap_image_text = sanitize_text_field($_POST['gpfw_gift_pack_image_text']);
     150                        update_option($gpfw_gift_pack_image_text_option_name, $updated_gift_wrap_image_text);
     151                    }
     152
     153                    $gpfw_gift_pack_image_text = get_option($gpfw_gift_pack_image_text_option_name);
     154                    } else {
     155                    $gpfw_gift_pack_image_text = get_option('gpfw_gift_pack_image_text');
     156                    }
     157                ?>
     158                <div class="global_price_value">
     159                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Images Label:', 'gift-pack-for-woocommerce'); ?><br />
     160                        <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small>
     161                    </div>
     162                    <div class="gpfw_gift_value">
     163                        <input type="text" name="gpfw_gift_pack_image_text" id="gpfw_gift_price" value="<?php echo esc_attr($gpfw_gift_pack_image_text); ?>" placeholder="<?php esc_html_e("Enter your Gift Image Label Text", "gift-pack-for-woocommerce"); ?>">
     164                    </div>
     165                </div>
     166
     167                <?php $current_language = apply_filters('wpml_current_language', NULL);
     168                if ($current_language) {
     169                    $gpfw_choose_gift_limit_key = 'gpfw_choose_gift_limit' . $current_language;
     170
     171                    if (isset($_POST['gpfw_choose_gift_limit'])) {
     172                        $updated_gift_pack_msg = sanitize_text_field($_POST['gpfw_choose_gift_limit']);
     173                        update_option($gpfw_choose_gift_limit_key, $updated_gift_pack_msg);
     174                    }
     175
     176                    $gpfw_choose_gift_limit = get_option($gpfw_choose_gift_limit_key);
     177                } else {
     178                    $gpfw_choose_gift_limit = get_option('gpfw_choose_gift_limit');
     179                } ?>
     180                <div class="global_price_value set_gift_pack_char_imit"
     181                     <?php echo !empty($gpfw_options['gpfw_enable_gift_pack_note_limit']) ? '' : 'style="display:none;"'; ?>>
     182                    <div class="gpfw_gift_pack_message backend_field_title">
     183                        <?php esc_html_e('Set Gift Pack Note Character Limit:', 'gift-pack-for-woocommerce'); ?><br />
     184                    </div>
     185                    <div class="gpfw_gift_value">
     186                        <input type="number" name="gpfw_choose_gift_limit" id="gpfw_choose_gift_limit" value="<?php echo esc_attr($gpfw_choose_gift_limit); ?>">
     187                    </div>
     188                </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                <!--Gift Wrap Label-->
     224                    <?php
     225                        $current_language = apply_filters('wpml_current_language', NULL);
     226                        if ($current_language) {
     227                        $gpfw_gift_wrap_text_label = 'gpfw_gift_wrap_text_label' . $current_language;
     228
     229                        if (isset($_POST['gpfw_gift_wrap_text_label'])) {
     230                            $updated_gift_wrap_text_label = sanitize_text_field($_POST['gpfw_gift_wrap_text_label']);
     231                            update_option($gpfw_gift_wrap_text_label, $updated_gift_wrap_text_label);
     232                        }
     233                        $gpfw_gift_wrap_text_label = get_option($gpfw_gift_wrap_text_label);
     234                        } else {
     235                        $gpfw_gift_wrap_text_label = get_option('gpfw_gift_wrap_text_label');
     236                        }
     237                    ?>
     238                <div class="global_price_value">
     239                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Wrap Label:', 'gift-pack-for-woocommerce'); ?><br />
     240                        <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce'); ?></small>
     241                    </div>
     242                    <div class="gpfw_gift_value">
     243                        <input type="text" name="gpfw_gift_wrap_text_label" id="gpfw_gift_wrap_text_label" value="<?php echo esc_attr($gpfw_gift_wrap_text_label); ?>" placeholder="<?php esc_html_e('Gift Wrap Label', 'gift-pack-for-woocommerce'); ?>">
     244                    </div>
     245                </div>
     246
     247                <!--Choose Gift Pack Image Label-->
     248                <?php $current_language = apply_filters('wpml_current_language', NULL);
     249
     250                    if ($current_language) {
     251                    $gpfw_choose_gift_pack_img = 'gpfw_choose_gift_pack_img' . $current_language;
     252
     253                    if (isset($_POST['gpfw_choose_gift_pack_img'])) {
     254                        $updated_gift_pack_img = sanitize_text_field($_POST['gpfw_choose_gift_pack_img']);
     255                        update_option($gpfw_choose_gift_pack_img, $updated_gift_pack_img);
     256                    }
     257                    $gpfw_choose_gift_pack_img = get_option($gpfw_choose_gift_pack_img);
     258                    } else {
     259                    $gpfw_choose_gift_pack_img = get_option('gpfw_choose_gift_pack_img');
     260                    }
     261                ?>
     262                <div class="global_price_value">
     263                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Choose Gift Pack Image Label:', 'gift-pack-for-woocommerce'); ?><br />
     264                        <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce'); ?></small>
     265                    </div>
     266                    <div class="gpfw_gift_value">
     267                        <input type="text" name="gpfw_choose_gift_pack_img" id="gpfw_gift_wrap_text_label" value="<?php echo esc_attr($gpfw_choose_gift_pack_img); ?>" placeholder="<?php esc_html_e('Choose Gift Pack Image', 'gift-pack-for-woocommerce'); ?>">
     268                    </div>
     269                </div>
     270
     271                <!--Add Gift Pack Message-->
     272                <?php $current_language = apply_filters('wpml_current_language', NULL);
     273
     274                    if ($current_language) {
     275                    $gpfw_choose_gift_pack_msg = 'gpfw_choose_gift_pack_msg' . $current_language;
     276
     277                    if (isset($_POST['gpfw_choose_gift_pack_msg'])) {
     278                        $updated_gift_pack_msg = sanitize_text_field($_POST['gpfw_choose_gift_pack_msg']);
     279                        update_option($gpfw_choose_gift_pack_msg, $updated_gift_pack_msg);
     280                    }
     281
     282                    $gpfw_choose_gift_pack_msg = get_option($gpfw_choose_gift_pack_msg);
     283                    } else {
     284                    $gpfw_choose_gift_pack_msg = get_option('gpfw_choose_gift_pack_msg');
     285                    }
     286                ?>
     287                <div class="global_price_value">
     288                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Add Gift Pack Message', 'gift-pack-for-woocommerce'); ?><br />
     289                        <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce'); ?></small>
     290                    </div>
     291                    <div class="gpfw_gift_value">
     292                        <input type="text" name="gpfw_choose_gift_pack_msg" id="gpfw_choose_gift_pack_msg" value="<?php echo esc_attr($gpfw_choose_gift_pack_msg); ?>" placeholder="<?php esc_html_e("Add Gift Pack Message", "gift-pack-for-woocommerce"); ?>">
     293                    </div>
     294                </div>
     295
     296
     297                <!--Gift Background Image-->
     298                <?php
     299                    $current_language = apply_filters('wpml_current_language', NULL);
     300
     301                    if ($current_language) {
     302                    $gpfw_gift_pack_bg_img = 'gpfw_gift_pack_bg_img' . $current_language;
     303
     304                    if (isset($_POST['gpfw_gift_pack_bg_img'])) {
     305                        $updated_gift_pack_bg_img = sanitize_text_field($_POST['gpfw_gift_pack_bg_img']);
     306                        update_option($gpfw_gift_pack_bg_img, $updated_gift_pack_bg_img);
     307                    }
     308
     309                    $gpfw_gift_pack_bg_img = get_option($gpfw_gift_pack_bg_img);
     310                    } else {
     311                    $gpfw_gift_pack_bg_img = get_option('gpfw_gift_pack_bg_img');
     312                    }
     313                ?>
     314                <div class="global_price_value">
     315                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Background Image', 'gift-pack-for-woocommerce'); ?>
     316                        <br />
     317                        <small><?php esc_html_e('Please use 78px*198px size image (Frontend Gift BG Image)', 'gift-pack-for-woocommerce'); ?></small>
     318                    </div>
     319                    <input type="text" name="gpfw_gift_pack_bg_img" id="gpfw_gift_pack_bg_img" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_gift_pack_bg_img); ?>">
     320                    <input id="gpfw_gift_pack_bg_img_btn" class="button" type="button" value="Upload Image" />
     321                </div>
     322                <div class="global_price_value">
     323                    <div class="gpfw_gift_pack_message backend_field_title">
     324                        <?php esc_html_e('Enable Category Wise Gift Pack Option','gift-pack-for-woocommerce');?>
     325                    </div>
     326                    <label class="global_price_meta">
     327                        <input type="checkbox" name="gpfw_cat_enable" id="gpfw_cat_enable" value="yes" <?php echo esc_attr($gpfw_options['gpfw_cat_enable'] == 'yes' ? 'checked' : ''); ?>>
     328                        <span class="slider round"></span>
     329                    </label>
     330                </div>
     331
     332                <div class="global_price_value" id="gpfw_product_category" style="display: <?php echo esc_attr($gpfw_options['gpfw_cat_enable'] == 'yes' ? 'flex' : 'none'); ?>;">
     333                    <div class="gpfw_gift_pack_message backend_field_title">
     334                        <?php esc_html_e('Product Categories','gift-pack-for-woocommerce');?>
     335                    </div>
     336                    <ul>
    29337                        <?php
    30                             $hidden = array();
    31                             if( $images = get_posts( array(
    32                                 'post_type' => 'attachment',
    33                                 'orderby' => 'post__in',
    34                                 'order' => 'ASC',
    35                                 'post__in' => explode(',',$gpfw_options['gpfw_gallery']),
    36                                 'numberposts' => -1,
    37                                 'post_mime_type' => 'image'
    38                             ) ) ) {
    39                             foreach( $images as $image ) {
    40                                     $hidden[] = $image->ID;
    41                                     $image_src = wp_get_attachment_image_src( $image->ID, array( 80, 80 ) );
    42                                     $gpfw_gallery_image_alt = get_post_meta($image->ID, '_wp_attachment_image_alt', TRUE);
    43                                     $url = site_url();
    44                                     $gpfw_gallery_url = $url . '/wp-admin/upload.php?item=' . $image->ID ;
    45                                     ?>
    46                         <li data-id="<?php echo esc_attr($image->ID);  ?>">
    47                             <a id="gpfw_uploaded_gallery_url"><img src="<?php echo esc_url($image_src[0]); ?>" alt="<?php echo esc_attr($gpfw_gallery_image_alt); ?>" /></a><a href="#" class="gpfw_gallery_gallery_remove">&times;</a>
    48                         </li>
    49 
    50                         <?php }
    51 
    52                             } ?>
     338                            wp_terms_checklist(
     339                                '',
     340                                array(
     341                                    'taxonomy' => 'product_cat',
     342                                    'selected_cats' => $gpfw_options['gpfw_pro_cat'],
     343                                )
     344                            );
     345                        ?>
    53346                    </ul>
    54                     <div style="clear:both"></div>
    55                 </div>
    56                 <input type="hidden" name="gpfw_gallery" value="<?php echo esc_attr(join(',',$hidden)); ?>"
    57                     class="file-input" />
    58                 <a href="#" class="button gpfw_gallery_upload_gallery_button"><?php esc_html_e('Click here to add gift pack/wrapper images','gift-pack-for-woocommerce');?></a>
    59                 <?php if ( ! did_action( 'wp_enqueue_media' ) ) wp_enqueue_media(); ?>
     347                </div>
     348
     349                <!--Enable Gift Pack Popup-->
     350                <div class="global_price_value">
     351                    <div class="gpfw_gift_pack_message backend_field_title">
     352                        <?php esc_html_e('Enable Gift Pack Popup', 'gift-pack-for-woocommerce'); ?>
     353                    </div>
     354                    <label class="global_price_meta">
     355                        <input type="checkbox" name="gpfw_popup_option" id="gpfw_popup_option" value="yes" <?php echo empty($gpfw_options['gpfw_popup_option']) ? '' : 'checked'; ?>>
     356                        <span class="slider round"></span>
     357                    </label>
     358                </div>
    60359            </div>
    61             <div class="global_price_value">
    62                 <div class="global_price_title backend_field_title"><?php esc_html_e('Disable Gift Pack Images:','gift-pack-for-woocommerce');?></div>
    63                 <div class="global_price_meta">
    64                     <input type="checkbox" name="gpfw_disable_gift_pack_images" id="gpfw_disable_gift_pack_images" value="1"
    65                     <?php if($gpfw_options['gpfw_disable_gift_pack_images']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>>
     360
     361            <div id="gift_tab2" class="gift_tab_content">
     362                <div class="global_price_value">
     363                    <div class="global_price_title backend_field_title"><?php esc_html_e('Disable Gift Pack (To):','gift-pack-for-woocommerce');?></div>
     364                    <label class="global_price_meta">
     365                        <input type="checkbox" name="gpfw_disable_gift_pack_to" id="gpfw_disable_gift_pack_to" value="1" <?php if($gpfw_options['gpfw_disable_gift_pack_to']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>>
     366                        <span class="slider round"></span>
     367                    </label>
     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>
     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                <div class="global_price_value" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_to']) ? 'none' : ''; ?>">
     385                    <div class="global_price_title backend_field_title"><?php esc_html_e('Require Gift Pack (To):','gift-pack-for-woocommerce');?></div>
     386                    <label class="global_price_meta">
     387                        <input type="checkbox" name="gpfw_gift_pack_to_require" id="gpfw_gift_pack_to_require" value="1" <?php if($gpfw_options['gpfw_gift_pack_to_require']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>>
     388                        <span class="slider round"></span>
     389                    </label>
     390                </div>
     391
     392                <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>
     394                    <label class="global_price_meta">
     395                        <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 '';?>>
     396                        <span class="slider round"></span>
     397                    </label>
     398                </div>
     399                <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>
     401                    <label class="global_price_meta">
     402                        <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 '';?>>
     403                        <span class="slider round"></span>
     404                    </label>
     405                </div>
     406                <!--Enable Gift Pack Note Character Limit-->
     407                <div class="global_price_value char_gift_pack" style="display:<?php echo ($gpfw_options['gpfw_disable_gift_pack_note']) ? 'none' : ''; ?>">
     408                    <div class="global_price_title backend_field_title"><?php esc_html_e('Enable Gift Pack Note Character Limit:', 'gift-pack-for-woocommerce'); ?></div>
     409                    <label class="global_price_meta">
     410                        <input type="checkbox" name="gpfw_enable_gift_pack_note_limit" id="gpfw_enable_gift_pack_note_limit" value="1"
     411                        <?php if ($gpfw_options['gpfw_enable_gift_pack_note_limit']) esc_html_e('checked="checked"', 'gift-pack-for-woocommerce'); ?>>
     412                        <span class="slider round"></span>
     413                    </label>
    66414                </div>
    67415            </div>
    68             <div class="global_price_value gpfw_global_prices">
    69                 <div class="global_price_title backend_field_title"><?php esc_html_e('Enable Global Price:','gift-pack-for-woocommerce');?>
    70                 <br />
    71                 <small><?php esc_html_e( 'This price will apply to all products globally','gift-pack-for-woocommerce' );?></small>
    72                  </div>
    73                 <div class="global_price_meta">
    74                     <input type="checkbox" name="gpfw_global_price" id="gpfw_global_price" value="1"
    75                     <?php if($gpfw_options['gpfw_global_price']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?> >
     416
     417            <div id="gift_tab3" class="gift_tab_content">
     418
     419                <div class="global_price_value">
     420                    <div class="global_price_title backend_field_title"><?php esc_html_e('Disable Gift Pack Images:','gift-pack-for-woocommerce');?></div>
     421                    <label class="global_price_meta">
     422                        <input type="checkbox" name="gpfw_disable_gift_pack_images" id="gpfw_disable_gift_pack_images" value="1"
     423                        <?php if($gpfw_options['gpfw_disable_gift_pack_images']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>>
     424                        <span class="slider round"></span>
     425                    </label>
     426                </div>
     427
     428                <div class="gpfw_gift_pack_message backend_field_title global_price_value"><?php esc_html_e('Choose your own gift pack/wrapper images ','gift-pack-for-woocommerce');?>
     429                </div>
     430                <!-- Image Upload / Update -->
     431                <div class="gpfw_file_uploads">
     432                    <div class="gpfw_gallery_sec">
     433                        <ul class="gpfw_gallery_gallery_mtb">
     434                            <?php
     435                                $hidden = array();
     436                                if( $images = get_posts( array(
     437                                    'post_type' => 'attachment',
     438                                    'orderby' => 'post__in',
     439                                    'order' => 'ASC',
     440                                    'post__in' => explode(',',$gpfw_options['gpfw_gallery']),
     441                                    'numberposts' => -1,
     442                                    'post_mime_type' => 'image'
     443                                ) ) ) {
     444                                foreach( $images as $image ) {
     445                                        $hidden[] = $image->ID;
     446                                        $image_src = wp_get_attachment_image_src( $image->ID, array( 80, 80 ) );
     447                                        $gpfw_gallery_image_alt = get_post_meta($image->ID, '_wp_attachment_image_alt', TRUE);
     448                                        $url = site_url();
     449                                        $gpfw_gallery_url = $url . '/wp-admin/upload.php?item=' . $image->ID ;
     450                                        ?>
     451                            <li data-id="<?php echo esc_attr($image->ID);  ?>">
     452                                <a id="gpfw_uploaded_gallery_url"><img src="<?php echo esc_url($image_src[0]); ?>" alt="<?php echo esc_attr($gpfw_gallery_image_alt); ?>" /></a><a href="#" class="gpfw_gallery_gallery_remove">&times;</a>
     453                            </li>
     454
     455                            <?php }
     456
     457                                } ?>
     458                        </ul>
     459                        <div style="clear:both"></div>
     460                    </div>
     461                    <input type="hidden" name="gpfw_gallery" value="<?php echo esc_attr(join(',',$hidden)); ?>"
     462                        class="file-input" />
     463                    <a href="#" class="button gpfw_gallery_upload_gallery_button"><?php esc_html_e('Click here to add gift pack/wrapper images','gift-pack-for-woocommerce');?></a>
     464                    <?php if ( ! did_action( 'wp_enqueue_media' ) ) wp_enqueue_media(); ?>
     465                </div>
     466
     467                <!--Gift Pack Background Color-->
     468                <?php $current_language = apply_filters('wpml_current_language', NULL);
     469                    if ($current_language) {
     470                    $gpfw_gift_pack_bg_color = 'gpfw_gift_pack_bg_color' . $current_language;
     471
     472                    if (isset($_POST['gpfw_gift_pack_bg_color'])) {
     473                        $updated_gift_pack_bg_color = sanitize_text_field($_POST['gpfw_gift_pack_bg_color']);
     474                        update_option($gpfw_gift_pack_bg_color, $updated_gift_pack_bg_color);
     475                    }
     476
     477                        $gpfw_gift_pack_bg_color = get_option($gpfw_gift_pack_bg_color);
     478                    } else {
     479                        $gpfw_gift_pack_bg_color = get_option('gpfw_gift_pack_bg_color');
     480                    }
     481                ?>
     482                <div class="global_price_value">
     483                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Background Color','gift-pack-for-woocommerce');?><br />
     484                        <small><?php esc_html_e('Used in Product Details (Frontend)','gift-pack-for-woocommerce');?></small>
     485                    </div>
     486                    <input type="text" name="gpfw_gift_pack_bg_color" id="gpfw_gift_pack_bg_color" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_gift_pack_bg_color); ?>">
     487                </div>
     488
     489                <!--Gift Pack Title Color-->
     490                <?php $current_language = apply_filters('wpml_current_language', NULL);
     491                    $gpfw_giftwrap_base_gift_title_color = '';
     492                    if ($current_language) {
     493                        $gpfw_giftwrap_base_gift_title_color = 'gpfw_giftwrap_base_gift_title_color' . $current_language;
     494
     495                        if (isset($_POST['gpfw_giftwrap_base_gift_title_color'])) {
     496                            $updated_gift_pack_price_and_checkbox = sanitize_text_field($_POST['gpfw_giftwrap_base_gift_title_color']);
     497                            update_option($gpfw_giftwrap_base_gift_title_color, $updated_gift_pack_price_and_checkbox);
     498                        }
     499
     500                        $gpfw_giftwrap_base_gift_title_color = get_option($gpfw_giftwrap_base_gift_title_color);
     501                    } else {
     502                        $gpfw_giftwrap_base_gift_title_color = get_option('gpfw_giftwrap_base_gift_title_color');
     503                    }
     504                ?>
     505                <div class="global_price_value">
     506                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Title Color', 'gift-pack-for-woocommerce');?>
     507                        <br />
     508                        <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce');?></small>
     509                    </div>
     510                    <input type="text" name="gpfw_giftwrap_base_gift_title_color" id="gpfw_giftwrap_base_gift_title_color" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_giftwrap_base_gift_title_color); ?>">
     511                </div>
     512
     513                <!--Gift Pack Label Color-->
     514                <?php $current_language = apply_filters('wpml_current_language', NULL);
     515                    if ($current_language) {
     516                        $gpfw_add_gift_pack_label_color = 'gpfw_add_gift_pack_label_color' . $current_language;
     517                        if (isset($_POST['gpfw_add_gift_pack_label_color'])) {
     518                            $updated_gift_pack_label_color = sanitize_text_field($_POST['gpfw_add_gift_pack_label_color']);
     519                            update_option($gpfw_add_gift_pack_label_color, $updated_gift_pack_label_color);
     520                        }
     521                        $gpfw_add_gift_pack_label_color = get_option($gpfw_add_gift_pack_label_color);
     522                    } else {
     523                        $gpfw_add_gift_pack_label_color = get_option('gpfw_add_gift_pack_label_color');
     524                    }
     525                ?>
     526
     527                <div class="global_price_value">
     528                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Label Color', 'gift-pack-for-woocommerce'); ?>
     529                        <br />
     530                        <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce'); ?></small>
     531                    </div>
     532                    <input type="text" name="gpfw_add_gift_pack_label_color" id="gpfw_add_gift_pack_label_color" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_add_gift_pack_label_color); ?>">
     533                </div>
     534
     535
     536                <!--Gift Pack Autochange Price & Checkbox Color-->
     537                <?php $current_language = apply_filters('wpml_current_language', NULL);
     538
     539                    if ($current_language) {
     540                        $gpfw_add_gift_pack_price_and_checkbox = 'gpfw_add_gift_pack_price_and_checkbox' . $current_language;
     541                        if (isset($_POST['gpfw_add_gift_pack_price_and_checkbox'])) {
     542                            $updated_gift_pack_price_and_checkbox = sanitize_text_field($_POST['gpfw_add_gift_pack_price_and_checkbox']);
     543                            update_option($gpfw_add_gift_pack_price_and_checkbox, $updated_gift_pack_price_and_checkbox);
     544                        }
     545
     546                        $gpfw_add_gift_pack_price_and_checkbox = get_option($gpfw_add_gift_pack_price_and_checkbox);
     547                    } else {
     548                        $gpfw_add_gift_pack_price_and_checkbox = get_option('gpfw_add_gift_pack_price_and_checkbox');
     549                    }
     550                ?>
     551
     552                <div class="global_price_value">
     553                    <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Autochange Price & Checkbox Color','gift-pack-for-woocommerce');?>
     554                        <br />
     555                        <small><?php esc_html_e( 'Used in Product Details (Frontend)','gift-pack-for-woocommerce' );?></small>
     556                    </div>
     557                    <input type="text" name="gpfw_add_gift_pack_price_and_checkbox" id="gpfw_add_gift_pack_price_and_checkbox" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_add_gift_pack_price_and_checkbox); ?>">
    76558                </div>
    77559            </div>
    78 <!--Gift Wrap Price-->
    79 <?php       
    80     $current_language = apply_filters('wpml_current_language', NULL);
    81     if ($current_language) {
    82         $gift_price_option_name = 'gpfw_gift_price' . $current_language;
    83         $gpfw_gift_price = get_option($gift_price_option_name);
    84 
    85         if (empty($gpfw_gift_price)) {
    86             // If the stored value is empty, set a default value
    87             $gpfw_gift_price = '10';
    88             update_option($gift_price_option_name, $gpfw_gift_price);
    89         }
    90 
    91         if (isset($_POST['gpfw_gift_price'])) {
    92             $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_price']);
    93             update_option($gift_price_option_name, $updated_gift_price);
    94             $gpfw_gift_price = $updated_gift_price;
    95         }
    96     } else {
    97         // Fallback if WPML is not active
    98         $gpfw_gift_price = get_option('gpfw_gift_price');
    99 
    100         if (empty($gpfw_gift_price)) {
    101             // If the stored value is empty, set a default value
    102             $gpfw_gift_price = '10';
    103             update_option('gpfw_gift_price', $gpfw_gift_price);
    104         }
    105 
    106         if (isset($_POST['gpfw_gift_price'])) {
    107             $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_price']);
    108             update_option('gpfw_gift_price', $updated_gift_price);
    109             $gpfw_gift_price = $updated_gift_price;
    110         }
    111     }
    112 ?>
    113 <div class="global_price_value">
    114     <div class="gpfw_gift_price_value backend_field_title"><?php esc_html_e('Gift Wrap Price:', 'gift-pack-for-woocommerce'); ?></div>
    115         <div class="gpfw_gift_value">
    116             <input type="text" name="gpfw_gift_price" id="gpfw_gift_price" value="<?php echo esc_attr($gpfw_gift_price); ?>">
    117         </div>
    118 </div>
    119 
    120 <div class="global_price_value gpfw_global_prices"><h3><strong><?php esc_html_e('Change Default Labels:','gift-pack-for-woocommerce');?></strong></h3></div>
    121 
    122 <!--Gift Wrap-->
    123     <?php
    124         $current_language = apply_filters('wpml_current_language', NULL);
    125         if ($current_language) {
    126             $gift_wrap_text_option_name = 'gift_wrap_text' . $current_language;
    127 
    128         if (isset($_POST['gift_wrap_text'])) {
    129             $updated_gift_wrap_text = sanitize_text_field($_POST['gift_wrap_text']);
    130             update_option($gift_wrap_text_option_name, $updated_gift_wrap_text);
    131         }
    132         $gift_wrap_text = get_option($gift_wrap_text_option_name);
    133         } else {
    134         $gift_wrap_text = get_option('gift_wrap_text');
    135         }
    136     ?>
    137 <div class="global_price_value">
    138     <div class="gpfw_gift_pack_wrap backend_field_title"><?php esc_html_e('Gift Wrap:', 'gift-pack-for-woocommerce'); ?><br />
    139         <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small>
    140     </div>
    141     <div class="gpfw_gift_value">
    142         <input type="text" name="gift_wrap_text" id="gift_wrap_text" value="<?php echo esc_attr($gift_wrap_text); ?>" placeholder="<?php esc_html_e("Enter your Gift Wrap Text", "gift-pack-for-woocommerce"); ?>">
    143     </div>
    144 </div>
    145 
    146 <!--Gift Pack Greeting Label-->
    147     <?php
    148         $current_language = apply_filters('wpml_current_language', NULL);
    149         if ($current_language) {
    150             $gpfw_gift_pack_message_text_option_name = 'gpfw_gift_pack_message_text' . $current_language;
    151 
    152         if (isset($_POST['gpfw_gift_pack_message_text'])) {
    153             $updated_gift_wrap_message_text = sanitize_text_field($_POST['gpfw_gift_pack_message_text']);
    154             update_option($gpfw_gift_pack_message_text_option_name, $updated_gift_wrap_message_text);
    155         }
    156 
    157         $gpfw_gift_pack_message_text = get_option($gpfw_gift_pack_message_text_option_name);
    158     } else {
    159         $gpfw_gift_pack_message_text = get_option('gpfw_gift_pack_message_text');
    160     }
    161     ?>
    162 <div class="global_price_value">
    163     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Greeting Label:', 'gift-pack-for-woocommerce'); ?><br />
    164         <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small>
    165     </div>
    166     <div class="gpfw_gift_value">
    167         <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"); ?>">
    168     </div>
    169 </div>
    170 
    171 
    172 <!--Gift Pack Images Label-->
    173     <?php
    174         $current_language = apply_filters('wpml_current_language', NULL);
    175 
    176         if ($current_language) {
    177         $gpfw_gift_pack_image_text_option_name = 'gpfw_gift_pack_image_text' . $current_language;
    178 
    179         if (isset($_POST['gpfw_gift_pack_image_text'])) {
    180             $updated_gift_wrap_image_text = sanitize_text_field($_POST['gpfw_gift_pack_image_text']);
    181             update_option($gpfw_gift_pack_image_text_option_name, $updated_gift_wrap_image_text);
    182         }
    183 
    184         $gpfw_gift_pack_image_text = get_option($gpfw_gift_pack_image_text_option_name);
    185         } else {
    186         $gpfw_gift_pack_image_text = get_option('gpfw_gift_pack_image_text');
    187         }
    188     ?>
    189 <div class="global_price_value">
    190     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Images Label:', 'gift-pack-for-woocommerce'); ?><br />
    191         <small><?php esc_html_e('Used at Cart/Checkout', 'gift-pack-for-woocommerce'); ?></small>
    192     </div>
    193     <div class="gpfw_gift_value">
    194         <input type="text" name="gpfw_gift_pack_image_text" id="gpfw_gift_price" value="<?php echo esc_attr($gpfw_gift_pack_image_text); ?>" placeholder="<?php esc_html_e("Enter your Gift Image Label Text", "gift-pack-for-woocommerce"); ?>">
    195     </div>
    196 </div>
    197 
    198 <div class="global_price_value">
    199     <div class="global_price_title backend_field_title"><?php esc_html_e('Disable Gift Pack Note:','gift-pack-for-woocommerce');?></div>
    200         <div class="global_price_meta">
    201             <input type="checkbox" name="gpfw_disable_gift_pack_note" id="gpfw_disable_gift_pack_note" value="1"
    202         <?php if($gpfw_options['gpfw_disable_gift_pack_note']) esc_html_e('checked="checked"','gift-pack-for-woocommerce'); else '';?>>
    203     </div>
    204 </div>
    205 <!--Enable Gift Pack Note Character Limit-->
    206 <div class="global_price_value char_gift_pack">
    207     <div class="global_price_title backend_field_title"><?php esc_html_e('Enable Gift Pack Note Character Limit:', 'gift-pack-for-woocommerce'); ?></div>
    208     <div class="global_price_meta">
    209         <input type="checkbox" name="gpfw_enable_gift_pack_note_limit" id="gpfw_enable_gift_pack_note_limit" value="1"
    210         <?php if ($gpfw_options['gpfw_enable_gift_pack_note_limit']) esc_html_e('checked="checked"', 'gift-pack-for-woocommerce'); ?>>
    211     </div>
    212 </div>
    213 
    214 
    215 <?php
    216 $current_language = apply_filters('wpml_current_language', NULL);
    217 if ($current_language) {
    218     $gpfw_choose_gift_limit_key = 'gpfw_choose_gift_limit' . $current_language;
    219 
    220     if (isset($_POST['gpfw_choose_gift_limit'])) {
    221         $updated_gift_pack_msg = sanitize_text_field($_POST['gpfw_choose_gift_limit']);
    222         update_option($gpfw_choose_gift_limit_key, $updated_gift_pack_msg);
    223     }
    224 
    225     $gpfw_choose_gift_limit = get_option($gpfw_choose_gift_limit_key);
    226 } else {
    227     $gpfw_choose_gift_limit = get_option('gpfw_choose_gift_limit');
    228 } ?>
    229 <div class="global_price_value set_gift_pack_char_imit"
    230      <?php echo !empty($gpfw_options['gpfw_enable_gift_pack_note_limit']) ? '' : 'style="display:none;"'; ?>>
    231     <div class="gpfw_gift_pack_message backend_field_title">
    232         <?php esc_html_e('Set Gift Pack Note Character Limit:', 'gift-pack-for-woocommerce'); ?><br />
    233     </div>
    234     <div class="gpfw_gift_value">
    235         <input type="number" name="gpfw_choose_gift_limit" id="gpfw_choose_gift_limit" value="<?php echo esc_attr($gpfw_choose_gift_limit); ?>">
    236     </div>
    237 </div>
    238 
    239 
    240 <!--Placeholder Texts for Greeting Message-->
    241     <?php
    242         $current_language = apply_filters('wpml_current_language', NULL);
    243         if ($current_language) {
    244         $gift_price_option_name = 'gpfw_gift_pack_note_placeholder' . $current_language;
    245 
    246         if (isset($_POST['gpfw_gift_pack_note_placeholder'])) {
    247             $updated_gift_price = sanitize_text_field($_POST['gpfw_gift_pack_note_placeholder']);
    248             update_option($gift_price_option_name, $updated_gift_price);
    249         }
    250 
    251         $gpfw_gift_pack_note_placeholder = get_option($gift_price_option_name);
    252         } else {
    253         $gpfw_gift_pack_note_placeholder = get_option('gpfw_gift_pack_note_placeholder');
    254         }
    255         $current_language = apply_filters('wpml_current_language', NULL);
    256         if ($current_language) {
    257             $gpfw_gift_pack_note_placeholder = 'gpfw_gift_pack_note_placeholder' . $current_language;
    258             if (isset($_POST['gpfw_gift_pack_note_placeholder'])) {
    259                 $updated_gift_pack_note_placeholder = sanitize_text_field($_POST['gpfw_gift_pack_note_placeholder']);
    260                 update_option($gpfw_gift_pack_note_placeholder, $updated_gift_pack_note_placeholder);
    261             }
    262             $gpfw_gift_pack_note_placeholder = get_option($gpfw_gift_pack_note_placeholder);
    263         }
    264     ?>
    265     <div class="global_price_value">
    266         <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Placeholder Texts for Greeting Message:', 'gift-pack-for-woocommerce'); ?><br />
    267             <small><?php esc_html_e('Used in Product Details', 'gift-pack-for-woocommerce'); ?></small>
    268         </div>
    269         <div class="gpfw_gift_value">
    270             <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"); ?>">
    271         </div>
    272     </div>
    273 
    274 <!--Gift Wrap Label-->
    275     <?php
    276         $current_language = apply_filters('wpml_current_language', NULL);
    277         if ($current_language) {
    278         $gpfw_gift_wrap_text_label = 'gpfw_gift_wrap_text_label' . $current_language;
    279 
    280         if (isset($_POST['gpfw_gift_wrap_text_label'])) {
    281             $updated_gift_wrap_text_label = sanitize_text_field($_POST['gpfw_gift_wrap_text_label']);
    282             update_option($gpfw_gift_wrap_text_label, $updated_gift_wrap_text_label);
    283         }
    284         $gpfw_gift_wrap_text_label = get_option($gpfw_gift_wrap_text_label);
    285         } else {
    286         $gpfw_gift_wrap_text_label = get_option('gpfw_gift_wrap_text_label');
    287         }
    288     ?>
    289 <div class="global_price_value">
    290     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Wrap Label:', 'gift-pack-for-woocommerce'); ?><br />
    291         <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce'); ?></small>
    292     </div>
    293     <div class="gpfw_gift_value">
    294         <input type="text" name="gpfw_gift_wrap_text_label" id="gpfw_gift_wrap_text_label" value="<?php echo esc_attr($gpfw_gift_wrap_text_label); ?>" placeholder="<?php esc_html_e('Gift Wrap Label', 'gift-pack-for-woocommerce'); ?>">
    295     </div>
    296 </div>
    297 
    298 <!--Choose Gift Pack Image Label-->
    299     <?php
    300         $current_language = apply_filters('wpml_current_language', NULL);
    301 
    302         if ($current_language) {
    303         $gpfw_choose_gift_pack_img = 'gpfw_choose_gift_pack_img' . $current_language;
    304 
    305         if (isset($_POST['gpfw_choose_gift_pack_img'])) {
    306             $updated_gift_pack_img = sanitize_text_field($_POST['gpfw_choose_gift_pack_img']);
    307             update_option($gpfw_choose_gift_pack_img, $updated_gift_pack_img);
    308         }
    309         $gpfw_choose_gift_pack_img = get_option($gpfw_choose_gift_pack_img);
    310         } else {
    311         $gpfw_choose_gift_pack_img = get_option('gpfw_choose_gift_pack_img');
    312         }
    313     ?>
    314 <div class="global_price_value">
    315     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Choose Gift Pack Image Label:', 'gift-pack-for-woocommerce'); ?><br />
    316         <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce'); ?></small>
    317     </div>
    318     <div class="gpfw_gift_value">
    319         <input type="text" name="gpfw_choose_gift_pack_img" id="gpfw_gift_wrap_text_label" value="<?php echo esc_attr($gpfw_choose_gift_pack_img); ?>" placeholder="<?php esc_html_e('Choose Gift Pack Image', 'gift-pack-for-woocommerce'); ?>">
    320     </div>
    321 </div>
    322 
    323 <!--Add Gift Pack Message-->
    324     <?php
    325         $current_language = apply_filters('wpml_current_language', NULL);
    326 
    327         if ($current_language) {
    328         $gpfw_choose_gift_pack_msg = 'gpfw_choose_gift_pack_msg' . $current_language;
    329 
    330         if (isset($_POST['gpfw_choose_gift_pack_msg'])) {
    331             $updated_gift_pack_msg = sanitize_text_field($_POST['gpfw_choose_gift_pack_msg']);
    332             update_option($gpfw_choose_gift_pack_msg, $updated_gift_pack_msg);
    333         }
    334 
    335         $gpfw_choose_gift_pack_msg = get_option($gpfw_choose_gift_pack_msg);
    336         } else {
    337         $gpfw_choose_gift_pack_msg = get_option('gpfw_choose_gift_pack_msg');
    338         }
    339     ?>
    340 <div class="global_price_value">
    341     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Add Gift Pack Message', 'gift-pack-for-woocommerce'); ?><br />
    342         <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce'); ?></small>
    343     </div>
    344     <div class="gpfw_gift_value">
    345         <input type="text" name="gpfw_choose_gift_pack_msg" id="gpfw_choose_gift_pack_msg" value="<?php echo esc_attr($gpfw_choose_gift_pack_msg); ?>" placeholder="<?php esc_html_e("Add Gift Pack Message", "gift-pack-for-woocommerce"); ?>">
    346     </div>
    347 </div>
    348 
    349 
    350 <!--Gift Background Image-->
    351     <?php
    352         $current_language = apply_filters('wpml_current_language', NULL);
    353 
    354         if ($current_language) {
    355         $gpfw_gift_pack_bg_img = 'gpfw_gift_pack_bg_img' . $current_language;
    356 
    357         if (isset($_POST['gpfw_gift_pack_bg_img'])) {
    358             $updated_gift_pack_bg_img = sanitize_text_field($_POST['gpfw_gift_pack_bg_img']);
    359             update_option($gpfw_gift_pack_bg_img, $updated_gift_pack_bg_img);
    360         }
    361 
    362         $gpfw_gift_pack_bg_img = get_option($gpfw_gift_pack_bg_img);
    363         } else {
    364         $gpfw_gift_pack_bg_img = get_option('gpfw_gift_pack_bg_img');
    365         }
    366     ?>
    367 <div class="global_price_value">
    368     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Background Image', 'gift-pack-for-woocommerce'); ?>
    369         <br />
    370         <small><?php esc_html_e('Please use 78px*198px size image (Frontend Gift BG Image)', 'gift-pack-for-woocommerce'); ?></small>
    371     </div>
    372     <input type="text" name="gpfw_gift_pack_bg_img" id="gpfw_gift_pack_bg_img" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_gift_pack_bg_img); ?>">
    373     <input id="gpfw_gift_pack_bg_img_btn" class="button" type="button" value="Upload Image" />
    374 </div>
    375 
    376 <!--Gift Pack Background Color-->
    377     <?php
    378     $current_language = apply_filters('wpml_current_language', NULL);
    379         if ($current_language) {
    380         $gpfw_gift_pack_bg_color = 'gpfw_gift_pack_bg_color' . $current_language;
    381 
    382         if (isset($_POST['gpfw_gift_pack_bg_color'])) {
    383             $updated_gift_pack_bg_color = sanitize_text_field($_POST['gpfw_gift_pack_bg_color']);
    384             update_option($gpfw_gift_pack_bg_color, $updated_gift_pack_bg_color);
    385         }
    386 
    387         $gpfw_gift_pack_bg_color = get_option($gpfw_gift_pack_bg_color);
    388         } else {
    389         $gpfw_gift_pack_bg_color = get_option('gpfw_gift_pack_bg_color');
    390         }
    391     ?>
    392 
    393 <div class="global_price_value">
    394     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Background Color','gift-pack-for-woocommerce');?><br />
    395         <small><?php esc_html_e('Used in Product Details (Frontend)','gift-pack-for-woocommerce');?></small>
    396     </div>
    397     <input type="text" name="gpfw_gift_pack_bg_color" id="gpfw_gift_pack_bg_color" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_gift_pack_bg_color); ?>">
    398 </div>
    399 
    400 <!--Gift Pack Title Color-->
    401 <?php
    402     $current_language = apply_filters('wpml_current_language', NULL);
    403     $gpfw_giftwrap_base_gift_title_color = '';
    404     if ($current_language) {
    405         $gpfw_giftwrap_base_gift_title_color = 'gpfw_giftwrap_base_gift_title_color' . $current_language;
    406 
    407         if (isset($_POST['gpfw_giftwrap_base_gift_title_color'])) {
    408             $updated_gift_pack_price_and_checkbox = sanitize_text_field($_POST['gpfw_giftwrap_base_gift_title_color']);
    409             update_option($gpfw_giftwrap_base_gift_title_color, $updated_gift_pack_price_and_checkbox);
    410         }
    411 
    412         $gpfw_giftwrap_base_gift_title_color = get_option($gpfw_giftwrap_base_gift_title_color);
    413     } else {
    414         $gpfw_giftwrap_base_gift_title_color = get_option('gpfw_giftwrap_base_gift_title_color');
    415     }
    416 ?>
    417 <div class="global_price_value">
    418     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Title Color', 'gift-pack-for-woocommerce');?>
    419         <br />
    420         <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce');?></small>
    421     </div>
    422     <input type="text" name="gpfw_giftwrap_base_gift_title_color" id="gpfw_giftwrap_base_gift_title_color" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_giftwrap_base_gift_title_color); ?>">
    423 </div>
    424 
    425 <!--Gift Pack Label Color-->
    426 <?php
    427     $current_language = apply_filters('wpml_current_language', NULL);
    428     if ($current_language) {
    429     $gpfw_add_gift_pack_label_color = 'gpfw_add_gift_pack_label_color' . $current_language;
    430 
    431     if (isset($_POST['gpfw_add_gift_pack_label_color'])) {
    432         $updated_gift_pack_label_color = sanitize_text_field($_POST['gpfw_add_gift_pack_label_color']);
    433         update_option($gpfw_add_gift_pack_label_color, $updated_gift_pack_label_color);
    434     }
    435 
    436     $gpfw_add_gift_pack_label_color = get_option($gpfw_add_gift_pack_label_color);
    437     } else {
    438     $gpfw_add_gift_pack_label_color = get_option('gpfw_add_gift_pack_label_color');
    439     }
    440 ?>
    441 <div class="global_price_value">
    442     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Label Color', 'gift-pack-for-woocommerce'); ?>
    443         <br />
    444         <small><?php esc_html_e('Used in Product Details (Frontend)', 'gift-pack-for-woocommerce'); ?></small>
    445     </div>
    446     <input type="text" name="gpfw_add_gift_pack_label_color" id="gpfw_add_gift_pack_label_color" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_add_gift_pack_label_color); ?>">
    447 </div>
    448 
    449 
    450 <!--Gift Pack Autochange Price & Checkbox Color-->
    451 <?php
    452     $current_language = apply_filters('wpml_current_language', NULL);
    453 
    454     if ($current_language) {
    455     $gpfw_add_gift_pack_price_and_checkbox = 'gpfw_add_gift_pack_price_and_checkbox' . $current_language;
    456 
    457     if (isset($_POST['gpfw_add_gift_pack_price_and_checkbox'])) {
    458         $updated_gift_pack_price_and_checkbox = sanitize_text_field($_POST['gpfw_add_gift_pack_price_and_checkbox']);
    459         update_option($gpfw_add_gift_pack_price_and_checkbox, $updated_gift_pack_price_and_checkbox);
    460     }
    461 
    462     $gpfw_add_gift_pack_price_and_checkbox = get_option($gpfw_add_gift_pack_price_and_checkbox);
    463     } else {
    464         $gpfw_add_gift_pack_price_and_checkbox = get_option('gpfw_add_gift_pack_price_and_checkbox');
    465     }
    466 ?>
    467 <div class="global_price_value">
    468     <div class="gpfw_gift_pack_message backend_field_title"><?php esc_html_e('Gift Pack Autochange Price & Checkbox Color','gift-pack-for-woocommerce');?>
    469         <br />
    470         <small><?php esc_html_e( 'Used in Product Details (Frontend)','gift-pack-for-woocommerce' );?></small>
    471     </div>
    472     <input type="text" name="gpfw_add_gift_pack_price_and_checkbox" id="gpfw_add_gift_pack_price_and_checkbox" maxlength="255" size="25" value="<?php echo esc_attr($gpfw_add_gift_pack_price_and_checkbox); ?>">
    473 </div>
    474 
    475 <div class="global_price_value">
    476     <div class="gpfw_gift_pack_message backend_field_title">
    477         <?php esc_html_e('Enable Category Wise Gift Pack Option','gift-pack-for-woocommerce');?>
    478     </div>
    479     <input type="checkbox" name="gpfw_cat_enable" id="gpfw_cat_enable" value="yes" <?php echo esc_attr($gpfw_options['gpfw_cat_enable'] == 'yes' ? 'checked' : ''); ?>>
    480 </div>
    481 <div class="global_price_value" id="gpfw_product_category" style="display: <?php echo esc_attr($gpfw_options['gpfw_cat_enable'] == 'yes' ? 'flex' : 'none'); ?>;">
    482     <div class="gpfw_gift_pack_message backend_field_title">
    483         <?php esc_html_e('Product Categories','gift-pack-for-woocommerce');?>
    484     </div>
    485         <ul>
    486             <?php
    487                 wp_terms_checklist(
    488                     '',
    489                     array(
    490                         'taxonomy' => 'product_cat',
    491                         'selected_cats' => $gpfw_options['gpfw_pro_cat'],
    492                     )
    493                 );
    494             ?>
    495         </ul>
    496         </div>
    497 
    498     <!--Enable Gift Pack Popup-->
    499     <div class="global_price_value">
    500     <div class="gpfw_gift_pack_message backend_field_title">
    501         <?php esc_html_e('Enable Gift Pack Popup', 'gift-pack-for-woocommerce'); ?>
    502     </div>
    503         <input type="checkbox" name="gpfw_popup_option" id="gpfw_popup_option" value="yes" <?php echo empty($gpfw_options['gpfw_popup_option']) ? '' : 'checked'; ?>>
    504     </div>
    505         <div class="submit gpfw_save_changes_btn">
    506             <input type="submit" name="Submit" class="button-primary" value="<?php echo esc_attr( 'Save Changes' ) ?>" />
    507         </div>
     560
     561            <div class="submit gpfw_save_changes_btn">
     562                <input type="submit" name="Submit" class="button-primary" value="<?php echo esc_attr( 'Save Changes' ) ?>" />
     563            </div>
    508564        </div>
    509565    </form>
  • gift-pack-for-woocommerce/trunk/gift-pack-for-woocommerce.php

    r3169892 r3246471  
    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.0
     19 * Version:           2.0.1
    2020 * Author:            IT Path Solutions
    2121 * Author URI:        https://www.itpathsolutions.com/
     22 * Requires Plugins:  woocommerce
    2223 * License:           GPL-2.0+
    2324 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     
    3637 * Rename this for your plugin and update it as you release new versions.
    3738 */
    38 define( 'GIFT_PACK_FOR_WOOCOMMERCE_VERSION', '2.0.0' );
     39define( 'GIFT_PACK_FOR_WOOCOMMERCE_VERSION', '2.0.1' );
    3940
    4041/**
  • gift-pack-for-woocommerce/trunk/includes/class-gift-pack-for-woocommerce.php

    r3144054 r3246471  
    198198        $options['gpfw_disable_gift_pack_note'] = get_option( $gpfw_disable_gift_pack_note );
    199199
     200        $gpfw_disable_gift_pack_to = 'gpfw_disable_gift_pack_to' . $current_language;
     201        $options['gpfw_disable_gift_pack_to'] = get_option( $gpfw_disable_gift_pack_to );
     202
     203        $gpfw_disable_gift_pack_from = 'gpfw_disable_gift_pack_from' . $current_language;
     204        $options['gpfw_disable_gift_pack_from'] = get_option( $gpfw_disable_gift_pack_from );   
     205
     206
     207        $gpfw_gift_pack_to_require = 'gpfw_gift_pack_to_require' . $current_language;
     208        $options['gpfw_gift_pack_to_require'] = get_option( $gpfw_gift_pack_to_require );
     209
     210        $gpfw_gift_pack_from_require = 'gpfw_gift_pack_from_require' . $current_language;
     211        $options['gpfw_gift_pack_from_require'] = get_option( $gpfw_gift_pack_from_require );
     212
     213        $gpfw_gift_pack_note_require = 'gpfw_gift_pack_note_require' . $current_language;
     214        $options['gpfw_gift_pack_note_require'] = get_option( $gpfw_gift_pack_note_require );
     215
     216
    200217        $gpfw_gift_pack_note_limit = 'gpfw_enable_gift_pack_note_limit' . $current_language;
    201218        $options['gpfw_enable_gift_pack_note_limit'] = get_option( $gpfw_gift_pack_note_limit );
  • gift-pack-for-woocommerce/trunk/public/class-gift-pack-for-woocommerce-public.php

    r3134591 r3246471  
    242242            $cart_item_data['unique_key'] = md5( microtime().rand() );
    243243        }
     244        if( isset( $_REQUEST['gpfw-gift-pack-to'] ) && !empty($_POST['gift_pack_option'])) {
     245            $cart_item_data[ 'gpfw_gift_pack_to' ] = sanitize_text_field($_REQUEST['gpfw-gift-pack-to']);
     246            $cart_item_data['unique_key'] = md5( microtime().rand() );
     247        }
     248        if( isset( $_REQUEST['gpfw-gift-pack-from'] ) && !empty($_POST['gift_pack_option'])) {
     249            $cart_item_data[ 'gpfw_gift_pack_from' ] = sanitize_text_field($_REQUEST['gpfw-gift-pack-from']);
     250            $cart_item_data['unique_key'] = md5( microtime().rand() );
     251        }
    244252
    245253       
     
    283291            );
    284292        }
    285         if( isset( $cart_item['gpfw_gift_pack_note'] ) ) {
     293        if( isset( $cart_item['gpfw_gift_pack_to'] ) ) {
    286294
    287295            if($this->gpfw_options['gpfw_gift_pack_message_text']!=''){
     
    289297            }
    290298            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'] );
     302        }
     303
     304        if( isset( $cart_item['gpfw_gift_pack_from'] ) ) {
     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'] );
     313        }
     314
     315        if( isset( $cart_item['gpfw_gift_pack_note'] ) ) {
     316
     317            if($this->gpfw_options['gpfw_gift_pack_message_text']!=''){
     318                $gpfw_gift_pack_message_text = $this->gpfw_options['gpfw_gift_pack_message_text'];
     319            }
     320            else{
    291321                $gpfw_gift_pack_message_text = __("Giftpack Note","gift-pack-for-woocommerce");
    292322            }   
    293323            $cart_item_data[] = array( "name" => $gpfw_gift_pack_message_text, "value" => $cart_item['gpfw_gift_pack_note'] );
    294324        }
     325
     326       
    295327       
    296328        if( isset( $cart_item['gpfw_default_gift_pack_img']  ) && $this->gpfw_options['gpfw_gallery'] == '') {
  • gift-pack-for-woocommerce/trunk/public/css/gift-pack-for-woocommerce-public.css

    r3145134 r3246471  
    1818textarea.gpfw-gift-pack-note {
    1919  resize: none;
     20}
     21.gpfw_giftpack_note .gpfw_giftpack_val  textarea{
     22    margin: 9px 0 !important;
    2023}
    2124.gpfw_check_price > label {
     
    188191    }
    189192}
    190 
    191 
    192 
  • gift-pack-for-woocommerce/trunk/public/js/gift-pack-for-woocommerce-public.js

    r3144054 r3246471  
    4545        if($(this).prop('checked') === true) {
    4646            var variable_pro = false;
    47             if($('div.gpfw_product.gpfw_product_variable').length){
     47            if($('input[name="variation_id"]').length){
    4848                var gpfw_productID = $('input[name="variation_id"]').val();
    4949                var var_pro_ID = $('input[name="product_id"]').val();
     
    5757                var var_pro_ID = 0;
    5858            }
    59 
     59           
    6060            if((gpfw_productID === undefined || gpfw_productID == 0) && variable_pro == true){
    6161                $('.single_add_to_cart_button').click();
     
    100100                    }
    101101                    else{
    102                         $('.price').html(json_obj.gift_pack_global_price_html);
     102
     103                        $('.woocommerce-Price-amount.amount').parent().html(json_obj.gift_pack_global_price_html);
    103104                    }
    104105                }
     
    113114
    114115            });
    115 
    116 
    117         }
    118         else{
     116        } else {
    119117            var variable_pro = false;
    120118            if($('div.gpfw_product.gpfw_product_variable').length){
     
    157155                    }
    158156                    $('input[name="active_price"]').val(json_obj.active_price);
    159                 }
    160                 else{
     157                } else {
    161158                    if($('p.price ins').length == 1){
    162159                        $('.price ins').html(json_obj.gift_pack_global_price_html);
    163                     }
    164                     else{
    165                         $('.price').html(json_obj.gift_pack_global_price_html);
     160                    } else {
     161                        $('.woocommerce-Price-amount.amount').parent().html(json_obj.gift_pack_global_price_html);
    166162                    }
    167163                }
  • gift-pack-for-woocommerce/trunk/public/partials/gift-pack-data-in-order.php

    r3005592 r3246471  
    4040      $item->update_meta_data( $gpfw_gift_pack_message_text, $values['gpfw_gift_pack_note'] );
    4141    }
     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    }
    4251       /* GiftPack Image Label */
    4352    if($this->gpfw_options['gpfw_gift_pack_image_text']!=''){
  • gift-pack-for-woocommerce/trunk/public/partials/gift-pack-html.php

    r3144054 r3246471  
    99$gpfwproductID = (int)stripslashes($_POST['gpfwproductID']);
    1010$var_pro_ID = (int)stripslashes($_POST['var_pro_ID']);
     11
    1112if ($gpfwproductID == 0 && $var_pro_ID) {
    1213    $product = wc_get_product($var_pro_ID);
     
    177178    }
    178179
     180    if ($gpfw_object['gpfw_disable_gift_pack_to'] == '') {
     181
     182        $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>';
     184    }
     185   
     186    if ($gpfw_object['gpfw_disable_gift_pack_from'] == '') {
     187
     188        $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>';
     190    }
     191
    179192    if ($gpfw_object['gpfw_disable_gift_pack_note'] == '') {
    180193
    181194        $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';
    182195
    183         $html .= '<div class="gpfw_giftpack_note"><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'])) . '"
     196        $html .= '
     197            <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'])) . '"
    184198                   value="" minlength="5" maxlength="'.$note_max_var.'"></textarea>
    185            </div>
    186199        </div>';
    187200    }
Note: See TracChangeset for help on using the changeset viewer.