mikon82
Forum Replies Created
-
Solution worked for me as Ldt300 stated, BUT I first got an error that said there was a duplicate post ID created, so I removed the Default Post ID 0 and Hello World Post ID 1 from the database, and then Auto-Incremented the row mentioned above…. worked perfectly!
Forum: Plugins
In reply to: Restrict Woocommerce to only allowing purchases from a sinlge parent categoryThis method works, tested and tried. Add to your functions.php. file at the end.
// Enforce single parent category items in cart at a time based on first item in cart function get_product_top_level_category ( $product_id ) { $product_terms = get_the_terms ( $product_id, 'product_cat' ); $product_category = $product_terms[0]->parent; $product_category_term = get_term ( $product_category, 'product_cat' ); $product_category_parent = $product_category_term->parent; $product_top_category = $product_category_term->term_id; while ( $product_category_parent != 0 ) { $product_category_term = get_term ( $product_category_parent, 'product_cat' ); $product_category_parent = $product_category_term->parent; $product_top_category = $product_category_term->term_id; } return $product_top_category; } add_filter ( 'woocommerce_before_cart', 'restrict_cart_to_single_category' ); function restrict_cart_to_single_category() { global $woocommerce; $cart_contents = $woocommerce->cart->get_cart( ); $cart_item_keys = array_keys ( $cart_contents ); $cart_item_count = count ( $cart_item_keys ); // Do nothing if the cart is empty // Do nothing if the cart only has one item if ( ! $cart_contents || $cart_item_count == 1 ) { return null; } // Multiple Items in cart $first_item = $cart_item_keys[0]; $first_item_id = $cart_contents[$first_item]['product_id']; $first_item_top_category = get_product_top_level_category ( $first_item_id ); $first_item_top_category_term = get_term ( $first_item_top_category, 'product_cat' ); $first_item_top_category_name = $first_item_top_category_term->name; // Now we check each subsequent items top-level parent category foreach ( $cart_item_keys as $key ) { if ( $key == $first_item ) { continue; } else { $product_id = $cart_contents[$key]['product_id']; $product_top_category = get_product_top_level_category( $product_id ); if ( $product_top_category != $first_item_top_category ) { $woocommerce->cart->set_quantity ( $key, 0, true ); $mismatched_categories = 1; } } } // we really only want to display this message once for anyone, including those that have carts already prefilled if ( isset ( $mismatched_categories ) ) { echo '<p class="woocommerce-error">Only one category allowed in cart at a time.<br />You are currently allowed only <strong>'.$first_item_top_category_name.'</strong> items in your cart.<br />To order a different category empty your cart first.</p>'; } }
Forum: Everything else WordPress
In reply to: Does 4.4 conflict with anything?You know what, you’re right, you should not be held accountable for anything, it’s everyone else’s (WordPress’) fault, I am 100% sorry. I wish you the best of luck.
Forum: Everything else WordPress
In reply to: Does 4.4 conflict with anything?You keep blaming WordPress on your problems my friend… if you have that mindset and expect others and the opensource WordPress community to solve ALL of your problems, you’re in the wrong place.
Again, like mentioned above… no reply will satisfy you, you are just trolling and looking for freebies, and a mooching troll.
Forum: Everything else WordPress
In reply to: Does 4.4 conflict with anything?Another note, www.remarpro.com is adding the reverse compatibility backonce again for 4.4.1 for those plugin authors who aren’t staying up to date which should be aware. If you want to complain about a platform…. feel free to move to Joomla @jmunce
Forum: Everything else WordPress
In reply to: Does 4.4 conflict with anything?@jan thank you. Enough said.
Forum: Everything else WordPress
In reply to: Does 4.4 conflict with anything?None of that costs money if you can do it yourself. So it is 100% free.
Forum: Everything else WordPress
In reply to: Does 4.4 conflict with anything?WordPress is 100% FREE. If you are worrying so much about constant conflicts, compatibility, then take it upon yourself to learn to code your own plugins that YOU control and can update to work with all future updates with WordPress.
For instance, our plugin, Foodpress, was affected by the 4.4. update, but we fixed the problem the next day when we found a proper issue with backwards compatibility that was removed by WordPress, but we still moved forward and found a future solution.
Out fix was as simple as changing wp_get_object_terms instead of get_terms. That was not the end of the world. Maybe your issues are related to this one.
If you have a plugin that isn’t working with 4.4 you need to speak to those plugin Authors, as someone above said, it is either crappy coding or not kept-to-date coding. (which we should have taken care of earlier, but the issue has been resolved)
Forum: Fixing WordPress
In reply to: Warning after the upgrade to WP 4.4We’ve remedied this error on OUR end as well for our plugin, so it now uses wp_get_object_terms instead of get_terms as we previously used.
Thanks @ronald.kubo for the quick file adjustment though to point us in the correct direction to find our own fix.
Cheers!
Forum: Fixing WordPress
In reply to: Getting "Warning: array_map(): Argument #2 should be in arrayThis patch does indeed work for our plugin, Foodpress, as well! thanks!
Forum: Fixing WordPress
In reply to: Warning after the upgrade to WP 4.4Also @ryan Paul the post is regarding “Upgrading” to WP 4.4 as the thread title suggests, the previous install should still have the compat.php file already loaded.
Forum: Fixing WordPress
In reply to: Warning after the upgrade to WP 4.4This post is related to the original Post Title… Warning message….
Just my two cents, we have this issue in a PLUGIN of ours, we will post a solution/fix if we can locate the issue. We are also using Default Twenty-Twelve theme and no additional addons.
Here are two errors we currently are experiencing after the update to 4.4
[10-Dec-2015 01:45:06 UTC] PHP Notice: Trying to get property of non-object in /home/myfoodpress/public_html/dev.myfoodpress.com/wp-includes/category-template.php on line 1153
[10-Dec-2015 01:45:06 UTC] PHP Warning: array_map(): Argument #2 should be an array in /home/myfoodpress/public_html/dev.myfoodpress.com/wp-includes/category-template.php on line 1158
Foodpress Author here:
OUr plugin should work with any theme, if it is built correctly and the WooCommerce files have not been manipulated in any way or adjusted. Even then, there may be minor tweaks to make to your CSS with our Plugin and Addon.
It now works with version 2.4.x of WC as well.
Forum: Networking WordPress
In reply to: Multisite pages seem to work but not main subdomain URLhere is my htaccess file:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^wp-admin$ wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^(wp-(content|admin|includes).*) $1 [L] RewriteRule ^(.*\.php)$ $1 [L] RewriteRule . index.php [L] </IfModule> # END WordPress