Plugin Directory

Changeset 3457991


Ignore:
Timestamp:
02/10/2026 12:06:06 PM (3 weeks ago)
Author:
webtoffee
Message:

4.9.1 2026-02-10

  • [Fix] - Prevent fatal error array before calling in_array() in packing slip.
  • [Tweak] - Keep SKU enabled by default in invoice and packing slip documents.
  • [Add] - Added live preview for packing slip, dispatch label, and delivery note documents.
  • [Compatibility] - WooCommerce 10.5.0
  • [Compatibility] - WordPress 6.9.1
Location:
print-invoices-packing-slip-labels-for-woocommerce/trunk
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/admin/css/wf-woocommerce-packing-list-admin.css

    r3395665 r3457991  
    26012601.wt_customizer_pro_addon_premium_link_div_doc img { margin-right: 6px; opacity: 1 !important; display: inline-block !important; padding: 5px !important; border-radius: 25px !important; width: 16px !important; height: 16px !important; object-fit: contain; }
    26022602
    2603 
     2603/* Packing List Customize Pro Page Styles */
     2604.wt_pklist_customize_pro_wrapper {
     2605  display: flex;
     2606  flex-wrap: wrap;
     2607  gap: 24px;
     2608  padding: 20px 0;
     2609}
     2610
     2611.wt_pklist_customize_pro_left {
     2612  flex: 1;
     2613  min-width: 500px;
     2614  max-width: 67%;
     2615}
     2616
     2617.wt_pklist_customize_pro_right {
     2618  width: 350px;
     2619  flex-shrink: 0;
     2620}
     2621
     2622.wt_pklist_customize_pro_header {
     2623  margin-bottom: 16px;
     2624}
     2625
     2626.wt_pklist_customize_pro_header h2 {
     2627  font-size: 18px;
     2628  font-weight: 600;
     2629  color: #1e1e1e;
     2630  margin: 0 0 4px 0;
     2631}
     2632
     2633.wt_pklist_customize_pro_header p {
     2634  font-size: 13px;
     2635  color: #757575;
     2636  margin: 0;
     2637}
     2638
     2639.wt_pklist_template_preview_container {
     2640  border: 2px dashed #c3d1e0;
     2641  border-radius: 12px;
     2642  background: #fff;
     2643  padding: 18px;
     2644  min-height: 400px;
     2645  overflow: hidden;
     2646}
     2647
     2648.wt_pklist_template_preview_inner {
     2649  background: #fff;
     2650  font-family: "Helvetica Neue", Roboto, Arial, "Droid Sans", sans-serif;
     2651  font-size: 14px;
     2652  line-height: 1.5;
     2653  color: #202020;
     2654}
     2655
     2656.wt_pklist_template_preview_inner .wfte_hidden {
     2657  display: none !important;
     2658}
     2659
     2660.wt_pklist_template_preview_inner .wfte_text_right {
     2661  text-align: right !important;
     2662}
     2663
     2664.wt_pklist_template_preview_inner .wfte_text_left {
     2665  text-align: left !important;
     2666}
     2667
     2668.wt_pklist_template_preview_inner .wfte_text_center {
     2669  text-align: center !important;
     2670}
     2671
     2672.wt_pklist_template_preview_inner .wfte_invoice-main {
     2673  color: #202020;
     2674  font-size: 14px;
     2675  font-weight: 400;
     2676  box-sizing: border-box;
     2677  width: 100%;
     2678  height: auto;
     2679}
     2680
     2681.wt_pklist_template_preview_inner .wfte_invoice-main * {
     2682  box-sizing: border-box;
     2683}
     2684
     2685.wt_pklist_template_preview_inner .clearfix::after {
     2686  display: block;
     2687  clear: both;
     2688  content: "";
     2689}
     2690
     2691.wt_pklist_template_preview_inner .wfte_row {
     2692  width: 100%;
     2693  display: block;
     2694}
     2695
     2696.wt_pklist_template_preview_inner .wfte_col-1 {
     2697  width: 100%;
     2698  display: block;
     2699}
     2700
     2701.wt_pklist_template_preview_inner .wfte_col-3 {
     2702  width: 33%;
     2703  display: block;
     2704}
     2705
     2706.wt_pklist_template_preview_inner .float_left {
     2707  float: left;
     2708}
     2709
     2710.wt_pklist_template_preview_inner .float_right {
     2711  float: right;
     2712}
     2713
     2714.wt_pklist_template_preview_inner .wfte_company_logo_img_box {
     2715  margin-bottom: 10px;
     2716}
     2717
     2718.wt_pklist_template_preview_inner .wfte_company_logo_img {
     2719  width: 150px;
     2720  max-width: 100%;
     2721}
     2722
     2723.wt_pklist_template_preview_inner .wfte_doc_title {
     2724  color: #263140;
     2725  font-size: 30px;
     2726  font-weight: bold;
     2727  height: auto;
     2728  width: 100%;
     2729  line-height: 1;
     2730}
     2731
     2732.wt_pklist_template_preview_inner .wfte_invoice_data div span:first-child {
     2733  font-weight: bold;
     2734}
     2735
     2736.wt_pklist_template_preview_inner .wfte_address-field-header {
     2737  font-weight: bold;
     2738  font-size: 14px;
     2739  color: #000;
     2740  padding: 3px;
     2741  padding-left: 0px;
     2742}
     2743
     2744.wt_pklist_template_preview_inner .wfte_addrss_field_main {
     2745  padding-top: 15px;
     2746}
     2747
     2748.wt_pklist_template_preview_inner .wfte_product_table {
     2749  width: 100%;
     2750  border-collapse: collapse;
     2751  margin: 0px;
     2752}
     2753
     2754.wt_pklist_template_preview_inner .wfte_product_table_head th {
     2755  height: 36px;
     2756  font-size: 14px;
     2757  text-align: left;
     2758  border-bottom: solid 1px #D7DBDF;
     2759}
     2760
     2761.wt_pklist_template_preview_inner .wfte_product_table_body td {
     2762  font-size: 14px;
     2763  border-bottom: solid 1px #dddee0;
     2764  padding: 5px;
     2765  line-height: 1.6;
     2766}
     2767
     2768.wt_pklist_template_preview_inner .wfte_product_table th,
     2769.wt_pklist_template_preview_inner .wfte_product_table td {
     2770  line-height: 1.6;
     2771  padding: 5px 5px;
     2772}
     2773
     2774.wt_pklist_premium_features_panel {
     2775  background: #fff;
     2776  border-radius: 12px;
     2777  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
     2778  padding: 20px;
     2779  margin-bottom: 16px;
     2780  width: 100%;
     2781}
     2782
     2783.wt_pklist_premium_features_header {
     2784  display: flex;
     2785  align-items: center;
     2786  gap: 8px;
     2787  margin-bottom: 8px;
     2788}
     2789
     2790.wt_pklist_premium_features_header h3 {
     2791  font-size: 16px;
     2792  font-weight: 600;
     2793  color: #1e1e1e;
     2794  margin: 0;
     2795}
     2796
     2797.wt_pklist_premium_features_header .crown-icon {
     2798  width: 20px;
     2799  height: 20px;
     2800}
     2801
     2802.wt_pklist_premium_features_desc {
     2803  font-size: 13px;
     2804  color: #757575;
     2805  margin: 0 0 16px 0;
     2806  line-height: 1.5;
     2807}
     2808
     2809.wt_pklist_toggle_item {
     2810  display: flex;
     2811  align-items: center;
     2812  justify-content: space-between;
     2813  padding: 12px 16px;
     2814  background: #f0f6fc;
     2815  border-radius: 8px;
     2816  margin-bottom: 8px;
     2817  transition: background-color 0.2s ease;
     2818}
     2819
     2820.wt_pklist_toggle_item:last-child {
     2821  margin-bottom: 0;
     2822}
     2823
     2824.wt_pklist_toggle_item:hover {
     2825  background: #e5eef8;
     2826}
     2827
     2828.wt_pklist_toggle_label {
     2829  font-size: 14px;
     2830  color: #1e1e1e;
     2831  font-weight: 500;
     2832}
     2833
     2834.wt_pklist_toggle_switch {
     2835  position: relative;
     2836  width: 44px;
     2837  height: 24px;
     2838  cursor: pointer;
     2839}
     2840
     2841.wt_pklist_toggle_switch input {
     2842  opacity: 0;
     2843  width: 0;
     2844  height: 0;
     2845}
     2846
     2847.wt_pklist_toggle_slider {
     2848  position: absolute;
     2849  cursor: pointer;
     2850  top: 0;
     2851  left: 0;
     2852  right: 0;
     2853  bottom: 0;
     2854  background-color: #c4c4c4;
     2855  transition: 0.3s;
     2856  border-radius: 24px;
     2857}
     2858
     2859.wt_pklist_toggle_slider::before {
     2860  position: absolute;
     2861  content: "";
     2862  height: 20px;
     2863  width: 20px;
     2864  left: 2px;
     2865  bottom: 2px;
     2866  background-color: white;
     2867  transition: 0.3s;
     2868  border-radius: 50%;
     2869  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
     2870}
     2871
     2872.wt_pklist_toggle_switch input:checked + .wt_pklist_toggle_slider {
     2873  background-color: #3858E9;
     2874}
     2875
     2876.wt_pklist_toggle_switch input:checked + .wt_pklist_toggle_slider::before {
     2877  transform: translateX(20px);
     2878}
     2879
     2880.wt_pklist_toggle_switch input:focus + .wt_pklist_toggle_slider {
     2881  box-shadow: 0 0 1px #3858E9;
     2882}
     2883
     2884.wt_pklist_unlock_panel {
     2885  background: #fff;
     2886  border-radius: 12px;
     2887  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
     2888  padding: 20px;
     2889  border: 1px solid #e0e0e0;
     2890  margin-top: 20px;
     2891}
     2892
     2893.wt_pklist_unlock_header {
     2894  display: flex;
     2895  align-items: center;
     2896  gap: 8px;
     2897  margin-bottom: 8px;
     2898}
     2899
     2900.wt_pklist_unlock_header h3 {
     2901  font-size: 16px;
     2902  font-weight: 600;
     2903  color: #1e1e1e;
     2904  margin: 0;
     2905}
     2906
     2907.wt_pklist_unlock_header .lock-icon {
     2908  width: 18px;
     2909  height: 18px;
     2910}
     2911
     2912.wt_pklist_unlock_header .lock-icon path {
     2913  stroke: #000;
     2914}
     2915
     2916.wt_pklist_unlock_desc {
     2917  font-size: 14px;
     2918  color: #5a5a5a;
     2919  margin: 0 0 20px 0;
     2920  line-height: 1.5;
     2921}
     2922
     2923.wt_pklist_unlock_features {
     2924  list-style: none;
     2925  padding: 0;
     2926  margin: 0 0 24px 0;
     2927}
     2928
     2929.wt_pklist_unlock_features li {
     2930  position: relative;
     2931  padding-left: 32px;
     2932  margin-bottom: 16px;
     2933  font-size: 14px;
     2934  color: #333;
     2935  line-height: 1.5;
     2936}
     2937
     2938.wt_pklist_unlock_features li:last-child {
     2939  margin-bottom: 0;
     2940}
     2941
     2942.wt_pklist_unlock_features li::before {
     2943  content: '';
     2944  position: absolute;
     2945  left: 0;
     2946  top: 2px;
     2947  width: 18px;
     2948  height: 18px;
     2949  background-color: #5b8def;
     2950  border-radius: 50%;
     2951  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
     2952  background-size: 12px;
     2953  background-position: center;
     2954  background-repeat: no-repeat;
     2955}
     2956
     2957.wt_pklist_unlock_btn {
     2958  display: inline-flex;
     2959  align-items: center;
     2960  justify-content: center;
     2961  gap: 8px;
     2962  background: #5b8def;
     2963  color: #fff;
     2964  padding: 12px 24px;
     2965  border-radius: 8px;
     2966  text-decoration: none;
     2967  font-size: 14px;
     2968  font-weight: 600;
     2969  transition: background-color 0.2s;
     2970  width: 100%;
     2971  box-sizing: border-box;
     2972}
     2973
     2974.wt_pklist_unlock_btn:hover {
     2975  background: #4a7de0;
     2976  color: #fff;
     2977  color: #fff;
     2978}
     2979
     2980.wt_pklist_unlock_btn img {
     2981  width: 16px;
     2982  height: 16px;
     2983}
     2984
     2985.wt_pklist_template_preview_inner .wfte_highlight {
     2986  animation: wt_highlight_pulse 0.5s ease;
     2987}
     2988
     2989@keyframes wt_highlight_pulse {
     2990  0% { background-color: transparent; }
     2991  50% { background-color: rgba(56, 88, 233, 0.15); }
     2992  100% { background-color: transparent; }
     2993}
     2994
     2995@media (max-width: 1024px) {
     2996  .wt_pklist_customize_pro_left {
     2997    max-width: 100%;
     2998    min-width: 100%;
     2999  }
     3000 
     3001  .wt_pklist_customize_pro_right {
     3002    width: 100%;
     3003  }
     3004}
     3005
     3006
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/admin/modules/banner/assets/js/wt-gdpr-cta-banner.js

    r3382552 r3457991  
    1010            initDismissButton: function() {
    1111                // Handle WordPress dismissible notices for GDPR banner
    12                 $('.notice-dismiss').on('click', function(e) {
    13                     e.preventDefault();
    14                     var $this = $(this);
    15                     var $banner = $this.closest('.notice');
    16                     var bannerId = $banner.attr('id');
     12                $('#wt_gdpr_cta_banner').on('click', '.notice-dismiss, .product-page-btn', function(e) {
     13                    var $banner = $('#wt_gdpr_cta_banner');
    1714                   
    18                     // Only handle GDPR banner
    19                     if (bannerId === 'wt_gdpr_cta_banner') {
    20                         var ajaxData = {
    21                             action: 'wt_dismiss_gdpr_cta_banner',
    22                             nonce: typeof wt_gdpr_cta_banner_ajax !== 'undefined' ? wt_gdpr_cta_banner_ajax.nonce : ''
    23                         };
    24                        
    25                         if (ajaxData.action && ajaxData.nonce) {
    26                             $.ajax({
    27                                 url: ajaxurl,
    28                                 type: 'POST',
    29                                 data: ajaxData,
    30                                 success: function(response) {
    31                                     if (response.success) {
    32                                         $banner.fadeOut();
    33                                     } else {
    34                                         console.log('GDPR Banner Dismiss Error:', response.data);
    35                                     }
    36                                 },
    37                                 error: function(xhr, status, error) {
    38                                     console.log('GDPR Banner AJAX Error:', error);
     15                    if ($(this).hasClass('notice-dismiss')) {
     16                        e.preventDefault();
     17                    }
     18                   
     19                    var ajaxData = {
     20                        action: 'wt_dismiss_gdpr_cta_banner',
     21                        nonce: typeof wt_gdpr_cta_banner_ajax !== 'undefined' ? wt_gdpr_cta_banner_ajax.nonce : ''
     22                    };
     23                   
     24                    if (ajaxData.action && ajaxData.nonce) {
     25                        $.ajax({
     26                            url: ajaxurl,
     27                            type: 'POST',
     28                            data: ajaxData,
     29                            success: function(response) {
     30                                if (response.success) {
     31                                    $banner.fadeOut();
     32                                } else {
     33                                    console.log('GDPR Banner Dismiss Error:', response.data);
    3934                                }
    40                             });
    41                         } else {
    42                             console.log('GDPR Banner: Missing action or nonce');
    43                         }
     35                            },
     36                            error: function(xhr, status, error) {
     37                                console.log('GDPR Banner AJAX Error:', error);
     38                            }
     39                        });
     40                    } else {
     41                        console.log('GDPR Banner: Missing action or nonce');
    4442                    }
    4543                });
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/admin/modules/customizer/assets/js/customize.js

    r3421609 r3457991  
    734734            /* binding events */
    735735            this.regPanelEvents();
     736
     737            /* apply general settings restrictions */
     738            this.applyGeneralSettingsRestrictions();
     739
    736740            pklist_customize.pendingHtmlRead = 0;
    737741            if (pklist_customize.open_first_panel) {
     
    749753                if (tgt_elm.length > 0) {
    750754                    tgt_elm.attr('data-due-date-period', '30_days');
     755                }
     756            }
     757        },
     758        applyGeneralSettingsRestrictions: function () {
     759            var generalSettings = wf_woocommerce_packing_list_customizer.general_settings;
     760           
     761            if (typeof generalSettings === 'undefined' || !generalSettings) {
     762                return;
     763            }
     764
     765            if (typeof generalSettings.include_customer_note !== 'undefined' && generalSettings.include_customer_note === 'No') {
     766                this.disableSidePanelByType('customer_note', 'customer_note');
     767            }
     768
     769            if (typeof generalSettings.include_footer !== 'undefined' && generalSettings.include_footer === 'No') {
     770                this.disableSidePanelByType('footer', 'footer');
     771            }
     772
     773            if (typeof generalSettings.include_image !== 'undefined' && generalSettings.include_image === 'No') {
     774                this.disableProductTableCheckbox('product_table_head_image', 'image');
     775            }
     776
     777            if (typeof generalSettings.include_sku !== 'undefined' && generalSettings.include_sku === 'No') {
     778                this.disableProductTableCheckbox('product_table_head_sku', 'sku');
     779            }
     780        },
     781        disableSidePanelByType: function (panelType, settingName) {
     782            var panel = $('.wf_side_panel[data-type="' + panelType + '"]');
     783            if (panel.length > 0) {
     784                panel.attr('data-general-toggled-off', 1);
     785               
     786                var toggle = panel.find('.wf_side_panel_toggle .wf_slide_switch');
     787                toggle.prop('checked', false);
     788               
     789                var tgt_elm = $('.wf_customize_container').find('.wfte_' + panelType);
     790                if (tgt_elm.length > 0) {
     791                    tgt_elm.addClass('wfte_hidden');
     792                }
     793               
     794                var code_view_dom = this.getCodeViewHtmlDom();
     795                var code_tgt_elm = code_view_dom.find('.wfte_' + panelType);
     796                if (code_tgt_elm.length > 0) {
     797                    code_tgt_elm.addClass('wfte_hidden');
     798                    this.updateCodeViewHtml(code_view_dom);
     799                }
     800            }
     801        },
     802        disableProductTableCheckbox: function (checkboxElm, columnType) {
     803            var checkbox = $('.wf_side_panel .wf_cst_toggler[data-elm="' + checkboxElm + '"]');
     804            if (checkbox.length > 0) {
     805                checkbox.prop('checked', false);
     806               
     807                var tgt_elm = $('.wf_customize_container').find('.wfte_' + checkboxElm);
     808                if (tgt_elm.length > 0) {
     809                    var nodeName = tgt_elm.prop('nodeName').toLowerCase();
     810                    if ("th" === nodeName || "td" === nodeName) {
     811                        var ind = tgt_elm.index() + 1;
     812                        tgt_elm.parents('table').find('td:nth-child(' + ind + '),th:nth-child(' + ind + ')').addClass('wfte_hidden');
     813                    } else {
     814                        tgt_elm.addClass('wfte_hidden');
     815                    }
     816                }
     817               
     818                var code_view_dom = this.getCodeViewHtmlDom();
     819                var code_tgt_elm = code_view_dom.find('.wfte_' + checkboxElm);
     820                if (code_tgt_elm.length > 0) {
     821                    var col_type = code_tgt_elm.attr('col-type');
     822                    if (col_type && "-" !== col_type.charAt(0)) {
     823                        col_type = '-' + col_type;
     824                        code_tgt_elm.attr('col-type', col_type);
     825                    }
     826                    this.updateCodeViewHtml(code_view_dom);
    751827                }
    752828            }
     
    13201396        }
    13211397    }
    1322     /* sample pdf generation */
     1398
     1399    /* Packing List Pro Preview */
     1400    $(document).ready(function() {
     1401        if ($('#wt_packinglist_preview').length > 0) {
     1402            var hiddenClass = 'wfte_hidden';
     1403            var $preview = $('#wt_packinglist_preview');
     1404           
     1405            function getAttributItems(vl) {
     1406                var array = vl.split("|");
     1407                return array.filter(function(el) {
     1408                    return el !== null && el !== "" && el !== " ";
     1409                });
     1410            }
     1411           
     1412            function toggleElement(elm, isInit) {
     1413                var targetElements = elm.attr('data-target-element');
     1414                if (typeof targetElements !== 'undefined') {
     1415                    var elementsArr = getAttributItems(targetElements);
     1416                    var isChecked = elm.is(':checked');
     1417                   
     1418                    for (var i = 0; i < elementsArr.length; i++) {
     1419                        var elementClass = elementsArr[i].trim();
     1420                        var $targetElm = $preview.find('.wfte_' + elementClass);
     1421                        var $targetTd = $preview.find('.' + elementClass);
     1422                       
     1423                        if (isChecked) {
     1424                            $targetElm.removeClass(hiddenClass);
     1425                            $targetTd.removeClass(hiddenClass);
     1426                            if (!isInit) {
     1427                                highlightElement($targetElm);
     1428                                highlightElement($targetTd);
     1429                            }
     1430                        } else {
     1431                            $targetElm.addClass(hiddenClass);
     1432                            $targetTd.addClass(hiddenClass);
     1433                        }
     1434                    }
     1435                }
     1436            }
     1437           
     1438            function highlightElement(elm) {
     1439                elm.addClass('wfte_highlight');
     1440                setTimeout(function() {
     1441                    elm.removeClass('wfte_highlight');
     1442                }, 500);
     1443            }
     1444           
     1445            // Initialize toggle states
     1446            $('.wt_pklist_feature_toggle').each(function() {
     1447                toggleElement($(this), true);
     1448            });
     1449           
     1450            // Handle toggle change events
     1451            $('.wt_pklist_feature_toggle').on('change', function() {
     1452                toggleElement($(this), false);
     1453            });
     1454        }
     1455    });
    13231456
    13241457})(jQuery);
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/admin/modules/customizer/customizer.php

    r3382552 r3457991  
    223223        $is_pro_customizer = apply_filters('wt_pklist_pro_customizer_' . $this->to_customize, false, $this->to_customize);
    224224        $this->enable_code_view = apply_filters('wt_pklist_enable_code_editor', false, $this->to_customize);
     225        $preview_only = apply_filters('wt_pklist_customizer_preview_only', false, $this->to_customize);
    225226        $active_theme_arr = $this->get_current_active_theme($this->to_customize);
    226227        $active_template_id = 0;
     
    246247        $to_customize_module_id = Wf_Woocommerce_Packing_List::get_module_id($this->to_customize);
    247248
     249        $general_settings = $this->get_general_settings_for_customizer($this->to_customize, $to_customize_module_id);
     250
    248251        $params = array(
    249252            'nonces' => array(
     
    256259            'enable_code_view' => $this->enable_code_view,
    257260            'open_first_panel' => $this->open_first_panel,
     261            'preview_only' => $preview_only,
    258262            'img_url_placeholders' => $img_url_placeholders,
     263            'general_settings' => $general_settings,
    259264            'labels' => array(
    260265                'error' => __('Error', 'print-invoices-packing-slip-labels-for-woocommerce'),
     
    315320            'module_id' => $this->module_id,
    316321            'enable_code_view' => $this->enable_code_view,
     322            'preview_only' => $preview_only,
    317323        );
    318324        Wf_Woocommerce_Packing_List_Admin::envelope_settings_tabcontent(WF_PKLIST_POST_TYPE . '-customize', $view_file, '', $params, 0);
     
    342348        return apply_filters('wf_module_non_customizable_items', $settings, $base);
    343349    }
     350
     351    /**
     352     * Get general settings for the customizer to determine which fields should be disabled
     353     *
     354     * @since 4.5.0
     355     * @param string $template_type The template type (e.g., 'packinglist')
     356     * @param string $module_id The module ID
     357     * @return array Settings that affect customizer field states
     358     */
     359    public function get_general_settings_for_customizer($template_type, $module_id)
     360    {
     361        $settings = array();
     362       
     363        // Get settings based on template type
     364        if ('packinglist' === $template_type) {
     365            $settings = array(
     366                'include_image' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_attach_image_packinglist', $module_id),
     367                'include_sku' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_attach_sku_packinglist', $module_id),
     368                'include_customer_note' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_add_customer_note_in_packinglist', $module_id),
     369                'include_footer' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_packinglist_footer_pk', $module_id),
     370            );
     371        } elseif ('deliverynote' === $template_type) {
     372            $settings = array(
     373                'include_image' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_attach_image_deliverynote', $module_id),
     374                'include_customer_note' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_add_customer_note_in_deliverynote', $module_id),
     375                'include_footer' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_packinglist_footer_dn', $module_id),
     376            );
     377        } elseif ('dispatchlabel' === $template_type) {
     378            $settings = array(
     379                'include_customer_note' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_add_customer_note_in_dispatchlabel', $module_id),
     380                'include_footer' => Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_packinglist_footer_dl', $module_id),
     381            );
     382        }
     383       
     384        $settings = apply_filters('wf_pklist_customizer_general_settings', $settings, $template_type, $module_id);
     385       
     386        return $settings;
     387    }
     388
    344389    public function get_current_active_theme($base)
    345390    {
     
    500545    private function convert_translation_string_for_design_view($match)
    501546    {
    502         $ipc_td = 'wt_woocommerce_invoice_addon';
     547        $ipc_td = 'wt-woocommerce-invoice-addon';
    503548        $sdd_td = 'wt-woocommerce-shippinglabel-addon';
    504549        $pi_td  = 'wt-woocommerce-proforma-addon';
     
    538583    private function convert_translation_strings($match)
    539584    {
    540         $ipc_td = 'wt_woocommerce_invoice_addon';
     585        $ipc_td = 'wt-woocommerce-invoice-addon';
    541586        $sdd_td = 'wt-woocommerce-shippinglabel-addon';
    542587        $pi_td  = 'wt-woocommerce-proforma-addon';
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/admin/modules/customizer/views/customize.php

    r3351991 r3457991  
    584584        padding-bottom: 0px;
    585585        margin-bottom: 10px;
     586    }
     587
     588    /* Disabled state for fields controlled by General tab settings */
     589    .wf_general_setting_disabled {
     590        opacity: 0.5;
     591        pointer-events: none;
     592        position: relative;
     593    }
     594
     595    .wf_general_setting_disabled::after {
     596        content: '';
     597        position: absolute;
     598        top: 0;
     599        left: 0;
     600        right: 0;
     601        bottom: 0;
     602        background: rgba(255, 255, 255, 0.3);
     603        cursor: not-allowed;
     604        z-index: 10;
     605    }
     606
     607    .wf_general_setting_disabled .wf_side_panel_toggle .wf_slide_switch {
     608        cursor: not-allowed !important;
     609    }
     610
     611    .wf_general_setting_disabled .wf_side_panel_toggle .wf_slider {
     612        background-color: #ccc !important;
     613        cursor: not-allowed !important;
     614    }
     615
     616    .wf_general_setting_disabled_checkbox {
     617        cursor: not-allowed !important;
     618        opacity: 0.5;
     619    }
     620
     621    .wf_general_setting_disabled_row {
     622        opacity: 0.6;
     623    }
     624
     625    .wf_general_setting_disabled_row input,
     626    .wf_general_setting_disabled_row select {
     627        pointer-events: none;
     628        background-color: #f5f5f5;
    586629    }
    587630</style>
     
    769812</div>
    770813
    771 <div class="wf_cst_headbar">
     814<div class="wf_cst_headbar"<?php echo (isset($preview_only) && $preview_only) ? ' style="height: 50px;"' : ''; ?>>
    772815    <div style="float:left; display:flex; align-items: center; height:100%; width:max-content; padding-left: 10px;">
    773 
     816        <?php if (!isset($preview_only) || !$preview_only) : ?>
    774817        <?php $active_template_name_cleaned_string = str_replace(" (Active)", "", $active_template_name); ?>
    775818        <input type="text" class="wf_template_name_field" value="<?php echo esc_html($active_template_name_cleaned_string); ?>" style="padding: 4px 20px;min-width: 250px;font-size: 16px;">
     
    779822        ?>
    780823        <a class="wf_pklist_new_template <?php echo esc_attr($tooltip_conf['class']); ?>" style="float:left; width:100%; padding-left:15px; cursor:pointer;" <?php echo wp_kses_post($tooltip_conf['text']); ?>><?php esc_html_e('Change template', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></a>
     824        <?php else : ?>
     825        <span style="margin-left: 15px; color: #666; font-size: 13px;"><?php esc_html_e('This preview reflects your current settings from the General tab.', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></span>
     826        <?php endif; ?>
    781827    </div>
     828    <?php if (!isset($preview_only) || !$preview_only) : ?>
    782829    <div style="float:right;  margin-right:-15px; display:flex;align-items: center;height: 100%; ">
    783830
     
    806853        </ul>
    807854    </div>
     855    <?php endif; ?>
    808856</div>
    809857
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/admin/modules/migrator/migrator.php

    r3382552 r3457991  
    4848        'packinglist'=>array(
    4949            'woocommerce_wf_attach_image_packinglist'=>'woocommerce_wf_attach_image_packinglist',
     50            'woocommerce_wf_attach_sku_packinglist'=>'woocommerce_wf_attach_sku_packinglist',
    5051            'woocommerce_wf_add_customer_note_in_packinglist'=>"woocommerce_wf_add_customer_note_in_packinglist",
    5152            'woocommerce_wf_packinglist_footer_pk'=>"woocommerce_wf_packinglist_footer_pk",
     
    105106        'packinglist'=>array(
    106107            'woocommerce_wf_attach_image_packinglist'=>'Yes',
     108            'woocommerce_wf_attach_sku_packinglist'=>'Yes',
    107109            'woocommerce_wf_add_customer_note_in_packinglist'=>'No',
    108110            'woocommerce_wf_packinglist_footer_pk'=>'No',
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/admin/views/customizer-promotion-popup.php

    r3351991 r3457991  
    5858
    5959        'shippinglabel' => array(
     60            'title'     => sprintf( '%1$s <span> %2$s </span>', __( 'Get advanced customization options for', 'print-invoices-packing-slip-labels-for-woocommerce' ), __( 'shipping labels, dispatch labels, and delivery notes.', 'print-invoices-packing-slip-labels-for-woocommerce' ) ),
     61            'features'  => array(
     62                __('Add additional fields to shipping labels', 'print-invoices-packing-slip-labels-for-woocommerce'),
     63                __('Multiple pre-built templates','print-invoices-packing-slip-labels-for-woocommerce'),
     64                __('Customize using Code Editor','print-invoices-packing-slip-labels-for-woocommerce'),
     65                __('More customization options', 'print-invoices-packing-slip-labels-for-woocommerce'),
     66            ),
     67            'link'      => 'https://www.webtoffee.com/product/woocommerce-shipping-labels-delivery-notes/?utm_source=free_plugin_customizesection&utm_medium=pdf_basic&utm_campaign=Shipping_Label&utm_content='.WF_PKLIST_VERSION,
     68        ),
     69
     70        'deliverynote' => array(
     71            'title'     => sprintf( '%1$s <span> %2$s </span>', __( 'Get advanced customization options for', 'print-invoices-packing-slip-labels-for-woocommerce' ), __( 'shipping labels, dispatch labels, and delivery notes.', 'print-invoices-packing-slip-labels-for-woocommerce' ) ),
     72            'features'  => array(
     73                __('Add additional fields to shipping labels', 'print-invoices-packing-slip-labels-for-woocommerce'),
     74                __('Multiple pre-built templates','print-invoices-packing-slip-labels-for-woocommerce'),
     75                __('Customize using Code Editor','print-invoices-packing-slip-labels-for-woocommerce'),
     76                __('More customization options', 'print-invoices-packing-slip-labels-for-woocommerce'),
     77            ),
     78            'link'      => 'https://www.webtoffee.com/product/woocommerce-shipping-labels-delivery-notes/?utm_source=free_plugin_customizesection&utm_medium=pdf_basic&utm_campaign=Shipping_Label&utm_content='.WF_PKLIST_VERSION,
     79        ),
     80
     81        'dispatchlabel' => array(
    6082            'title'     => sprintf( '%1$s <span> %2$s </span>', __( 'Get advanced customization options for', 'print-invoices-packing-slip-labels-for-woocommerce' ), __( 'shipping labels, dispatch labels, and delivery notes.', 'print-invoices-packing-slip-labels-for-woocommerce' ) ),
    6183            'features'  => array(
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/changelog.txt

    r3421609 r3457991  
    11== Changelog ==
     2
     3= 4.9.0 2025-12-17 =
     4* [Fix] - Fixed error 'call to a member function update_meta_data()'.
     5* [Fix] - Fixed division by zero error in UBL invoice.
     6* [Tweak] - Translation update.
     7* [Tweak] - Add safe file locking with automatic fallback for VIP-hosted.
     8* [Compatibility] - WooCommerce 10.4.2
    29
    310= 4.8.9 2025-12-02 =
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/common/class-wt-pklist-common.php

    r3421609 r3457991  
    240240        {
    241241            $order = self::get_order($order);
    242             if(is_null($order) || !is_a($order, 'WC_Order'))
     242            if(is_null($order) || !is_a($order, 'WC_Abstract_Order'))
    243243            {
    244244                return;
     
    258258        {
    259259            $order = self::get_order($order);
    260             if(is_null($order) || !is_a($order, 'WC_Order'))
     260            if(is_null($order) || !is_a($order, 'WC_Abstract_Order'))
    261261            {
    262262                return;
     
    290290        {
    291291            $order = self::get_order($order);
    292             if(is_null($order) || !is_a($order, 'WC_Order'))
     292            if(is_null($order) || !is_a($order, 'WC_Abstract_Order'))
    293293            {
    294294                return;
     
    305305            //fallback
    306306            $order = wc_get_order($order_id);
    307             if(is_null($order) || !is_a($order, 'WC_Order'))
     307            if(is_null($order) || !is_a($order, 'WC_Abstract_Order'))
    308308            {
    309309                return;
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/includes/class-wf-woocommerce-packing-list.php

    r3421609 r3457991  
    117117        }else
    118118        {
    119             $this->version = '4.9.0';
    120             self::$base_version = '4.9.0';
     119            $this->version = '4.9.1';
     120            self::$base_version = '4.9.1';
    121121        }
    122122        if(defined('WF_PKLIST_PLUGIN_NAME'))
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/print-invoices-packing-slip-labels-for-woocommerce.php

    r3421609 r3457991  
    1414 * Plugin URI:        https://www.webtoffee.com/product/woocommerce-pdf-invoices-packing-slips/
    1515 * Description:       Prints Packing List,Invoice,Delivery Note and Shipping Label.
    16  * Version:           4.9.0
     16 * Version:           4.9.1
    1717 * Author:            WebToffee
    1818 * Author URI:        https://www.webtoffee.com/
     
    2121 * Text Domain:       print-invoices-packing-slip-labels-for-woocommerce
    2222 * Domain Path:       /languages
    23  * WC tested up to:   10.4.2
     23 * WC tested up to:   10.5.0
    2424 */
    2525// If this file is called directly, abort.
     
    7272     * Currently plugin version.
    7373     */
    74     define('WF_PKLIST_VERSION', '4.9.0');
     74    define('WF_PKLIST_VERSION', '4.9.1');
    7575
    7676    if ( ! defined( 'WBTE_PKLIST_CROSS_PROMO_BANNER_VERSION' ) ) {
     
    8686 */
    8787
    88 add_action('in_plugin_update_message-print-invoices-packing-slip-labels-for-woocommerce/print-invoices-packing-slip-labels-for-woocommerce.php', 'wbte_packing_list_update_message', 10, 2);
    89 
    90 function wbte_packing_list_update_message($data, $response)
    91 {
    92     if (isset($data['upgrade_notice'])) {
    93         add_action('admin_print_footer_scripts', 'wbte_packing_list_plugin_screen_update_js');
    94 
    95         $msg = str_replace(array('<p>', '</p>'), array('<div>', '</div>'), $data['upgrade_notice']);
    96         echo '<style type="text/css">
    97              #print-invoices-packing-slip-labels-for-woocommerce-update .update-message p:last-child { display: none; }
    98              #print-invoices-packing-slip-labels-for-woocommerce-update ul { list-style: disc; margin-left: 30px; }
    99              .wf-update-message { padding-left: 30px; }
    100          </style>
    101          <div class="update-message wf-update-message">' . wp_kses_post(wpautop($msg)) . '</div>';
    102     }
    103 }
    104 
    105 function wbte_packing_list_plugin_screen_update_js()
    106 {
    107 ?>
    108     <script>
    109         (function($) {
    110             var updateDiv = $('#print-invoices-packing-slip-labels-for-woocommerce-update');
    111             updateDiv.find('.wf-update-message').next('p').remove();
    112             updateDiv.find('a.update-link:eq(0)').click(function() {
    113                 $('.wf-update-message').remove();
    114             });
    115         })(jQuery);
    116     </script>
    117     <?php
    118 }
    119 
     88 if ( ! function_exists( 'wbte_packing_list_update_message' ) && ! function_exists( 'wbte_packing_list_plugin_screen_update_js' ) ) {
     89    add_action('in_plugin_update_message-print-invoices-packing-slip-labels-for-woocommerce/print-invoices-packing-slip-labels-for-woocommerce.php', 'wbte_packing_list_update_message', 10, 2);
     90
     91    function wbte_packing_list_update_message($data, $response)
     92    {
     93        if (isset($data['upgrade_notice'])) {
     94            add_action('admin_print_footer_scripts', 'wbte_packing_list_plugin_screen_update_js');
     95
     96            $msg = str_replace(array('<p>', '</p>'), array('<div>', '</div>'), $data['upgrade_notice']);
     97            echo '<style type="text/css">
     98                #print-invoices-packing-slip-labels-for-woocommerce-update .update-message p:last-child { display: none; }
     99                #print-invoices-packing-slip-labels-for-woocommerce-update ul { list-style: disc; margin-left: 30px; }
     100                .wf-update-message { padding-left: 30px; }
     101            </style>
     102            <div class="update-message wf-update-message">' . wp_kses_post(wpautop($msg)) . '</div>';
     103        }
     104    }
     105
     106    function wbte_packing_list_plugin_screen_update_js()
     107    {
     108    ?>
     109        <script>
     110            (function($) {
     111                var updateDiv = $('#print-invoices-packing-slip-labels-for-woocommerce-update');
     112                updateDiv.find('.wf-update-message').next('p').remove();
     113                updateDiv.find('a.update-link:eq(0)').click(function() {
     114                    $('.wf-update-message').remove();
     115                });
     116            })(jQuery);
     117        </script>
     118        <?php
     119    }
     120 }
    120121
    121122/**
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/deliverynote/data/data.template1.php

    r3121275 r3457991  
    9595                    <span class="wfte_shipping_method_val">[wfte_shipping_method]</span>
    9696                </div>
     97                <div class="wfte_customer_note wfte_template_element" data-hover-id="customer_note">
     98                    <span class="wfte_customer_note_label wfte_order_fields_label">__[Customer note:]__ </span>
     99                    <span class="wfte_customer_note_val wfte_order_fields_val">[wfte_customer_note]</span>
     100                </div>
    97101                <div class="wfte_order_item_meta">[wfte_order_item_meta]</div>
    98102                [wfte_extra_fields]
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/deliverynote/deliverynote.php

    r3351991 r3457991  
    2828        add_filter('wf_module_default_settings', array($this, 'default_settings'), 10, 2);
    2929
     30        add_filter('wf_module_customizable_items', array($this, 'get_customizable_items'), 10, 2);
     31        add_filter('wf_module_non_options_fields', array($this, 'get_non_options_fields'), 10, 2);
     32        add_filter('wf_module_non_disable_fields', array($this, 'get_non_disable_fields'), 10, 2);
     33        add_filter('wf_module_convert_to_design_view_html_for_' . $this->module_base, array($this, 'convert_to_design_view_html'), 10, 3);
     34
    3035        //hook to generate template html
    3136        add_filter('wf_module_generate_template_html_for_' . $this->module_base, array($this, 'generate_template_html'), 10, 6);
     
    4247        //alter product table column
    4348        add_filter('wf_pklist_alter_product_table_head', array($this, 'alter_product_table_head'), 10, 3);
     49
     50        add_filter('wt_pklist_customizer_preview_only', array($this, 'enable_preview_only_mode'), 10, 2);
    4451
    4552        //initializing customizer       
     
    168175    }
    169176
     177    public function enable_preview_only_mode($preview_only, $template_type)
     178    {
     179        if ($template_type === $this->module_base) {
     180            $pro_sl_path = 'wt-woocommerce-shippinglabel-addon/wt-woocommerce-shippinglabel-addon.php';
     181            if (!is_plugin_active($pro_sl_path)) {
     182                return true;
     183            }
     184            return false;
     185        }
     186        return $preview_only;
     187    }
     188
     189    public function get_customizable_items($settings, $base_id)
     190    {
     191        $is_pro_customizer = is_plugin_active('wt-woocommerce-shippinglabel-addon/wt-woocommerce-shippinglabel-addon.php');
     192        if ($base_id === $this->module_id && !$is_pro_customizer) {
     193            $only_pro_html = '<span class="wt_customizer_pro_text" style="color:red;"> (' . __('Pro version', 'print-invoices-packing-slip-labels-for-woocommerce') . ')</span>';
     194            $settings = array(
     195                'product_table' => __('Product Table', 'print-invoices-packing-slip-labels-for-woocommerce'),
     196                'shipping_address' => __('Shipping Address', 'print-invoices-packing-slip-labels-for-woocommerce'),
     197                'customer_note' => __('Customer note', 'print-invoices-packing-slip-labels-for-woocommerce'),
     198                'footer' => __('Footer', 'print-invoices-packing-slip-labels-for-woocommerce'),
     199                'ssn_number_pro_element' => __('SSN number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     200                'vat_number_pro_element' => __('VAT number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     201                'tracking_number_pro_element' => __('Tracking Number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     202                'signature_pro_element' => __('Signature', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     203                'return_policy_pro_element' => __('Return policy', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     204                'barcode_pro_element' => __('Bar code', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     205            );
     206        }
     207        return $settings;
     208    }
     209
     210    public function get_non_options_fields($settings, $base_id)
     211    {
     212        if ($base_id === $this->module_id) {
     213            return array(
     214                'footer',
     215            );
     216        }
     217        return $settings;
     218    }
     219
     220    public function get_non_disable_fields($settings, $base_id)
     221    {
     222        if ($base_id === $this->module_id) {
     223            return array();
     224        }
     225        return $settings;
     226    }
     227
     228    public function convert_to_design_view_html($find_replace, $html, $template_type)
     229    {
     230        $is_pro_customizer = apply_filters('wt_pklist_pro_customizer_' . $template_type, false, $template_type);
     231        if ($template_type === $this->module_base && !$is_pro_customizer) {
     232            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_billing_address($find_replace, $template_type);
     233            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_shipping_address($find_replace, $template_type);
     234            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_default_order_fields($find_replace, $template_type, $html);
     235            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_product_table($find_replace, $template_type, $html);
     236            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_other_data($find_replace, $template_type, $html);
     237           
     238            // Hide pro elements when pro addon is not active
     239            $find_replace['wfte_vat_number'] = 'wfte_hidden';
     240            $find_replace['wfte_signature'] = 'wfte_hidden';
     241        }
     242        return $find_replace;
     243    }
     244
    170245    public function admin_settings_page()
    171246    {
     
    176251        $template_type = $this->module_base;
    177252        include_once WF_PKLIST_PLUGIN_PATH . '/admin/views/premium_extension_listing.php';
     253
     254        if (!is_null($this->customizer) && true === apply_filters('wt_pklist_switch_to_classic_customizer_' . $this->module_base, true, $this->module_base)) {
     255            $this->customizer->init($this->module_base);
     256        }
     257
    178258        include(plugin_dir_path(__FILE__) . 'views/admin-settings.php');
    179259    }
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/deliverynote/views/admin-settings.php

    r3395665 r3457991  
    66$tab_items=array(
    77    "general"=>__("General", 'print-invoices-packing-slip-labels-for-woocommerce'),
    8     'customize_pro' => sprintf(
    9         '%s <img src="%s" alt="%s" style="padding: 3px !important; width: 18px; height: 18px; margin-left: 4px;">',
    10         __( 'Customize', 'print-invoices-packing-slip-labels-for-woocommerce' ),
    11         esc_url( WF_PKLIST_PLUGIN_URL . 'assets/images/Crown.png' ),
    12         esc_attr__( 'Crown', 'print-invoices-packing-slip-labels-for-woocommerce' )
    13     ),
    148);
    159$tab_items = apply_filters('wt_pklist_add_additional_tab_item_into_module',$tab_items,$this->module_base,$this->module_id);
     
    6862            'module_id'=>$this->module_base
    6963        ));?>
     64        <?php
     65        // Customizer promotion popup.
     66        include_once WF_PKLIST_PLUGIN_PATH . 'admin/views/customizer-promotion-popup.php';
     67        ?>
    7068    </div>
    7169</div>
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/dispatchlabel/data/data.template1.php

    r3320297 r3457991  
    153153            </div>
    154154            <div class="wfte_invoice_data">
    155                 <div class="wfte_tracking_number wfte_template_element" data-hover-id="tracking_number">
    156                     <span class="wfte_tracking_number_label">__[Tracking number:]__</span>
    157                     <span class="wfte_tracking_number_val">[wfte_tracking_number]</span>
    158                 </div>
    159                 <div class="wfte_ssn_number wfte_template_element" data-hover-id="ssn_number">
    160                     <span class="wfte_ssn_number_label">__[SSN:]__</span>
    161                     <span class="wfte_ssn_number_val">[wfte_ssn_number]</span>
    162                 </div>
    163155                [wfte_extra_fields]
    164156            </div>
     
    238230    <div class="wfte_row clearfix">
    239231        <div class="wfte_col-1">
     232            <div class="wfte_invoice_data">
     233                <div class="wfte_customer_note wfte_template_element" data-hover-id="customer_note">
     234                    <span class="wfte_customer_note_label wfte_order_fields_label">__[Customer note:]__ </span>
     235                    <span class="wfte_customer_note_val wfte_order_fields_val">[wfte_customer_note]</span>
     236                </div>
     237            </div>
     238        </div>
     239    </div>
     240    <div class="clearfix"></div>
     241    <div class="wfte_row clearfix">
     242        <div class="wfte_col-1">
    240243            <div class="wfte_return_policy clearfix wfte_template_element" data-hover-id="return_policy">
    241244                [wfte_return_policy]
     
    246249    <div class="wfte_row clearfix">
    247250        <div class="wfte_col-1">
    248             <div class="wfte_footer clearfix wfte_template_element" data-hover-id="footer">
    249                 [wfte_footer]
     251            <div class="wfte_col-1 float_left">
     252                <div class="wfte_footer clearfix wfte_template_element" data-hover-id="footer">
     253                    [wfte_footer]
     254                </div>
    250255            </div>
    251256        </div>
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/dispatchlabel/dispatchlabel.php

    r3351991 r3457991  
    2929        add_filter('wt_admin_menu', array($this, 'add_admin_pages'), 10, 1);
    3030        add_filter('wf_module_default_settings', array($this, 'default_settings'), 10, 2);
     31
     32        add_filter('wf_module_customizable_items', array($this, 'get_customizable_items'), 10, 2);
     33        add_filter('wf_module_non_options_fields', array($this, 'get_non_options_fields'), 10, 2);
     34        add_filter('wf_module_non_disable_fields', array($this, 'get_non_disable_fields'), 10, 2);
     35
     36        add_filter('wf_module_convert_to_design_view_html_for_' . $this->module_base, array($this, 'convert_to_design_view_html'), 10, 3);
     37
    3138        //hook to generate template html
    3239        add_filter('wf_module_generate_template_html_for_' . $this->module_base, array($this, 'generate_template_html'), 10, 6);
     
    3946        add_filter('wf_pklist_alter_settings', array($this, 'alter_settings'), 10, 2);
    4047        add_filter('wf_pklist_alter_option', array($this, 'alter_option'), 10, 4);
     48
     49        add_filter('wt_pklist_customizer_preview_only', array($this, 'enable_preview_only_mode'), 10, 2);
    4150
    4251        //initializing customizer       
     
    145154    }
    146155
     156    public function enable_preview_only_mode($preview_only, $template_type)
     157    {
     158        if ($template_type === $this->module_base) {
     159            $pro_sl_path = 'wt-woocommerce-shippinglabel-addon/wt-woocommerce-shippinglabel-addon.php';
     160            if (!is_plugin_active($pro_sl_path)) {
     161                return true;
     162            }
     163            return false;
     164        }
     165        return $preview_only;
     166    }
     167
     168    public function get_customizable_items($settings, $base_id)
     169    {
     170        $is_pro_customizer = is_plugin_active('wt-woocommerce-shippinglabel-addon/wt-woocommerce-shippinglabel-addon.php');
     171        if ($base_id === $this->module_id && !$is_pro_customizer) {
     172            $only_pro_html = '<span class="wt_customizer_pro_text" style="color:red;"> (' . __('Pro version', 'print-invoices-packing-slip-labels-for-woocommerce') . ')</span>';
     173            $settings = array(
     174                'product_table' => __('Product Table', 'print-invoices-packing-slip-labels-for-woocommerce'),
     175                'shipping_address' => __('Shipping Address', 'print-invoices-packing-slip-labels-for-woocommerce'),
     176                'customer_note' => __('Customer note', 'print-invoices-packing-slip-labels-for-woocommerce'),
     177                'footer' => __('Footer', 'print-invoices-packing-slip-labels-for-woocommerce'),
     178                'return_policy' => __('Return policy', 'print-invoices-packing-slip-labels-for-woocommerce'),
     179                'ssn_number_pro_element' => __('SSN number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     180                'vat_number_pro_element' => __('VAT number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     181                'tracking_number_pro_element' => __('Tracking Number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     182            );
     183        }
     184        return $settings;
     185    }
     186
     187    public function get_non_options_fields($settings, $base_id)
     188    {
     189        if ($base_id === $this->module_id) {
     190            return array(
     191                'footer',
     192            );
     193        }
     194        return $settings;
     195    }
     196
     197    public function get_non_disable_fields($settings, $base_id)
     198    {
     199        if ($base_id === $this->module_id) {
     200            return array();
     201        }
     202        return $settings;
     203    }
     204
     205    public function convert_to_design_view_html($find_replace, $html, $template_type)
     206    {
     207        $is_pro_customizer = apply_filters('wt_pklist_pro_customizer_' . $template_type, false, $template_type);
     208        if ($template_type === $this->module_base && !$is_pro_customizer) {
     209            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_billing_address($find_replace, $template_type);
     210            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_shipping_address($find_replace, $template_type);
     211            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_default_order_fields($find_replace, $template_type, $html);
     212            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_product_table($find_replace, $template_type, $html);
     213            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_other_data($find_replace, $template_type, $html);
     214        }
     215        return $find_replace;
     216    }
     217
    147218    public function admin_settings_page()
    148219    {
     
    153224        $template_type = $this->module_base;
    154225        include_once WF_PKLIST_PLUGIN_PATH . '/admin/views/premium_extension_listing.php';
     226
     227        if (!is_null($this->customizer) && true === apply_filters('wt_pklist_switch_to_classic_customizer_' . $this->module_base, true, $this->module_base)) {
     228            $this->customizer->init($this->module_base);
     229        }
     230
    155231        include(plugin_dir_path(__FILE__) . 'views/admin-settings.php');
    156232    }
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/dispatchlabel/views/admin-settings.php

    r3395665 r3457991  
    55$tab_items=array(
    66    "general"=>__("General", 'print-invoices-packing-slip-labels-for-woocommerce'),
    7     'customize_pro' => sprintf(
    8         '%s <img src="%s" alt="%s" style="padding: 3px !important; width: 18px; height: 18px; margin-left: 4px;">',
    9         __( 'Customize', 'print-invoices-packing-slip-labels-for-woocommerce' ),
    10         esc_url( WF_PKLIST_PLUGIN_URL . 'assets/images/Crown.png' ),
    11         esc_attr__( 'Crown', 'print-invoices-packing-slip-labels-for-woocommerce' )
    12     ),
    137);
    148$tab_items = apply_filters('wt_pklist_add_additional_tab_item_into_module',$tab_items,$this->module_base,$this->module_id);
     
    7367            'module_id'=>$this->module_base
    7468        ));?>
     69        <?php
     70        // Customizer promotion popup.
     71        include_once WF_PKLIST_PLUGIN_PATH . 'admin/views/customizer-promotion-popup.php';
     72        ?>
    7573    </div>
    7674</div>
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/invoice/data/data.template0.php

    r3121275 r3457991  
    207207                        <th class="wfte_product_table_head_serial_no wfte_product_table_head_bg wfte_table_head_color" col-type="serial_no">__[S.No]__</th>
    208208                        <th class="wfte_product_table_head_image wfte_product_table_head_bg wfte_table_head_color" col-type="-image" data-img-width="50px">__[Image]__</th>
    209                         <th class="wfte_product_table_head_sku wfte_product_table_head_bg wfte_table_head_color" col-type="-sku">__[SKU]__</th>
     209                        <th class="wfte_product_table_head_sku wfte_product_table_head_bg wfte_table_head_color" col-type="sku">__[SKU]__</th>
    210210                        <th class="wfte_product_table_head_product wfte_product_table_head_bg wfte_table_head_color" col-type="product">__[Product]__</th>
    211211                        <th class="wfte_product_table_head_quantity wfte_product_table_head_bg wfte_table_head_color wfte_text_center" col-type="quantity">__[Quantity]__</th>
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/packinglist/data/data.template1.php

    r3210386 r3457991  
    8989                    <span class="wfte_shipping_method_val">[wfte_shipping_method]</span>
    9090                </div>
    91                 <div class="wfte_tracking_number wfte_template_element" data-hover-id="tracking_number">
    92                     <span class="wfte_tracking_number_label">__[Tracking number:]__</span>
    93                     <span class="wfte_tracking_number_val">[wfte_tracking_number]</span>
    94                 </div>
    95                 <div class="wfte_ssn_number wfte_template_element" data-hover-id="ssn_number">
    96                     <span class="wfte_ssn_number_label">__[SSN:]__ </span>
    97                     <span class="wfte_ssn_number_val">[wfte_ssn_number]</span>
    98                 </div>
    99                 <div class="wfte_vat_number wfte_template_element" data-hover-id="vat_number">
    100                     <span class="wfte_vat_number_label">__[VAT:]__ </span>
    101                     <span class="wfte_vat_number_val">[wfte_vat_number]</span>
    102                 </div>
    10391                <div class="wfte_order_item_meta">[wfte_order_item_meta]</div>
    10492                [wfte_extra_fields]
     
    162150                    <th class="wfte_product_table_head_serial_no wfte_product_table_head_bg wfte_table_head_color" col-type="serial_no">__[S.No]__</th>
    163151                    <th class="wfte_product_table_head_image wfte_product_table_head_bg wfte_table_head_color" col-type="image" data-img-width="50px">__[Image]__</th>
    164                     <th class="wfte_product_table_head_sku wfte_product_table_head_bg wfte_table_head_color" col-type="-sku">__[SKU]__</th>
     152                    <th class="wfte_product_table_head_sku wfte_product_table_head_bg wfte_table_head_color" col-type="sku">__[SKU]__</th>
    165153                    <th class="wfte_product_table_head_product wfte_product_table_head_bg wfte_table_head_color" col-type="product">__[Product]__</th>
    166154                    <th class="wfte_product_table_head_quantity wfte_product_table_head_bg wfte_table_head_color wfte_text_center" col-type="quantity">__[Quantity]__</th>
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/packinglist/data/data.tooltip.php

    r2839757 r3457991  
    11<?php
    22$arr = array(
    3     'woocommerce_wf_attach_image_packinglist' => __("Adds product image to the line items in the product table","print-invoices-packing-slip-labels-for-woocommerce"),
    4     'woocommerce_wf_add_customer_note_in_packinglist' => __("Adds customer note to the packing slip","print-invoices-packing-slip-labels-for-woocommerce"),
    5     'woocommerce_wf_packinglist_footer_pk' => __("Adds Footer to the packing slip","print-invoices-packing-slip-labels-for-woocommerce")
     3    'woocommerce_wf_attach_image_packinglist' => __('Adds product image to the line items in the product table','print-invoices-packing-slip-labels-for-woocommerce'),
     4    'woocommerce_wf_attach_sku_packinglist' => __('Adds product SKU to the line items in the product table','print-invoices-packing-slip-labels-for-woocommerce'),
     5    'woocommerce_wf_add_customer_note_in_packinglist' => __('Adds customer note to the packing slip','print-invoices-packing-slip-labels-for-woocommerce'),
     6    'woocommerce_wf_packinglist_footer_pk' => __('Adds Footer to the packing slip','print-invoices-packing-slip-labels-for-woocommerce')
    67);
    7 $arr = apply_filters("wt_pklist_alter_tooltip_data_".$this->module_base,$arr,$this->module_base);
     8$arr = apply_filters('wt_pklist_alter_tooltip_data_'.$this->module_base,$arr,$this->module_base);
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/packinglist/packinglist.php

    r3351991 r3457991  
    3131
    3232        add_filter('wf_module_default_settings', array($this, 'default_settings'), 10, 2);
     33       
     34        add_filter('wf_module_customizable_items', array($this, 'get_customizable_items'), 10, 2);
     35        add_filter('wf_module_non_options_fields', array($this, 'get_non_options_fields'), 10, 2);
     36        add_filter('wf_module_non_disable_fields', array($this, 'get_non_disable_fields'), 10, 2);
     37       
     38        add_filter('wt_pklist_customizer_preview_only', array($this, 'enable_preview_only_mode'), 10, 2);
     39       
     40        add_filter('wf_module_convert_to_design_view_html_for_' . $this->module_base, array($this, 'convert_to_design_view_html'), 10, 3);
     41       
    3342        //hook to generate template html
    3443        add_filter('wf_module_generate_template_html_for_' . $this->module_base, array($this, 'generate_template_html'), 10, 6);
     
    108117        $is_pro_customizer = apply_filters('wt_pklist_pro_customizer_' . $this->module_base, false, $this->module_base);
    109118        if ($template_type === $this->module_base && !$is_pro_customizer) {
    110             $is_image_enabled = Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_attach_image_' . $this->module_base, $this->module_id);
    111             if ("No" === $is_image_enabled) {
    112                 if (isset($columns_list_arr['image'])) //image column exists
    113                 {
    114                     $columns_list_arr['-image'] = $columns_list_arr['image'];
    115                     unset($columns_list_arr['image']);
    116                 }
    117             } else {
    118                 if (!isset($columns_list_arr['image'])) //image column exists
    119                 {
    120                     $columns_list_arr['image'] = isset($columns_list_arr['-image']) ? $columns_list_arr['-image'] : 'Image';
    121                 }
    122                 unset($columns_list_arr['-image']); //if exists
     119            $columns_config = array(
     120                'image' => array('option' => 'woocommerce_wf_attach_image_', 'default' => 'Image'),
     121                'sku'   => array('option' => 'woocommerce_wf_attach_sku_', 'default' => 'SKU'),
     122            );
     123
     124            foreach ($columns_config as $column_key => $config) {
     125                $is_enabled = Wf_Woocommerce_Packing_List::get_option($config['option'] . $this->module_base, $this->module_id);
     126                $hidden_key = '-' . $column_key;
     127                $from_key = ("No" === $is_enabled) ? $column_key : $hidden_key;
     128                $to_key = ("No" === $is_enabled) ? $hidden_key : $column_key;
     129
     130                if (isset($columns_list_arr[$from_key])) {
     131                    // Rebuild array to preserve position when swapping keys
     132                    $new_arr = array();
     133                    foreach ($columns_list_arr as $k => $v) {
     134                        $new_arr[$k === $from_key ? $to_key : $k] = $v;
     135                    }
     136                    $columns_list_arr = $new_arr;
     137                } elseif ("No" !== $is_enabled && !isset($columns_list_arr[$column_key])) {
     138                    $columns_list_arr[$column_key] = $config['default'];
     139                }
    123140            }
    124141        }
     
    173190    }
    174191
     192    public function convert_to_design_view_html($find_replace, $html, $template_type)
     193    {
     194        $is_pro_customizer = apply_filters('wt_pklist_pro_customizer_' . $template_type, false, $template_type);
     195        if ($template_type === $this->module_base && !$is_pro_customizer) {
     196            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_billing_address($find_replace, $template_type);
     197            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_shipping_address($find_replace, $template_type);
     198            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_default_order_fields($find_replace, $template_type, $html);
     199            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_product_table($find_replace, $template_type, $html);
     200            $find_replace = Wf_Woocommerce_Packing_List_CustomizerLib::set_other_data($find_replace, $template_type, $html);
     201        }
     202        return $find_replace;
     203    }
     204
     205    public function get_customizable_items($settings, $base_id)
     206    {
     207        $is_pro_customizer = apply_filters('wt_pklist_pro_customizer_' . $this->module_base, false, $this->module_base);
     208        if ($base_id === $this->module_id && !$is_pro_customizer) {
     209            $only_pro_html = '<span class="wt_customizer_pro_text" style="color:red;"> (' . __('Pro version', 'print-invoices-packing-slip-labels-for-woocommerce') . ')</span>';
     210            //these fields are the classname in template Eg: `company_logo` will point to `wfte_company_logo`
     211            $settings = array(
     212                'product_table' => __('Product Table', 'print-invoices-packing-slip-labels-for-woocommerce'),
     213                'shipping_address' => __('Shipping Address', 'print-invoices-packing-slip-labels-for-woocommerce'),
     214                'customer_note' => __('Customer note', 'print-invoices-packing-slip-labels-for-woocommerce'),
     215                'footer' => __('Footer', 'print-invoices-packing-slip-labels-for-woocommerce'),
     216                // Working features with Pro label (fully functional)
     217                'ssn_number_pro_element' => __('SSN number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     218                'vat_number_pro_element' => __('VAT number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     219                'tracking_number_pro_element' => __('Tracking Number', 'print-invoices-packing-slip-labels-for-woocommerce') . $only_pro_html,
     220            );
     221        }
     222        return $settings;
     223    }
     224
     225    public function get_non_options_fields($settings, $base_id)
     226    {
     227        if ($base_id === $this->module_id) {
     228            return array(
     229                'footer',
     230            );
     231        }
     232        return $settings;
     233    }
     234
     235    public function get_non_disable_fields($settings, $base_id)
     236    {
     237        if ($base_id === $this->module_id) {
     238            return array();
     239        }
     240        return $settings;
     241    }
     242
     243    public function enable_preview_only_mode($preview_only, $template_type)
     244    {
     245        if ($template_type === $this->module_base) {
     246            $pro_invoice_path = 'wt-woocommerce-invoice-addon/wt-woocommerce-invoice-addon.php';
     247            if (!is_plugin_active($pro_invoice_path)) {
     248                return true;
     249            }
     250            return false;
     251        }
     252        return $preview_only;
     253    }
     254
    175255    public function admin_settings_page()
    176256    {
     
    181261        $template_type = $this->module_base;
    182262        include_once WF_PKLIST_PLUGIN_PATH . '/admin/views/premium_extension_listing.php';
     263       
     264        if (!is_null($this->customizer) && true === apply_filters('wt_pklist_switch_to_classic_customizer_' . $this->module_base, true, $this->module_base)) {
     265            $this->customizer->init($this->module_base);
     266        }
     267       
    183268        include(plugin_dir_path(__FILE__) . 'views/admin-settings.php');
    184269    }
     
    210295            return array(
    211296                'woocommerce_wf_attach_image_packinglist' => 'Yes',
     297                'woocommerce_wf_attach_sku_packinglist' => 'Yes',
    212298                'woocommerce_wf_add_customer_note_in_packinglist' => 'No',
    213299                'woocommerce_wf_packinglist_footer_pk' => 'No',
     
    408494                $order_docs_old     = Wt_Pklist_Common::get_order_meta($order_id, '_created_document_old', true);
    409495
    410                 if ((!empty($order_docs) && in_array($this->module_base, $order_docs)) || (!empty($order_docs_old) && in_array($this->module_base, $order_docs_old))) {
     496                if ((!empty($order_docs) && is_array($order_docs) && in_array($this->module_base, $order_docs)) || (!empty($order_docs_old) && is_array($order_docs_old) && in_array($this->module_base, $order_docs_old))) {
    411497                    $btn_action_name    = 'wt_pklist_print_document_' . $this->module_base;
    412498                    $img_url            = WF_PKLIST_PLUGIN_URL . 'admin/images/' . $this->module_base . '_logo.png';
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/packinglist/views/admin-settings.php

    r3395665 r3457991  
    66$tab_items = array(
    77    'general'      => __( 'General', 'print-invoices-packing-slip-labels-for-woocommerce' ),
    8     'customize_pro' => sprintf(
    9         '%s <img src="%s" alt="%s" style="padding: 3px !important; width: 18px; height: 18px; margin-left: 4px;">',
    10         __( 'Customize', 'print-invoices-packing-slip-labels-for-woocommerce' ),
    11         esc_url( WF_PKLIST_PLUGIN_URL . 'assets/images/Crown.png' ),
    12         esc_attr__( 'Crown', 'print-invoices-packing-slip-labels-for-woocommerce' )
    13     ),
    148);
    159
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/packinglist/views/customize_pro.php

    r3395665 r3457991  
    33    exit;
    44}
     5
     6function wt_pklist_get_dummy_data() {
     7    return array(
     8        '[wfte_order_number]'     => '123456',
     9        '[wfte_order_date]'       => wp_date('m-d-Y'),
     10        '[wfte_invoice_number]'   => '123456',
     11        '[wfte_invoice_date]'     => wp_date('m-d-Y'),
     12        '[wfte_billing_address]'  => 'Billing address name<br>20 Maple Avenue<br>San Pedro<br>California<br>United States (US)<br>90731',
     13        '[wfte_shipping_address]' => 'Shipping address name<br>20 Maple Avenue<br>San Pedro<br>California<br>United States (US)<br>90731',
     14        '[wfte_email]'            => 'info@example.com',
     15        '[wfte_tel]'              => '+1 123 456',
     16        '[wfte_shipping_method]'  => 'DHL',
     17        '[wfte_tracking_number]'  => '123456',
     18        '[wfte_ssn_number]'       => 'SSN123456',
     19        '[wfte_vat_number]'       => '123456',
     20        '[wfte_customer_note]'    => '',
     21        '[wfte_order_item_meta]'  => '',
     22        '[wfte_extra_fields]'     => '',
     23        '[wfte_weight]'           => '2 kg',
     24        '[wfte_return_policy]'    => '',
     25        '[wfte_product_table_start]' => '',
     26        '[wfte_product_table_end]'   => '',
     27    );
     28}
     29
     30function wt_pklist_build_preview_html($template_type) {
     31    $template_file = WF_PKLIST_PLUGIN_PATH . 'public/modules/packinglist/data/data.template1.php';
     32    if (!file_exists($template_file)) {
     33        return '';
     34    }
     35
     36    $html = html_entity_decode(stripslashes(file_get_contents($template_file)));
     37    // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText -- Dynamic translation strings from template file
     38    $html = preg_replace_callback('/__\[(.*?)\]__/s', fn($m) => isset($m[1]) && trim($m[1]) ? __($m[1], 'print-invoices-packing-slip-labels-for-woocommerce') : '', $html);
     39
     40    $options = Wf_Woocommerce_Packing_List::get_settings();
     41    $module_opts = Wf_Woocommerce_Packing_List::get_settings(Wf_Woocommerce_Packing_List::get_module_id($template_type));
     42   
     43    $logo_url = $module_opts['woocommerce_wf_packinglist_logo'] ?? $options['woocommerce_wf_packinglist_logo'] ?? '';
     44    if (empty($logo_url)) {
     45        $logo_url = WF_PKLIST_PLUGIN_URL . 'admin/modules/customizer/assets/images/logo_dummy.png';
     46    }
     47
     48    // From address
     49    $countries = WC()->countries;
     50    $country_arr = explode(':', $options['wf_country'] ?? '');
     51    $country_code = $country_arr[0] ?? '';
     52    $state = $country_arr[1] ?? '';
     53   
     54    $from_parts = array_filter(array(
     55        $options['woocommerce_wf_packinglist_sender_name'] ?? '',
     56        $options['woocommerce_wf_packinglist_sender_address_line1'] ?? '',
     57        $options['woocommerce_wf_packinglist_sender_address_line2'] ?? '',
     58        $options['woocommerce_wf_packinglist_sender_city'] ?? '',
     59        $countries->states[$country_code][$state] ?? $state,
     60        $countries->countries[$country_code] ?? '',
     61        $options['woocommerce_wf_packinglist_sender_postalcode'] ?? '',
     62        $options['woocommerce_wf_packinglist_sender_contact_number'] ?? '',
     63        $options['woocommerce_wf_packinglist_sender_vat'] ?? '',
     64    ));
     65
     66    $footer = Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_packinglist_footer', Wf_Woocommerce_Packing_List::get_module_id($template_type));
     67    if (!$footer) {
     68        $footer = Wf_Woocommerce_Packing_List::get_option('woocommerce_wf_packinglist_footer');
     69    }
     70
     71    $find_replace = array_merge(wt_pklist_get_dummy_data(), array(
     72        '[wfte_company_logo_url]' => $logo_url,
     73        '[wfte_company_name]'     => $options['woocommerce_wf_packinglist_companyname'] ?? '',
     74        '[wfte_from_address]'     => implode('<br />', $from_parts),
     75        '[wfte_footer]'           => $footer ? nl2br($footer) : '',
     76    ));
     77
     78    $html = str_replace(array_keys($find_replace), array_values($find_replace), $html);
     79
     80    // product row
     81    $dummy_row = '<tr>
     82        <td class="serial_no_td wfte_product_table_body_column">1</td>
     83        <td class="image_td wfte_product_table_body_column"><img src="' . esc_url(WF_PKLIST_PLUGIN_URL . 'admin/modules/customizer/assets/images/thumbnail-preview.png') . '" style="max-width:50px; max-height:50px; border-radius:25%;" /></td>
     84        <td class="sku_td wfte_product_table_body_column">A1234</td>
     85        <td class="product_td wfte_product_table_body_column">Jumbing LED Light Wall Ball</td>
     86        <td class="quantity_td wfte_product_table_body_column wfte_text_center">5</td>
     87        <td class="total_weight_td wfte_product_table_body_column">2 kg</td>
     88    </tr>';
     89    $html = preg_replace('/<tbody([^>]*)>(\s*)<\/tbody>/s', '<tbody$1>' . $dummy_row . '</tbody>', $html);
     90
     91    $html = preg_replace(array('/<style[^>]*>.*?<\/style>/s', '/<!--.*?-->/s'), '', $html);
     92
     93    return $html;
     94}
     95
     96$template_type = 'packinglist';
     97$template_html = wt_pklist_build_preview_html($template_type);
     98
     99$premium_features = array(
     100    'shipping_address' => array('label' => __('Shipping address', 'print-invoices-packing-slip-labels-for-woocommerce'), 'element' => 'shipping_address', 'default' => true),
     101    'sku'              => array('label' => __('SKU', 'print-invoices-packing-slip-labels-for-woocommerce'), 'element' => 'product_table_head_sku|sku_td', 'default' => false),
     102    'total_weight'     => array('label' => __('Total weight', 'print-invoices-packing-slip-labels-for-woocommerce'), 'element' => 'product_table_head_total_weight|total_weight_td', 'default' => false),
     103    'ssn'              => array('label' => __('SSN', 'print-invoices-packing-slip-labels-for-woocommerce'), 'element' => 'ssn_number', 'default' => false),
     104    'vat'              => array('label' => __('VAT', 'print-invoices-packing-slip-labels-for-woocommerce'), 'element' => 'vat_number', 'default' => false),
     105);
     106
     107$sidebar_pro_link = 'https://www.webtoffee.com/product/woocommerce-pdf-invoices-packing-slips/?utm_source=free_plugin_sidebar&utm_medium=pdf_basic&utm_campaign=PDF_invoice&utm_content=' . WF_PKLIST_VERSION;
    5108?>
    6 <div class="wf-tab-content" data-id="<?php echo esc_attr($target_id);?>">
    7     <div class="wf-tab-content_customize_pro">
    8         <h2><?php esc_html_e('Basic packing slip template','print-invoices-packing-slip-labels-for-woocommerce');?></h2>
    9         <p><?php esc_html_e('Preview of your current packing slip template.','print-invoices-packing-slip-labels-for-woocommerce');?></p>
    10     </div>
    11     <div class="wf-tab-content-inner">
    12         <form method="post" class="wf_settings_form">
    13             <div class="wt_packing_slip_preview">
    14                 <img src="<?php echo esc_url(WF_PKLIST_PLUGIN_URL . 'assets/images/packingslip-sample.svg'); ?>" alt="<?php esc_attr_e('Packing Slip Preview', 'print-invoices-packing-slip-labels-for-woocommerce'); ?>" style="max-width: 100%; height: auto; padding: 5px;background: #fff;">
     109
     110<div class="wf-tab-content" data-id="<?php echo esc_attr($target_id); ?>">
     111    <div class="wt_pklist_customize_pro_wrapper">
     112        <div class="wt_pklist_customize_pro_left">
     113            <div class="wt_pklist_customize_pro_header">
     114                <h2><?php esc_html_e('Your current packing slip', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></h2>
     115                <p><?php esc_html_e('How your packing slip will appear to customers', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></p>
    15116            </div>
    16                 <?php
    17                     // Set nonce:
    18                     if (function_exists('wp_nonce_field'))
    19                     {
    20                         wp_nonce_field('wf-update-packinglist-'.WF_PKLIST_POST_TYPE);
    21                     }
    22                     ?>                 
    23         </form>
    24         <?php
    25             if(false === $pro_installed){
    26                 $sidebar_pro_link = 'https://www.webtoffee.com/product/woocommerce-pdf-invoices-packing-slips/?utm_source=free_plugin_sidebar&utm_medium=pdf_basic&utm_campaign=PDF_invoice&utm_content='.WF_PKLIST_VERSION;
    27                 $packinglist_pro_feature_list = array(
    28                     __('Professional templates for packing slip','print-invoices-packing-slip-labels-for-woocommerce'),
    29                     __('Show or hide fields like billing address, weight, product image, and more','print-invoices-packing-slip-labels-for-woocommerce'),
    30                     __('Add extra details such as product meta, order info, or custom attributes','print-invoices-packing-slip-labels-for-woocommerce'),
    31                     __('Group and sort products in the table using flexible conditions','print-invoices-packing-slip-labels-for-woocommerce'),
    32                 );
    33             ?>
    34             <div class="wt_pro_plugin_promotion" style="width:30%; margin-right: 20px;">
    35                 <div class="wt_pro_addon_tile_doc" style="<?php echo is_rtl() ? 'left:0;' : 'right:0;'; ?>">
    36                     <div class="wt_customizer_pro_addon_widget_doc">
    37                     <?php
    38                         /**
    39                          * @since 4.7.0 - Add offer for Black Friday Cyber Monday 2024
    40                          */
    41                         if( Wt_Pklist_Common::is_bfcm_season() ) {
    42                         ?>
    43                         <div class="bfcm_doc_settings">
    44                             <img src="<?php echo esc_url(WF_PKLIST_PLUGIN_URL . 'admin/modules/banner/assets/images/bfcm-doc-settings-coupon.svg'); ?>">
    45                         </div>
    46                         <?php
    47                         }
    48                     ?>
    49                         <div class="wt_customizer_pro_addon_widget_wrapper_doc">
    50                             <div class="wt_customizer_pro_addon_widget_wrapper_doc_logo_title">
    51                                 <div class="wt_customizer_pro_addon_widget_wrapper_doc_logo_title_col_1">
    52                                     <img src="<?php echo esc_url(WF_PKLIST_PLUGIN_URL . 'assets/images/unlock-icon.png'); ?>" style="width: 24px; height: 24px;">
    53                                 </div>
    54                                 <div class="wt_customizer_pro_addon_widget_wrapper_doc_logo_title_col_2">
    55                                     <h4><?php echo esc_html__('Unlock more customization','print-invoices-packing-slip-labels-for-woocommerce'); ?></h4>
    56                                     <p><?php esc_html_e('Create fully personalized packing slips that fit your brand — with Premium.','print-invoices-packing-slip-labels-for-woocommerce'); ?></p>
    57                                 </div>
    58                             </div>
    59                             <div class="wt_customizer_pro_addon_features_list_doc">
    60                                 <ul>
    61                                     <?php
    62                                         foreach($packinglist_pro_feature_list as $p_feature){
    63                                             ?>
    64                                             <li><?php echo esc_html($p_feature); ?></li>
    65                                             <?php
    66                                         }
    67                                     ?>
    68                                 </ul>
    69                             </div>
    70                             <p class="wt_customizer_pro_addon_features_list_doc_more"><?php esc_html_e('Plus, many more customization options','print-invoices-packing-slip-labels-for-woocommerce'); ?></p>
    71                             <a class="wt_customizer_pro_addon_premium_link_div_doc" href="<?php echo esc_url($sidebar_pro_link); ?>" target="_blank">
    72                             <img src="<?php echo esc_url(WF_PKLIST_PLUGIN_URL . 'assets/images/Crown.png'); ?>"><?php esc_html_e('Upgrade to premium','print-invoices-packing-slip-labels-for-woocommerce'); ?>
    73                             </a>
    74                         </div>
    75                        
    76                     </div>
     117            <div class="wt_pklist_template_preview_container">
     118                <div class="wt_pklist_template_preview_inner" id="wt_packinglist_preview">
     119                    <?php if (!empty($template_html)) : ?>
     120                        <?php echo $template_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
     121                    <?php else : ?>
     122                        <img src="<?php echo esc_url(WF_PKLIST_PLUGIN_URL . 'assets/images/packingslip-sample.svg'); ?>" alt="<?php esc_attr_e('Packing Slip Preview', 'print-invoices-packing-slip-labels-for-woocommerce'); ?>" style="max-width: 100%; height: auto;">
     123                    <?php endif; ?>
    77124                </div>
    78125            </div>
    79         <?php
    80         }
    81         ?>
     126        </div>
     127       
     128        <div class="wt_pklist_customize_pro_right">
     129            <?php if (false === $pro_installed) : ?>
     130            <div class="wt_pklist_premium_features_panel">
     131                <div class="wt_pklist_premium_features_header">
     132                    <img src="<?php echo esc_url(WF_PKLIST_PLUGIN_URL . 'assets/images/Crown.png'); ?>" class="crown-icon" alt="">
     133                    <h3><?php esc_html_e('Premium features', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></h3>
     134                </div>
     135                <p class="wt_pklist_premium_features_desc"><?php esc_html_e('Toggle the pro features on and off to see how they transform your packing slip', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></p>
     136               
     137                <?php foreach ($premium_features as $key => $config) : ?>
     138                <div class="wt_pklist_toggle_item">
     139                    <span class="wt_pklist_toggle_label"><?php echo esc_html($config['label']); ?></span>
     140                    <label class="wt_pklist_toggle_switch">
     141                        <input type="checkbox" class="wt_pklist_feature_toggle" data-target-element="<?php echo esc_attr($config['element']); ?>" <?php checked($config['default'], true); ?>>
     142                        <span class="wt_pklist_toggle_slider"></span>
     143                    </label>
     144                </div>
     145                <?php endforeach; ?>
     146
     147                <div class="wt_pklist_unlock_panel">
     148                    <div class="wt_pklist_unlock_header">
     149                        <svg class="lock-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
     150                            <path d="M19 11H5C3.89543 11 3 11.8954 3 13V20C3 21.1046 3.89543 22 5 22H19C20.1046 22 21 21.1046 21 20V13C21 11.8954 20.1046 11 19 11Z" stroke="#1e1e1e" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
     151                            <path d="M7 11V7C7 5.67392 7.52678 4.40215 8.46447 3.46447C9.40215 2.52678 10.6739 2 12 2C13.3261 2 14.5979 2.52678 15.5355 3.46447C16.4732 4.40215 17 5.67392 17 7V11" stroke="#1e1e1e" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
     152                        </svg>
     153                        <h3><?php esc_html_e('Unlock full customization', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></h3>
     154                    </div>
     155                    <p class="wt_pklist_unlock_desc"><?php esc_html_e('Design packing slips that match your brand', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></p>
     156                    <ul class="wt_pklist_unlock_features">
     157                        <li><?php esc_html_e('Advanced packing slip templates', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></li>
     158                        <li><?php esc_html_e('Show, hide, rearrange fields', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></li>
     159                        <li><?php esc_html_e('Add additional data such as product meta, order meta, product attributes etc', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></li>
     160                        <li><?php esc_html_e('Group and sort product table based on different conditions', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></li>
     161                        <li><?php esc_html_e('Many more customization options', 'print-invoices-packing-slip-labels-for-woocommerce'); ?></li>
     162                    </ul>
     163                    <a href="<?php echo esc_url($sidebar_pro_link); ?>" target="_blank" class="wt_pklist_unlock_btn">
     164                        <img src="<?php echo esc_url(WF_PKLIST_PLUGIN_URL . 'assets/images/Crown.png'); ?>" alt="">
     165                        <?php esc_html_e('Upgrade To Premium', 'print-invoices-packing-slip-labels-for-woocommerce'); ?>
     166                    </a>
     167                </div>
     168            </div>
     169           
     170            <?php endif; ?>
     171        </div>
    82172    </div>
    83173</div>
    84 <?php do_action('wf_pklist_document_out_settings_form');?>
     174<?php do_action('wf_pklist_document_out_settings_form'); ?>
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/packinglist/views/general.php

    r3351991 r3457991  
    2727                                        'class' => 'woocommerce_wf_attach_image_packinglist',
    2828                                        'name' => 'woocommerce_wf_attach_image_packinglist',
     29                                        'value' => '',
     30                                        'radio_fields' => array(
     31                                                'Yes'=>__('Yes','print-invoices-packing-slip-labels-for-woocommerce'),
     32                                                'No'=>__('No','print-invoices-packing-slip-labels-for-woocommerce')
     33                                            ),
     34                                        'col' => 3,
     35                                        'tooltip' => true,
     36                                        'alignment' => 'horizontal_with_label',
     37                                    ),
     38                                'woocommerce_wf_attach_sku_packinglist' => array(
     39                                        'type' => 'wt_radio',
     40                                        'label' => __("Include product SKU","print-invoices-packing-slip-labels-for-woocommerce"),
     41                                        'id' => '',
     42                                        'class' => 'woocommerce_wf_attach_sku_packinglist',
     43                                        'name' => 'woocommerce_wf_attach_sku_packinglist',
    2944                                        'value' => '',
    3045                                        'radio_fields' => array(
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/public/modules/ubl/lib/class-ubl-xml-file-handler.php

    r3351991 r3457991  
    3232            $file_url = $upload_url . '/'.$name.'.xml';
    3333           
     34            // Extract directory path from file path in case $name contains subdirectories
     35            $file_dir = dirname( $file_path );
     36            if( !is_dir( $file_dir ) ) {
     37                wp_mkdir_p( $file_dir );
     38            }
     39           
    3440            // Write the XML content to the file locally
    3541            file_put_contents($file_path, $xml_content);
  • print-invoices-packing-slip-labels-for-woocommerce/trunk/readme.txt

    r3421609 r3457991  
    11=== WebToffee WooCommerce PDF Invoices, Packing Slips, Delivery Notes and Shipping Labels ===
    22Contributors: WebToffee
    3 Version: 4.9.0
     3Version: 4.9.1
    44Donate link:https://www.webtoffee.com/product/woocommerce-pdf-invoices-packing-slips/
    55Tags: WooCommerce PDF invoices, WooCommerce invoice, packing slips, shipping label, woocommerce print invoice
    66Requires at least: 3.0.1
    77Tested up to: 6.9
    8 Stable tag: 4.9.0
     8Stable tag: 4.9.1
    99Requires PHP: 5.6
    1010License: GPLv2 or later
     
    7474
    7575
    76 &#9989; Tested OK with WooCommerce 10.4.2
     76&#9989; Tested OK with WooCommerce 10.5.0
    7777&#9989; Tested OK up to PHP 8.2
    7878
     
    296296== Changelog ==
    297297
    298 = 4.9.0 2025-12-17 =
    299 * [Fix] - Fixed error 'call to a member function update_meta_data()'.
    300 * [Fix] - Fixed division by zero error in UBL invoice.
    301 * [Tweak] - Translation update.
    302 * [Tweak] - Add safe file locking with automatic fallback for VIP-hosted.
    303 * [Compatibility] - WooCommerce 10.4.2
     298= 4.9.1 2026-02-10 =
     299* [Fix] - Prevent fatal error array before calling in_array() in packing slip.
     300* [Tweak] - Keep SKU enabled by default in invoice and packing slip documents.
     301* [Add] - Added live preview for packing slip, dispatch label, and delivery note documents.
     302* [Compatibility] - WooCommerce 10.5.0
     303* [Compatibility] - WordPress 6.9.1
    304304
    305305[See changelog for all versions](https://plugins.svn.wordpress.org/print-invoices-packing-slip-labels-for-woocommerce/trunk/changelog.txt)
     
    308308== Upgrade Notice ==
    309309
    310 = 4.9.0 =
    311 * [Fix] - Fixed error 'call to a member function update_meta_data()'.
    312 * [Fix] - Fixed division by zero error in UBL invoice.
    313 * [Tweak] - Translation update.
    314 * [Tweak] - Add safe file locking with automatic fallback for VIP-hosted.
    315 * [Compatibility] - WooCommerce 10.4.2
     310= 4.9.1 =
     311* [Fix] - Prevent fatal error array before calling in_array() in packing slip.
     312* [Tweak] - Keep SKU enabled by default in invoice and packing slip documents.
     313* [Add] - Added live preview for packing slip, dispatch label, and delivery note documents.
     314* [Compatibility] - WooCommerce 10.5.0
     315* [Compatibility] - WordPress 6.9.1
Note: See TracChangeset for help on using the changeset viewer.