Changeset 3410915
- Timestamp:
- 12/04/2025 12:46:08 PM (4 months ago)
- Location:
- gift-pack-for-woocommerce
- Files:
-
- 88 added
- 4 edited
-
tags/2.0.2 (added)
-
tags/2.0.2/LICENSE.txt (added)
-
tags/2.0.2/README.txt (added)
-
tags/2.0.2/admin (added)
-
tags/2.0.2/admin/class-gift-pack-for-woocommerce-admin.php (added)
-
tags/2.0.2/admin/css (added)
-
tags/2.0.2/admin/css/gift-pack-for-woocommerce-admin.css (added)
-
tags/2.0.2/admin/index.php (added)
-
tags/2.0.2/admin/js (added)
-
tags/2.0.2/admin/js/admin.js (added)
-
tags/2.0.2/admin/js/custom.js (added)
-
tags/2.0.2/admin/js/gift-pack-for-woocommerce-admin.js (added)
-
tags/2.0.2/admin/partials (added)
-
tags/2.0.2/admin/partials/gift-pack-for-woocommerce-admin-display.php (added)
-
tags/2.0.2/gift-pack-for-woocommerce.php (added)
-
tags/2.0.2/includes (added)
-
tags/2.0.2/includes/class-gift-pack-for-woocommerce-activator.php (added)
-
tags/2.0.2/includes/class-gift-pack-for-woocommerce-deactivator.php (added)
-
tags/2.0.2/includes/class-gift-pack-for-woocommerce-i18n.php (added)
-
tags/2.0.2/includes/class-gift-pack-for-woocommerce-loader.php (added)
-
tags/2.0.2/includes/class-gift-pack-for-woocommerce.php (added)
-
tags/2.0.2/includes/index.php (added)
-
tags/2.0.2/index.php (added)
-
tags/2.0.2/languages (added)
-
tags/2.0.2/languages/gift-pack-for-woocommerce.mo (added)
-
tags/2.0.2/languages/gift-pack-for-woocommerce.po (added)
-
tags/2.0.2/public (added)
-
tags/2.0.2/public/class-gift-pack-for-woocommerce-public.php (added)
-
tags/2.0.2/public/css (added)
-
tags/2.0.2/public/css/gift-pack-for-woocommerce-public.css (added)
-
tags/2.0.2/public/images (added)
-
tags/2.0.2/public/images/blue_gift_pack.png (added)
-
tags/2.0.2/public/images/default_gift.png (added)
-
tags/2.0.2/public/images/green_gift_pack.png (added)
-
tags/2.0.2/public/images/pink_gift_pack.png (added)
-
tags/2.0.2/public/images/yellow_gift_pack.png (added)
-
tags/2.0.2/public/index.php (added)
-
tags/2.0.2/public/js (added)
-
tags/2.0.2/public/js/gift-pack-for-woocommerce-public.js (added)
-
tags/2.0.2/public/partials (added)
-
tags/2.0.2/public/partials/gift-pack-data-in-order.php (added)
-
tags/2.0.2/public/partials/gift-pack-for-woocommerce-public-display.php (added)
-
tags/2.0.2/public/partials/gift-pack-html.php (added)
-
tags/2.0.2/uninstall.php (added)
-
tags/2.1.0 (added)
-
tags/2.1.0/LICENSE.txt (added)
-
tags/2.1.0/README.txt (added)
-
tags/2.1.0/admin (added)
-
tags/2.1.0/admin/class-gift-pack-for-woocommerce-admin.php (added)
-
tags/2.1.0/admin/css (added)
-
tags/2.1.0/admin/css/gift-pack-for-woocommerce-admin.css (added)
-
tags/2.1.0/admin/index.php (added)
-
tags/2.1.0/admin/js (added)
-
tags/2.1.0/admin/js/admin.js (added)
-
tags/2.1.0/admin/js/custom.js (added)
-
tags/2.1.0/admin/js/gift-pack-for-woocommerce-admin.js (added)
-
tags/2.1.0/admin/partials (added)
-
tags/2.1.0/admin/partials/gift-pack-for-woocommerce-admin-display.php (added)
-
tags/2.1.0/gift-pack-for-woocommerce.php (added)
-
tags/2.1.0/includes (added)
-
tags/2.1.0/includes/class-gift-pack-for-woocommerce-activator.php (added)
-
tags/2.1.0/includes/class-gift-pack-for-woocommerce-deactivator.php (added)
-
tags/2.1.0/includes/class-gift-pack-for-woocommerce-i18n.php (added)
-
tags/2.1.0/includes/class-gift-pack-for-woocommerce-loader.php (added)
-
tags/2.1.0/includes/class-gift-pack-for-woocommerce.php (added)
-
tags/2.1.0/includes/index.php (added)
-
tags/2.1.0/index.php (added)
-
tags/2.1.0/languages (added)
-
tags/2.1.0/languages/gift-pack-for-woocommerce.mo (added)
-
tags/2.1.0/languages/gift-pack-for-woocommerce.po (added)
-
tags/2.1.0/public (added)
-
tags/2.1.0/public/class-gift-pack-for-woocommerce-public.php (added)
-
tags/2.1.0/public/css (added)
-
tags/2.1.0/public/css/gift-pack-for-woocommerce-public.css (added)
-
tags/2.1.0/public/images (added)
-
tags/2.1.0/public/images/blue_gift_pack.png (added)
-
tags/2.1.0/public/images/default_gift.png (added)
-
tags/2.1.0/public/images/green_gift_pack.png (added)
-
tags/2.1.0/public/images/pink_gift_pack.png (added)
-
tags/2.1.0/public/images/yellow_gift_pack.png (added)
-
tags/2.1.0/public/index.php (added)
-
tags/2.1.0/public/js (added)
-
tags/2.1.0/public/js/gift-pack-for-woocommerce-public.js (added)
-
tags/2.1.0/public/partials (added)
-
tags/2.1.0/public/partials/gift-pack-data-in-order.php (added)
-
tags/2.1.0/public/partials/gift-pack-for-woocommerce-public-display.php (added)
-
tags/2.1.0/public/partials/gift-pack-html.php (added)
-
tags/2.1.0/uninstall.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/gift-pack-for-woocommerce.php (modified) (2 diffs)
-
trunk/public/class-gift-pack-for-woocommerce-public.php (modified) (4 diffs)
-
trunk/public/js/gift-pack-for-woocommerce-public.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gift-pack-for-woocommerce/trunk/README.txt
r3278737 r3410915 4 4 Donate link: https://www.itpathsolutions.com 5 5 Requires at least: 6.0 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 7.4 8 Stable tag: 2. 0.28 Stable tag: 2.1.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 106 106 * Improvement - Removed the default character limit validation for the Gift Pack Note 107 107 108 = 2.1.0 = 109 110 *Release Date 4th December 2025* 111 112 * Improvement – Compatible with latest WordPress version 6.9 113 * Fix: Gift wrap price was not being added correctly to the cart total when a simple product was added via AJAX. The calculation logic has now been corrected. 114 * Fix - Other small fixes and updates 115 108 116 = 2.0.1 = 109 117 -
gift-pack-for-woocommerce/trunk/gift-pack-for-woocommerce.php
r3278737 r3410915 17 17 * Plugin URI: https://wordpress.org/plugins/gift-pack-for-woocommerce/ 18 18 * Description: Allow customers add gift pack/wrapping to individual products from product pages 19 * Version: 2. 0.219 * Version: 2.1.0 20 20 * Author: IT Path Solutions 21 21 * Author URI: https://www.itpathsolutions.com/ … … 37 37 * Rename this for your plugin and update it as you release new versions. 38 38 */ 39 define( 'GIFT_PACK_FOR_WOOCOMMERCE_VERSION', '2. 0.2' );39 define( 'GIFT_PACK_FOR_WOOCOMMERCE_VERSION', '2.1.0' ); 40 40 41 41 /** -
gift-pack-for-woocommerce/trunk/public/class-gift-pack-for-woocommerce-public.php
r3278737 r3410915 100 100 */ 101 101 102 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/gift-pack-for-woocommerce-public.js ', array( 'jquery' ), $this->version, false );102 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/gift-pack-for-woocommerce-public.js?v=1.1', array( 'jquery' ), $this->version, false ); 103 103 wp_localize_script($this->plugin_name, 'ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'))); 104 104 … … 265 265 // Front: Set the new calculated cart item price 266 266 public function gpfw_extra_price_add_custom_price($cart) { 267 267 268 if (is_admin() && !defined('DOING_AJAX')) 268 269 return; … … 270 271 return; 271 272 foreach($cart->get_cart() as $cart_item) { 273 // print_r($cart_item['new_price']);exit(); 272 274 if (isset($cart_item['new_price'])) 273 275 $cart_item['data']->set_price((float) $cart_item['new_price']); … … 332 334 } 333 335 else{ 334 $gpfw_gift_pack_image_text = __("Giftpack Image 3","gift-pack-for-woocommerce");336 $gpfw_gift_pack_image_text = __("Giftpack Image","gift-pack-for-woocommerce"); 335 337 } 336 338 $green_gift_pack = plugin_dir_url(__DIR__) . 'public/images/green_gift_pack.png'; -
gift-pack-for-woocommerce/trunk/public/js/gift-pack-for-woocommerce-public.js
r3278737 r3410915 1 1 jQuery(document).ready(function($) { 2 console.log('gift-pack-for-woocommerce-public.js loaded'); 3 /** 4 * Ensure the gift wrap fields always live inside the add-to-cart form. 5 * Some block themes reposition hooks outside the <form>, which prevents 6 * the inputs from posting. We relocate them proactively when needed. 7 */ 8 var gpfwEnsureCartFieldPlacement = function() { 9 var $cartForm = $('form.cart').first(); 10 if (!$cartForm.length) { 11 return; 12 } 13 $('.gpfw_gift_pack_fields').each(function() { 14 var $fieldBlock = $(this); 15 if (!$fieldBlock.closest('form.cart').length) { 16 $cartForm.prepend($fieldBlock); 17 } 18 }); 19 }; 20 21 var gpfwFieldNames = [ 22 'gift_pack_option', 23 'gift_pack_wrapper_price', 24 'active_price', 25 'gpfw_default_gift_pack_img', 26 'gpfw_giftpack_uploaded_value', 27 'gpfw-gift-pack-to', 28 'gpfw-gift-pack-from', 29 'gpfw-gift-pack-note' 30 ]; 31 32 var gpfwCollectFieldValues = function($form) { 33 var collected = {}; 34 gpfwFieldNames.forEach(function(name) { 35 var $fields = $form.find('[name="' + name + '"]'); 36 if (!$fields.length) { 37 return; 38 } 39 var value; 40 if ($fields.first().is(':radio')) { 41 var $checkedRadio = $fields.filter(':checked'); 42 if ($checkedRadio.length) { 43 value = $checkedRadio.val(); 44 } 45 } else if ($fields.first().is(':checkbox')) { 46 var $checkedBox = $fields.filter(':checked'); 47 if ($checkedBox.length) { 48 value = $checkedBox.val(); 49 } 50 } else { 51 value = $fields.first().val(); 52 } 53 if (typeof value !== 'undefined' && value !== null && value !== '') { 54 collected[name] = value; 55 } 56 }); 57 return collected; 58 }; 59 60 var gpfwCloneValuesIntoForm = function($form) { 61 if (!$form.length) { 62 return; 63 } 64 $form.find('[data-gpfw-clone="true"]').remove(); 65 var values = gpfwCollectFieldValues($form); 66 $.each(values, function(name, value) { 67 $('<input>', { 68 type: 'hidden', 69 name: name, 70 value: value, 71 'data-gpfw-clone': 'true' 72 }).appendTo($form); 73 }); 74 }; 75 76 var gpfwExtendAjaxPayload = function() { 77 $(document.body).on('adding_to_cart', function(event, button, data) { 78 var $form = button.closest('form.cart'); 79 if (!$form.length) { 80 $form = button.closest('.product, .summary').find('form.cart').first(); 81 } 82 if (!$form.length) { 83 return; 84 } 85 var values = gpfwCollectFieldValues($form); 86 $.extend(data, values); 87 }); 88 }; 89 90 gpfwEnsureCartFieldPlacement(); 91 gpfwExtendAjaxPayload(); 92 93 $(document).on('submit', 'form.cart', function() { 94 gpfwCloneValuesIntoForm($(this)); 95 }); 96 97 $(document).on('click', 'form.cart button[name="add-to-cart"], form.cart button.single_add_to_cart_button', function() { 98 gpfwCloneValuesIntoForm($(this).closest('form.cart')); 99 }); 100 2 101 if($('div.gpwf_popup_enable').length){ 3 102 var initPhotoSwipeFromDOM = function(gallerySelector) { … … 76 175 $('.gift-pack_for-woocommerce-parent').html(json_obj.html); 77 176 $('.gpfw-gift-pack-note').prop("required", true); 177 gpfwEnsureCartFieldPlacement(); 78 178 79 179 if(variable_pro){ … … 134 234 var json_obj = JSON.parse(result); 135 235 $('.gift-pack_for-woocommerce-parent').html(json_obj.html); 236 gpfwEnsureCartFieldPlacement(); 136 237 137 238 if(variable_pro){ … … 191 292 } 192 293 $('input[name="active_price"]').val(json_obj.active_price); 294 gpfwEnsureCartFieldPlacement(); 193 295 194 296 });
Note: See TracChangeset
for help on using the changeset viewer.