Version Description
- April 6th, 2017 =
- Checking for the existence of the
get_id()method before using it.
Download this release
Release Info
| Developer | yikesitskevin |
| Plugin | |
| Version | 1.5.11 |
| Comparing to | |
| See all releases | |
Code changes from version 1.5.10 to 1.5.11
readme.txt
CHANGED
|
@@ -4,9 +4,9 @@ Donate link: http://yikesinc.com
|
|
| 4 |
Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
|
| 5 |
Requires at least: 3.8
|
| 6 |
Tested up to: 4.7.3
|
| 7 |
-
Requires WooCommerce at least:
|
| 8 |
Tested WooCommerce up to: 3.0.0
|
| 9 |
-
Stable tag: 1.5.
|
| 10 |
License: GPLv2 or later
|
| 11 |
|
| 12 |
Add custom tabs with content to products in WooCommerce.
|
|
@@ -74,6 +74,9 @@ Yes! Since v1.4 we've added the necessary code to ensure the custom tab data is
|
|
| 74 |
|
| 75 |
== Changelog ==
|
| 76 |
|
|
|
|
|
|
|
|
|
|
| 77 |
= 1.5.10 - April 5th, 2017 =
|
| 78 |
* Duplicating a product now duplicates custom product tabs and saved tabs correctly
|
| 79 |
|
| 4 |
Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
|
| 5 |
Requires at least: 3.8
|
| 6 |
Tested up to: 4.7.3
|
| 7 |
+
Requires WooCommerce at least: 3.0.0
|
| 8 |
Tested WooCommerce up to: 3.0.0
|
| 9 |
+
Stable tag: 1.5.11
|
| 10 |
License: GPLv2 or later
|
| 11 |
|
| 12 |
Add custom tabs with content to products in WooCommerce.
|
| 74 |
|
| 75 |
== Changelog ==
|
| 76 |
|
| 77 |
+
= 1.5.11 - April 6th, 2017 =
|
| 78 |
+
* Checking for the existence of the `get_id()` method before using it.
|
| 79 |
+
|
| 80 |
= 1.5.10 - April 5th, 2017 =
|
| 81 |
* Duplicating a product now duplicates custom product tabs and saved tabs correctly
|
| 82 |
|
yikes-inc-easy-custom-woocommerce-product-tabs.php
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
* Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
|
| 6 |
* Author: YIKES, Inc
|
| 7 |
* Author URI: http://www.yikesinc.com
|
| 8 |
-
* Version: 1.5.
|
| 9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
| 10 |
* Domain Path: languages/
|
| 11 |
*
|
|
@@ -62,7 +62,7 @@
|
|
| 62 |
private $tab_data = false;
|
| 63 |
|
| 64 |
/** plugin version number */
|
| 65 |
-
const VERSION = '1.5.
|
| 66 |
|
| 67 |
/** plugin text domain */
|
| 68 |
const TEXT_DOMAIN = 'yikes-inc-easy-custom-woocommerce-product-tabs';
|
|
@@ -275,7 +275,9 @@
|
|
| 275 |
public function add_custom_product_tabs( $tabs ) {
|
| 276 |
global $product;
|
| 277 |
|
| 278 |
-
$
|
|
|
|
|
|
|
| 279 |
|
| 280 |
if ( !empty( $product_tabs ) ) {
|
| 281 |
$this->tab_data = $product_tabs;
|
|
@@ -564,7 +566,9 @@
|
|
| 564 |
*/
|
| 565 |
private function product_has_custom_tabs( $product ) {
|
| 566 |
if ( false === $this->tab_data ) {
|
| 567 |
-
$
|
|
|
|
|
|
|
| 568 |
}
|
| 569 |
// tab must at least have a title to exist
|
| 570 |
return ! empty( $this->tab_data ) && ! empty( $this->tab_data[0] ) && ! empty( $this->tab_data[0]['title'] );
|
|
@@ -1222,10 +1226,13 @@
|
|
| 1222 |
* @param object | $original_product | The original product
|
| 1223 |
*/
|
| 1224 |
public function yikes_woo_dupe_custom_product_tabs( $duplicate_product, $original_product ) {
|
| 1225 |
-
$
|
|
|
|
|
|
|
|
|
|
| 1226 |
|
| 1227 |
if ( ! empty( $current_products_tabs ) ) {
|
| 1228 |
-
update_post_meta( $
|
| 1229 |
}
|
| 1230 |
}
|
| 1231 |
|
|
@@ -1241,21 +1248,24 @@
|
|
| 1241 |
$saved_tabs_array = get_option( 'yikes_woo_reusable_products_tabs_applied' );
|
| 1242 |
|
| 1243 |
// Grab the old post's ID
|
| 1244 |
-
$old_post_id = $original_product->get_id();
|
| 1245 |
|
| 1246 |
// (1) Make sure we have a non-empty array of saved tabs,
|
| 1247 |
// (2) Makre sure we have the ID of the old post, and then
|
| 1248 |
// (3) Check for the old post's saved tabs. (If we don't find any, do nothing)
|
| 1249 |
if ( ! empty( $saved_tabs_array ) && is_array( $saved_tabs_array ) && ! empty( $old_post_id ) && isset( $saved_tabs_array[$old_post_id] ) ) {
|
| 1250 |
|
|
|
|
|
|
|
|
|
|
| 1251 |
// Loop through the $saved_tabs_array and update the post_id item
|
| 1252 |
$new_products_saved_tabs = $saved_tabs_array[$old_post_id];
|
| 1253 |
foreach ( $new_products_saved_tabs as $saved_tab_id => $saved_tab ) {
|
| 1254 |
-
$new_products_saved_tabs[$saved_tab_id]['post_id'] = $
|
| 1255 |
}
|
| 1256 |
|
| 1257 |
// Add the old post's saved tabs, with the new post's ID as the key
|
| 1258 |
-
$saved_tabs_array[$
|
| 1259 |
|
| 1260 |
// Update the saved tab's option
|
| 1261 |
update_option( 'yikes_woo_reusable_products_tabs_applied', $saved_tabs_array );
|
| 5 |
* Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
|
| 6 |
* Author: YIKES, Inc
|
| 7 |
* Author URI: http://www.yikesinc.com
|
| 8 |
+
* Version: 1.5.11
|
| 9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
| 10 |
* Domain Path: languages/
|
| 11 |
*
|
| 62 |
private $tab_data = false;
|
| 63 |
|
| 64 |
/** plugin version number */
|
| 65 |
+
const VERSION = '1.5.11';
|
| 66 |
|
| 67 |
/** plugin text domain */
|
| 68 |
const TEXT_DOMAIN = 'yikes-inc-easy-custom-woocommerce-product-tabs';
|
| 275 |
public function add_custom_product_tabs( $tabs ) {
|
| 276 |
global $product;
|
| 277 |
|
| 278 |
+
$product_id = method_exists( $product, 'get_id' ) === true ? $product->get_id() : $product->ID;
|
| 279 |
+
|
| 280 |
+
$product_tabs = get_post_meta( $product_id, 'yikes_woo_products_tabs' , true );
|
| 281 |
|
| 282 |
if ( !empty( $product_tabs ) ) {
|
| 283 |
$this->tab_data = $product_tabs;
|
| 566 |
*/
|
| 567 |
private function product_has_custom_tabs( $product ) {
|
| 568 |
if ( false === $this->tab_data ) {
|
| 569 |
+
$product_id = method_exists( $product, 'get_id' ) === true ? $product->get_id() : $product->ID;
|
| 570 |
+
|
| 571 |
+
$this->tab_data = maybe_unserialize( get_post_meta( $product_id, 'yikes_woo_products_tabs', true ) );
|
| 572 |
}
|
| 573 |
// tab must at least have a title to exist
|
| 574 |
return ! empty( $this->tab_data ) && ! empty( $this->tab_data[0] ) && ! empty( $this->tab_data[0]['title'] );
|
| 1226 |
* @param object | $original_product | The original product
|
| 1227 |
*/
|
| 1228 |
public function yikes_woo_dupe_custom_product_tabs( $duplicate_product, $original_product ) {
|
| 1229 |
+
$old_post_id = method_exists( $original_product, 'get_id' ) === true ? $original_product->get_id() : $original_product->ID;
|
| 1230 |
+
$new_post_id = method_exists( $duplicate_product, 'get_id' ) === true ? $duplicate_product->get_id() : $duplicate_product->ID;
|
| 1231 |
+
|
| 1232 |
+
$current_products_tabs = get_post_meta( $old_post_id, 'yikes_woo_products_tabs', true );
|
| 1233 |
|
| 1234 |
if ( ! empty( $current_products_tabs ) ) {
|
| 1235 |
+
update_post_meta( $new_post_id, 'yikes_woo_products_tabs', $current_products_tabs );
|
| 1236 |
}
|
| 1237 |
}
|
| 1238 |
|
| 1248 |
$saved_tabs_array = get_option( 'yikes_woo_reusable_products_tabs_applied' );
|
| 1249 |
|
| 1250 |
// Grab the old post's ID
|
| 1251 |
+
$old_post_id = method_exists( $original_product, 'get_id' ) === true ? $original_product->get_id() : $original_product->ID;
|
| 1252 |
|
| 1253 |
// (1) Make sure we have a non-empty array of saved tabs,
|
| 1254 |
// (2) Makre sure we have the ID of the old post, and then
|
| 1255 |
// (3) Check for the old post's saved tabs. (If we don't find any, do nothing)
|
| 1256 |
if ( ! empty( $saved_tabs_array ) && is_array( $saved_tabs_array ) && ! empty( $old_post_id ) && isset( $saved_tabs_array[$old_post_id] ) ) {
|
| 1257 |
|
| 1258 |
+
// Grab the new post's ID
|
| 1259 |
+
$new_post_id = method_exists( $duplicate_product, 'get_id' ) === true ? $duplicate_product->get_id() : $duplicate_product->ID;
|
| 1260 |
+
|
| 1261 |
// Loop through the $saved_tabs_array and update the post_id item
|
| 1262 |
$new_products_saved_tabs = $saved_tabs_array[$old_post_id];
|
| 1263 |
foreach ( $new_products_saved_tabs as $saved_tab_id => $saved_tab ) {
|
| 1264 |
+
$new_products_saved_tabs[$saved_tab_id]['post_id'] = $new_post_id;
|
| 1265 |
}
|
| 1266 |
|
| 1267 |
// Add the old post's saved tabs, with the new post's ID as the key
|
| 1268 |
+
$saved_tabs_array[$new_post_id] = $new_products_saved_tabs;
|
| 1269 |
|
| 1270 |
// Update the saved tab's option
|
| 1271 |
update_option( 'yikes_woo_reusable_products_tabs_applied', $saved_tabs_array );
|
