Showing with 136 additions and 48 deletions.
  1. +6 −0 CHANGELOG.md
  2. +1 −1 backend/settings-panel.class.php
  3. +1 −1 package.json
  4. +35 −37 readme.txt
  5. +91 −0 tests/test-option-methods.php
  6. +2 −9 woocommerce-product-addon.php
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
##### [Version 30.1.2](https://github.com/Codeinwp/woocommerce-product-addon/compare/v30.1.1...v30.1.2) (2022-08-15)

- [Fix] A PHP Notice fixed and a technical improvement has been made.
- Readme.txt updated
- Improvement on the themeisle-sdk compatibility.

##### [Version 30.1.1](https://github.com/Codeinwp/woocommerce-product-addon/compare/v30.1.0...v30.1.1) (2022-08-12)

- change plugin maintainer
2 changes: 1 addition & 1 deletion backend/settings-panel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public static function get_saved_settings( $key, $default = null ) {

$saved_settings = get_option( self::$save_key );

$value = $default != null ? $default : null;
$value = $default !== null ? $default : null;

if ( isset( $saved_settings[ $key ] ) && $saved_settings[ $key ] != '' ) {
$value = $saved_settings[ $key ];
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": "30.1.1",
"version": "30.1.2",
"description": "PPOM for WooCommerce",
"main": "index.js",
"repository": "https://github.com/Codeinwp/woocommerce-product-addon",
Expand Down
72 changes: 35 additions & 37 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ Contributors: nmedia,themeisle
Tags: woocommerce custom fields, woocommerce extra fields, woocommerce extra options, woocommerce personalized product, woocommerce product fields, woocommerce addons
Requires at least: 3.5
Tested up to: 6.0
Stable tag: 30.1
Stable tag: trunk
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Requires PHP: 5.6


== Description ==

PPOM (Personalized Product Option Manager) is a WooCommerce plugin to add extra fields on your site product page. Adding extra options like sizes, colors with PPOM is so simple with drag and drop form builder.
Expand All @@ -18,18 +17,15 @@ PPOM (Personalized Product Option Manager) is a WooCommerce plugin to add extra
* Go to product edit page and select PPOM fields group created in above step and click update.
* That's all

**[Live Front & Backend Demo](https://najeebmedia.com/ppom-demo)**
*Note: Click on the `Initialize Demo` button when the Demo is ready.*

== Input Types in Free Version ==
* **Text** - [Demo](https://ppom.nmediahosting.com/product/happy-ninja/)
* **Textarea** - [Demo](https://ppom.nmediahosting.com/product/happy-ninja/)
* **Select Options (with price)** - [Demo](https://ppom.nmediahosting.com/product/ninja-silhouette/)
* **Radio Options (with price)** - [Demo](https://ppom.nmediahosting.com/product/ninja-silhouette/)
* **Checkbox Options (with price)** - [Demo](https://ppom.nmediahosting.com/product/ninja-silhouette/)
* **Date** - [Demo](https://ppom.nmediahosting.com/product/happy-ninja/)
* **Email** - [Demo](https://ppom.nmediahosting.com/product/happy-ninja/)
* **Number** - [Demo](https://ppom.nmediahosting.com/product/happy-ninja/)
* **Text** - [Demo](https://demo-ppom-lite.s.themeisle.com/product/general-fields/)
* **Textarea** - [Demo](https://demo-ppom-lite.s.themeisle.com/product/general-fields/)
* **Select Options (with price)** - [Demo](https://demo-ppom-lite.s.themeisle.com/product/general-fields/)
* **Radio Options (with price)** - [Demo](https://demo-ppom-lite.s.themeisle.com/product/general-fields/)
* **Checkbox Options (with price)** - [Demo](https://demo-ppom-lite.s.themeisle.com/product/general-fields/)
* **Date** - [Demo](https://demo-ppom-lite.s.themeisle.com/product/general-fields/)
* **Email** - [Demo](https://demo-ppom-lite.s.themeisle.com/product/general-fields/)
* **Number** - [Demo](https://demo-ppom-lite.s.themeisle.com/product/general-fields/)
* **Hidden** - *Hidden input with a default value*

== Features in Free Version ==
Expand All @@ -51,25 +47,24 @@ PPOM (Personalized Product Option Manager) is a WooCommerce plugin to add extra
== Security is Priority ==
**All inputs are [sanitized and escaped](https://developer.wordpress.org/themes/theme-security/data-sanitization-escaping/, "WordPress sanitized")**


== PPOM PRO Inputs ==
* **[Measure Input](https://ppom.nmediahosting.com/product/ppom-measure-input/)** - *Set prices for measure units like milk, cloths & frames, etc*
* **[Color Picker](https://ppom.nmediahosting.com/product/woo-album-1/)** - *Allow customer to select any colors and save Hex value*
* **[Color Palette](https://ppom.nmediahosting.com/product/woo-album-1/)** - *Allow customer to select color(s) from a pre defined set of colors by admin*
* **[Date Range](http://ppom.nmediahosting.com/product/flying-ninja/)** - *Select two dates between from and to*
* **[Images Options](https://ppom.nmediahosting.com/product/woo-logo-2/)** - *Allow customer to select image(s) from a pre defined images by admin*
* **[Audio/Video](https://ppom.nmediahosting.com/product/woo-single-1/)** - *Allow customer to select audio/video from a pre defined audios/videos by admin*
* **[File Upload](https://ppom.nmediahosting.com/product/happy-ninja-2/)** - *Allow customers to upload files. Admin can set filetypes, and filesize. Progressbar, thumb display, and responsive uploader*
* **[Image Cropper](https://ppom.nmediahosting.com/product/woo-album-4/)** - *Allow users to upload and crop images*
* **[Variation Quantities](https://ppom.nmediahosting.com/product/woo-logo/)** - *Allow customers to order different quantities for different options like Sizes or colors*
* **[Price Matrix with Discount](https://ppom.nmediahosting.com/product/woo-album-3/)** - *Set tiered or discount prices on bulk purchase*
* **[Timezone](https://ppom.nmediahosting.com/product-category/ppom-timezone-input/)** - *Select timezone from pre defined list of timezone. Exclude/include timezones*
* **[HTML Content](https://ppom.nmediahosting.com/product-category/ppom-html/)** - *Add HTML tags, like `p` or `h1` tags to add more details for your extra fields*
* **[Measure Input](https://demo-ppom-lite.s.themeisle.com/product/demo-for-measure-input/)** - *Set prices for measure units like milk, cloths & frames, etc*
* **[Color Picker](https://demo-ppom-lite.s.themeisle.com/product/demo-for-color-picker/)** - *Allow customer to select any colors and save Hex value*
* **[Color Palette](https://demo-ppom-lite.s.themeisle.com/product/demo-for-color-palette/)** - *Allow customer to select color(s) from a pre defined set of colors by admin*
* **[Date Range](https://demo-ppom-lite.s.themeisle.com/product/demo-for-date-range-input/)** - *Select two dates between from and to*
* **[Images Options](https://demo-ppom-lite.s.themeisle.com/product/demo-for-images-options/)** - *Allow customer to select image(s) from a pre defined images by admin*
* **[Audio/Video](https://demo-ppom-lite.s.themeisle.com/product/demo-for-video-music/)** - *Allow customer to select audio/video from a pre defined audios/videos by admin*
* **[File Upload](https://demo-ppom-lite.s.themeisle.com/product/demo-for-file-upload-input/)** - *Allow customers to upload files. Admin can set filetypes, and filesize. Progressbar, thumb display, and responsive uploader*
* **[Image Cropper](https://demo-ppom-lite.s.themeisle.com/product/demo-for-basic-image-cropping-input/)** - *Allow users to upload and crop images*
* **[Variation Quantities](https://demo-ppom-lite.s.themeisle.com/product/demo-for-variation-quantities/)** - *Allow customers to order different quantities for different options like Sizes or colors*
* **[Price Matrix with Discount](https://demo-ppom-lite.s.themeisle.com/product/demo-for-price-matrix-discount/)** - *Set tiered or discount prices on bulk purchase*
* **[Timezone](https://demo-ppom-lite.s.themeisle.com/product-category/timezone-input/)** - *Select timezone from pre defined list of timezone. Exclude/include timezones*
* **[HTML Content](https://demo-ppom-lite.s.themeisle.com/product/demo-for-basic-html-with-content/)** - *Add HTML tags, like `p` or `h1` tags to add more details for your extra fields*

[See All Inputs Guide](https://najeebmedia.com/2018/01/02/woocommerce-personalized-product-options-manager-inputs-guide/)

== PPOM PRO Features ==
* **[Tooltip](https://vimeo.com/285060863)** - *Tooltip feature to show description*
* **Tooltip - *Tooltip feature to show description*
* **Fields privacy** - *Set fields visibility options by roles, member id guest etc*
* **Weight options** - [Weight can be assgined for options](https://najeebmedia.com/2018/11/20/ppom-options-now-have-weight/)
* **Multiple Meta** - [Assign multiple metas groups to single product](https://najeebmedia.com/2018/10/25/ppom-version-15-0-multiple-meta/)
Expand All @@ -81,19 +76,13 @@ PPOM (Personalized Product Option Manager) is a WooCommerce plugin to add extra
* **Compatible with all WooCommerce themes.**


[See All PRO Features](https://najeebmedia.com/wordpress-plugin/woocommerce-personalized-product-option/) - [All Fields Options](https://najeebmedia.com/2018/01/02/woocommerce-personalized-product-options-manager-inputs-guide/) - [Demos](http://ppom.nmediahosting.com/)
[See All PRO Features](https://themeisle.com/plugins/ppom-pro/?utm_source=themeisle&utm_medium=product&utm_campaign) - [All Fields Options](https://najeebmedia.com/2018/01/02/woocommerce-personalized-product-options-manager-inputs-guide/) - [Demos](https://demo-ppom-lite.s.themeisle.com/)

== Video Guide ==
[vimeo https://vimeo.com/85584591]

== PPOM Add-ons ==
If you feels that PPOM Free or PPOM PRO versions are not enough for your needs, please see our [30+ PPOM Add-ons](https://najeebmedia.com/ppom-addons) and coming more.


= Our recent unique plugins are =
* [WooCommerce GoogleSync](https://najeebmedia.com/googlesync) - manage products with Google Sheet
* [WooConvo](https://najeebmedia.com/wooconvo) - send messages and files after checkout to customers
* [See all plugins here](https://profiles.wordpress.org/nmedia/#content-plugins)
If you feels that PPOM Free or PPOM PRO versions are not enough for your needs, please see our [30+ PPOM Add-ons](https://themeisle.com/plugins/ppom-pro/) and coming more.

== Installation ==
1. Upload plugin directory to the `/wp-content/plugins/` directory
Expand All @@ -102,7 +91,7 @@ If you feels that PPOM Free or PPOM PRO versions are not enough for your needs,

== Screenshots ==
1. Plugin options (input fields)
2. Selecting meta with product
2. Selecting meta with product
3. Showing inputs on front end product
4. Inputs attached to cart item
5. Inputs attached to checkout page
Expand All @@ -113,6 +102,15 @@ If you feels that PPOM Free or PPOM PRO versions are not enough for your needs,

== Changelog ==

##### [Version 30.1.2](https://github.com/Codeinwp/woocommerce-product-addon/compare/v30.1.1...v30.1.2) (2022-08-15)

- [Fix] A PHP Notice fixed and a technical improvement has been made.
- Readme.txt updated
- Improvement on the themeisle-sdk compatibility.




##### [Version 30.1.1](https://github.com/Codeinwp/woocommerce-product-addon/compare/v30.1.0...v30.1.1) (2022-08-12)

- change plugin maintainer
Expand Down Expand Up @@ -407,7 +405,7 @@ If you feels that PPOM Free or PPOM PRO versions are not enough for your needs,
* Feature: Unique option id for DOM via filter ppom_dom_option_id
* Feature: [Color palettes now has Label option](https://clients.najeebmedia.com/forums/topic/color-pallette-labels-dont-show-hex-value)
= 18.0 June 23, 2019 [More Details](https://najeebmedia.com/blog/ppom-version-18-0-better-price-manipulation-currency-switcher/) =
* Tweaks: [Extra colon removed in cart for Variation Quantities](https://clients.najeebmedia.com/forums/topic/colon-and-additional-data-appearing-on-my-cart/)
* Tweaks: [Extra colon removed in cart for Variation Quantities](https://clients.najeebmedia.com/forums/topic/colon-and-additional-data-appearing-on-my-cart/)
* Tweaks: Datepicker future dates default value setting udpated
* Bug fixed: [Datepicker past_dates issue fixed](https://wordpress.org/support/topic/ppom-has-stopped-working/#post-11695214)
* Bug fixed: [Double quote (inches symbol) issue fixed for Variation Quantities](https://wordpress.org/support/topic/code-in-view-cart-page-for-inches-symbol/)
Expand Down
91 changes: 91 additions & 0 deletions tests/test-option-methods.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php
/**
* Class Test_Option_Methods
*
* @package ppom-pro
*/

class Test_Option_Methods extends WP_UnitTestCase {
/**
* Make sure default arg of ppom_get_option function works well.
*
* @return void
*/
public function testPPOMGetOptionDefaultValue() {
// default 'default' arg value is false.
$this->assertFalse( ppom_get_option('non-exist-option-key' ) );

$this->assertEmpty( ppom_get_option('non-exist-option-key', '' ) );
$this->assertEquals( array(), ppom_get_option('non-exist-option-key', array() ) );
$this->assertNull( ppom_get_option('non-exist-option-key', null ) );
$this->assertFalse( ppom_get_option('non-exist-option-key', false ) );
}

/**
* Make sure return value of arg of ppom_get_option function works well.
*
* @return void
*/
public function testPPOMGetOptionValue() {
update_option('sample-option', ['a'=>1, 'b'=>2]);

$this->assertEquals( ['a'=>1, 'b'=>2], ppom_get_option('sample-option' ) );
$this->assertEquals( ['a'=>1, 'b'=>2], ppom_get_option('sample-option', false ) );
}

/**
* Make sure default arg of PPOM_SettingsFramework::get_saved_settings function works well.
*
* @return void
*/
public function testGetSavedSettingsDefaultValue() {
// default 'default' arg value is false.
$this->assertNull( PPOM_SettingsFramework::get_saved_settings('non-exist-option-key' ) );

$this->assertEmpty( PPOM_SettingsFramework::get_saved_settings('non-exist-option-key', '' ) );
$this->assertEquals( array(), PPOM_SettingsFramework::get_saved_settings('non-exist-option-key', array() ) );
$this->assertNull( PPOM_SettingsFramework::get_saved_settings('non-exist-option-key', null ) );
$this->assertFalse( PPOM_SettingsFramework::get_saved_settings('non-exist-option-key', false ) );
}

/**
* Make sure return value of PPOM_SettingsFramework::get_saved_settings function works well.
*
* @return void
*/
public function testGetSavedSettings() {
$reflector_settings_framework = new ReflectionClass( 'PPOM_SettingsFramework' );
$save_key_prop = $reflector_settings_framework->getProperty('save_key');
$save_key_prop->setAccessible(true);
$save_key_prop->setValue('sample-option-group-984319821');

update_option( 'sample-option-group-984319821', [
'sample-option-key-20'=>4984
] );

$this->assertEquals( 4984, PPOM_SettingsFramework::get_saved_settings('sample-option-key-20' ) );
$this->assertEquals( 4984, PPOM_SettingsFramework::get_saved_settings('sample-option-key-20', false ) );
$this->assertFalse( PPOM_SettingsFramework::get_saved_settings('sample-option-key-non-exists', false ) );

// check default bevavior of the 'default argument' of the PPOM_SettingsFramework::get_saved_settings method.
$this->assertNull( PPOM_SettingsFramework::get_saved_settings('sample-option-key-non-exists' ) );
}

/**
* Make sure return value of PPOM_SettingsFramework::get_saved_settings function works well.
*
* @return void
*/
public function testGetSavedSettingsNotExistsGroup() {
$reflector_settings_framework = new ReflectionClass( 'PPOM_SettingsFramework' );
$save_key_prop = $reflector_settings_framework->getProperty('save_key');
$save_key_prop->setAccessible(true);
$save_key_prop->setValue('sample-option-group');

$this->assertFalse( PPOM_SettingsFramework::get_saved_settings('sample-option-key-100-non-exists', false ) );

// check default bevavior of the 'default argument' of the PPOM_SettingsFramework::get_saved_settings method.
$this->assertNull( PPOM_SettingsFramework::get_saved_settings('sample-option-key-100-non-exists' ) );
$this->assertNull( PPOM_SettingsFramework::get_saved_settings('sample-option-key-200-non-exists' ) );
}
}
11 changes: 2 additions & 9 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: http://themeisle.com
* Description: PPOM (Personalized Product Meta Manager) plugin allow WooCommerce Store Admin to create unlimited input fields and files to attach with Product Page
* Version: 30.1.1
* Version: 30.1.2
* Author: Themeisle
* Text Domain: ppom
* Domain Path: /languages
Expand All @@ -24,7 +24,7 @@
define( 'PPOM_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'PPOM_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'PPOM_WP_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __DIR__ ) ) );
define( 'PPOM_VERSION', '30.1.1' );
define( 'PPOM_VERSION', '30.1.2' );
define( 'PPOM_DB_VERSION', '30.1.0' );
define( "PPOM_PRODUCT_META_KEY", '_product_meta_id' );
define( 'PPOM_TABLE_META', 'nm_personalized' );
Expand All @@ -41,13 +41,6 @@ function ( $products ) {
}
);

add_filter(
'themesle_sdk_namespace_' . md5( __FILE__ ),
function () {
return 'sparks';
}
);

/*
* plugin localization being initiated here
*/
Expand Down