Showing with 34 additions and 12 deletions.
  1. +4 −0 CHANGELOG.md
  2. +10 −6 classes/form.class.php
  3. +1 −1 package.json
  4. +9 −2 readme.txt
  5. +8 −1 templates/render-fields.php
  6. +2 −2 woocommerce-product-addon.php
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
##### [Version 32.0.26](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.25...v32.0.26) (2024-07-29)

- Fixed issue with default settings on collapse field and when using multiple collapse fields

##### [Version 32.0.25](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.24...v32.0.25) (2024-07-10)

- Fixed an issue with the collapse field and compatibility with the Avada builder
Expand Down
16 changes: 10 additions & 6 deletions classes/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ function( $field ) use ( $meta_id ) {
return (int) $meta_id === (int) $field['ppom_id'];
}
);
$collapse_fields = array_filter(
$fields,
function( $collapse_field ) {
return isset( $collapse_field['type'] ) && 'collapse' === $collapse_field['type'];
}
);

foreach ( $fields as $meta ) {

$type = isset( $meta['type'] ) ? $meta['type'] : '';
Expand Down Expand Up @@ -143,7 +150,6 @@ function( $field ) use ( $meta_id ) {

$field_wrapper_class = $this->field_main_wrapper_classes( $meta );


// Collapse Fields Section
if ( $type == 'collapse' ) {
$collapse_type = isset( $meta['collapse_type'] ) ? $meta['collapse_type'] : '';
Expand All @@ -162,12 +168,12 @@ function( $field ) use ( $meta_id ) {
}

if ( $collapse_type == 'end' ) {
echo '<div class="ppom-collapsed-child-end"></div>';
echo '<div class="ppom-collapsed-child-end">';
}

if ( $collapse_type != 'end' ) {
echo '<h4 data-collapse-id="' . esc_attr( $data_name ) . '" class="ppom-collapsed-title">' . $title . '</h4>';
echo '<div class="collapsed-child"></div>';
echo '<div class="collapsed-child">';
}

$section_started = true;
Expand All @@ -194,7 +200,6 @@ function( $field ) use ( $meta_id ) {
*/
ob_start();


$all_inputs = ppom_array_all_inputs();
$core_inputs = $all_inputs['core'];

Expand All @@ -205,12 +210,11 @@ function( $field ) use ( $meta_id ) {
do_action( 'ppom_rendering_inputs', $meta, $data_name, $fm->input_classes_array(), $fm->field_label(), $fm->options() );
do_action( "ppom_rendering_inputs_{$type}", $meta, $default_value );


$field_html .= ob_get_clean();

$field_html .= '</div>';

if ( count( self::$ppom->fields ) == $ppom_field_counter && $section_started ) {
if ( count( $collapse_fields ) === $ppom_collapse_counter && $section_started ) {
$field_html .= '</div>';
}

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": "32.0.25",
"version": "32.0.26",
"description": "PPOM for WooCommerce",
"main": "index.js",
"repository": "https://github.com/Codeinwp/woocommerce-product-addon",
Expand Down
11 changes: 9 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: themeisle
Tags: woocommerce product addons, woocommerce product options, woocommerce product fields, woocommerce product, woocommerce product addon
Requires at least: 3.5
Tested up to: 6.5
Stable tag: 32.0.25
Tested up to: 6.6
Stable tag: 32.0.26
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Requires PHP: 7.2
Expand Down Expand Up @@ -122,6 +122,13 @@ If you feels that PPOM Free or PPOM PRO versions are not enough for your needs,

== Changelog ==

##### [Version 32.0.26](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.25...v32.0.26) (2024-07-29)

- Fixed issue with default settings on collapse field and when using multiple collapse fields




##### [Version 32.0.25](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.24...v32.0.25) (2024-07-10)

- Fixed an issue with the collapse field and compatibility with the Avada builder
Expand Down
9 changes: 8 additions & 1 deletion templates/render-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
$ppom_collapse_counter = 0;
$allow_nextprev = ppom_get_option( 'ppom-collapse-nextprev' );

$collapse_fields = array_filter(
$ppom_fields_meta,
function( $collapse_field ) {
return isset( $collapse_field['type'] ) && 'collapse' === $collapse_field['type'];
}
);

foreach ( $ppom_fields_meta as $meta ) {

$type = ( isset( $meta['type'] ) ? $meta ['type'] : '' );
Expand Down Expand Up @@ -734,7 +741,7 @@

echo '</div>'; // col-lg-*

if ( count( $ppom_fields_meta ) == $ppom_field_counter && $section_started ) {
if ( count( $collapse_fields ) === $ppom_collapse_counter && $section_started ) {
echo '</div>';
}
}
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: 32.0.25
* Version: 32.0.26
* Author: Themeisle
* Text Domain: woocommerce-product-addon
* Domain Path: /languages
Expand All @@ -26,7 +26,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', '32.0.25' );
define( 'PPOM_VERSION', '32.0.26' );
define( 'PPOM_DB_VERSION', '30.1.0' );
define( 'PPOM_PRODUCT_META_KEY', '_product_meta_id' );
define( 'PPOM_TABLE_META', 'nm_personalized' );
Expand Down