Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix catchable fatal error when categories are deleted #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions includes/class-wcqu-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,26 @@ public function manage_quantity_rule_columns($column_name, $id) {
case 'step':
echo get_post_meta( $id, '_step', true );
break;

case 'cats':
$cats = get_post_meta( $id, '_cats', false);
if ( $cats != false and count( $cats[0] ) > 0 ) {
foreach ( $cats[0] as $cat ){

$taxonomy = 'product_cat';
$term = get_term_by( 'id', $cat, $taxonomy );
$link = get_term_link( $term );

echo "<a href='" . $link . "'>" . $term->name . "</a><br />";
}
}
break;


case 'cats':
$cats = get_post_meta( $id, '_cats', false);
if ( $cats != false and count( $cats[0] ) > 0 ) {
foreach ( $cats[0] as $cat ) {

$taxonomy = 'product_cat';
$term = get_term_by( 'id', $cat, $taxonomy );
$link = get_term_link( $term );

if ( !$term || is_wp_error( $link ) ) {
echo "Unknown / Deleted Category<br />";
continue;
}

echo "<a href='" . $link . "'>" . $term->name . "</a><br />";
}
}
break;

case 'product_tags':
$tags = get_post_meta( $id, '_tags', false);
if ( $tags != null and count( $tags[0] ) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion quantites-and-units.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Quantities and Units for WooCommerce
Plugin URI: https://wordpress.org/plugins/quantities-and-units-for-woocommerce/
Description: Easily require your customers to buy a minimum / maximum / incremental amount of products to continue with their checkout.
Version: 1.0.13
Version: 1.0.14
Author: Nicholas Verwymeren
Author URI: https://www.nickv.codes
*/
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ Manual Installation
6. Set Rules for categories by clicking the new ‘Quantity Rules’ sidebar option or assign per-product rules by using the new metabox on your product page.

== Changelog ==
= 1.0.14 =
* Fixed an issue related to a category being deleted

= 1.0.13 =
* Fixed input issue introduced in 10.0.12 release

Expand Down