Showing with 37 additions and 19 deletions.
  1. +2 −1 .distignore
  2. +6 −0 CHANGELOG.md
  3. +2 −1 classes/frontend-scripts.class.php
  4. +2 −5 inc/admin.php
  5. +8 −2 js/admin/ppom-admin.js
  6. +4 −6 js/ppom-conditions-v2.js
  7. +1 −1 package.json
  8. +10 −1 readme.txt
  9. +2 −2 woocommerce-product-addon.php
3 changes: 2 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ composer.lock
.idea
**/*.css.map
.DS_Store
.gitkeep
.gitkeep
.wordpress-org
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
##### [Version 33.0.5](https://github.com/Codeinwp/woocommerce-product-addon/compare/v33.0.4...v33.0.5) (2024-10-08)

- Fixed an issue where fields in a meta group could not be reordered, and changes to the field order were not saved.
- Fixed an issue where the category assigned to a PPOM meta field in the 'Product Meta Basic Settings' page was not being saved in certain conditions.
- Fixed an issue where hidden input fields were incorrectly included in the price calculation at checkout, leading to an incorrect total when switching between price sets.

##### [Version 33.0.4](https://github.com/Codeinwp/woocommerce-product-addon/compare/v33.0.3...v33.0.4) (2024-10-07)

- Fixed an issue where the max checked option was not enforcing the selection limit, allowing users to select more options than specified.
Expand Down
3 changes: 2 additions & 1 deletion classes/frontend-scripts.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ public static function load_scripts_by_product_id( $product_id, $ppom_id = null,
array(
'jquery',
'ppom-inputs',
)
),
PPOM_VERSION
);

self::set_localize_data( $ppom_conditions_script, 'ppom_input_vars', $product, $input_js_vars, $global_js_vars );
Expand Down
7 changes: 2 additions & 5 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ function ppom_admin_save_form_meta() {
}

$_REQUEST['ppom'] = is_array( $_REQUEST['ppom'] ) ? $_REQUEST['ppom'] : json_decode( wp_unslash( $_REQUEST['ppom'] ), true );

global $wpdb;

extract( $_REQUEST );
Expand Down Expand Up @@ -312,8 +313,6 @@ function( $pm ) {
$aviary_api_key = isset( $_REQUEST['aviary_api_key'] ) ? sanitize_text_field( $_REQUEST['aviary_api_key'] ) : '';
$productmeta_style = isset( $_REQUEST['productmeta_style'] ) ? sanitize_text_field( $_REQUEST['productmeta_style'] ) : '';
$productmeta_js = isset( $_REQUEST['productmeta_js'] ) ? sanitize_text_field( $_REQUEST['productmeta_js'] ) : '';
$productmeta_categories = isset( $_REQUEST['productmeta_categories'] ) ? sanitize_textarea_field( $_REQUEST['productmeta_categories'] ) : '';


if ( strlen( $productmeta_name ) > 50 ) {
$resp = array(
Expand All @@ -330,7 +329,6 @@ function( $pm ) {
'send_file_attachment' => $send_file_attachment,
'show_cart_thumb' => $show_cart_thumb,
'aviary_api_key' => trim( $aviary_api_key ),
'productmeta_categories' => $productmeta_categories,
'the_meta' => $product_meta,
'productmeta_created' => current_time( 'mysql' ),
);
Expand Down Expand Up @@ -453,6 +451,7 @@ function ppom_admin_update_form_meta() {
wp_send_json( $resp );
}
$_REQUEST['ppom'] = is_array( $_REQUEST['ppom'] ) ? $_REQUEST['ppom'] : json_decode( wp_unslash( $_REQUEST['ppom'] ), true );

global $wpdb;

$ppom_meta = isset( $_REQUEST['ppom_meta'] ) ? $_REQUEST['ppom_meta'] : $_REQUEST['ppom'];
Expand All @@ -474,7 +473,6 @@ function( $pm ) {
$aviary_api_key = isset( $_REQUEST['aviary_api_key'] ) ? sanitize_text_field( $_REQUEST['aviary_api_key'] ) : '';
$productmeta_style = isset( $_REQUEST['productmeta_style'] ) ? sanitize_text_field( $_REQUEST['productmeta_style'] ) : '';
$productmeta_js = isset( $_REQUEST['productmeta_js'] ) ? sanitize_text_field( $_REQUEST['productmeta_js'] ) : '';
$productmeta_categories = isset( $_REQUEST['productmeta_categories'] ) ? sanitize_textarea_field( $_REQUEST['productmeta_categories'] ) : '';

if ( strlen( $productmeta_name ) > 50 ) {
$resp = array(
Expand All @@ -491,7 +489,6 @@ function( $pm ) {
'send_file_attachment' => $send_file_attachment,
'show_cart_thumb' => $show_cart_thumb,
'aviary_api_key' => trim( $aviary_api_key ),
'productmeta_categories' => $productmeta_categories,
'the_meta' => $product_meta,
);
if ( ! ppom_is_legacy_user() ) {
Expand Down
10 changes: 8 additions & 2 deletions js/admin/ppom-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,14 @@ jQuery(function($) {
jQuery(".ppom-meta-save-notice").html('<img src="' + ppom_vars.loader + '">').show();

$('.ppom-unsave-data').remove();
var data = $(this).serializeJSON();
const data = $(this).serializeJSON();

const fieldsOrder = Array(...document.querySelectorAll('.ui-sortable-handle[id^="ppom_sort_id_"]'))
.map( node => node.id.replace('ppom_sort_id_', '') ); // ['2', '3']
data.ppom = fieldsOrder.map( fieldId => data.ppom[fieldId] );

data.ppom = JSON.stringify(data.ppom);

// Send the JSON data via POST request
$.ajax({
url: ajaxurl,
Expand Down Expand Up @@ -329,7 +335,7 @@ jQuery(function($) {
placeholder = '-';
}

var html = '<tr class="row_no_' + id + '" id="ppom_sort_id_' + id + '">';
var html = '<tr class="row_no_' + id + ' ui-sortable-handle" id="ppom_sort_id_' + id + '">';
html += '<td class="ppom-sortable-handle"><i class="fa fa-arrows" aria-hidden="true"></i></td>';
html += '<td class="ppom-check-one-field ppom-checkboxe-style">';
html += '<label>';
Expand Down
10 changes: 4 additions & 6 deletions js/ppom-conditions-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ jQuery(function($) {

const data_name = modifiedElement.dataset?.data_name;
ppom_check_conditions(data_name, (element_dataname, event_type) => {
const event = new CustomEvent(event_type, {
detail: {
field: element_dataname,
time: new Date()
}
$.event.trigger({
type: event_type,
field: element_dataname,
time: new Date()
});
document.dispatchEvent(event);
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woocommerce-product-addon",
"version": "33.0.4",
"version": "33.0.5",
"description": "PPOM for WooCommerce",
"main": "index.js",
"repository": "https://github.com/Codeinwp/woocommerce-product-addon",
Expand Down
11 changes: 10 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: themeisle
Tags: woocommerce product addons, woocommerce product options, woocommerce product fields, woocommerce product, product addons
Requires at least: 3.5
Tested up to: 6.6
Stable tag: 33.0.4
Stable tag: 33.0.5
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Requires PHP: 7.2
Expand Down Expand Up @@ -251,6 +251,15 @@ PPOM is an open-source project, and we welcome contributors to be part of our vi

== Changelog ==

##### [Version 33.0.5](https://github.com/Codeinwp/woocommerce-product-addon/compare/v33.0.4...v33.0.5) (2024-10-08)

- Fixed an issue where fields in a meta group could not be reordered, and changes to the field order were not saved.
- Fixed an issue where the category assigned to a PPOM meta field in the 'Product Meta Basic Settings' page was not being saved in certain conditions.
- Fixed an issue where hidden input fields were incorrectly included in the price calculation at checkout, leading to an incorrect total when switching between price sets.




##### [Version 33.0.4](https://github.com/Codeinwp/woocommerce-product-addon/compare/v33.0.3...v33.0.4) (2024-10-07)

- Fixed an issue where the max checked option was not enforcing the selection limit, allowing users to select more options than specified.
Expand Down
4 changes: 2 additions & 2 deletions woocommerce-product-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: PPOM for WooCommerce
* Plugin URI: https://themeisle.com/plugins/ppom-pro/
* Description: PPOM (Personalized Product Meta Manager) plugin allow WooCommerce Store Admin to create unlimited input fields and files to attach with Product Pages.
* Version: 33.0.4
* Version: 33.0.5
* Author: Themeisle
* Text Domain: woocommerce-product-addon
* Domain Path: /languages
Expand All @@ -27,7 +27,7 @@
define( 'PPOM_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'PPOM_WP_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __DIR__ ) ) );
define( 'PPOM_BASENAME', basename( PPOM_WP_PLUGIN_DIR ) );
define( 'PPOM_VERSION', '33.0.4' );
define( 'PPOM_VERSION', '33.0.5' );
define( 'PPOM_DB_VERSION', '32.0.0' );
define( 'PPOM_PRODUCT_META_KEY', '_product_meta_id' );
define( 'PPOM_TABLE_META', 'nm_personalized' );
Expand Down