Forum Replies Created

Viewing 15 replies - 61 through 75 (of 168 total)
  • Thread Starter pixelyzed

    (@pixelyzed)

    Awesome thank you!

    Thread Starter pixelyzed

    (@pixelyzed)

    Hi John,

    Thanks for the heads up. I can download the master on Github even if the readme says 5.2.2? I will test it on my local server copy of the site.

    Thread Starter pixelyzed

    (@pixelyzed)

    Hi again,

    After some more Googling and a bit of trial and error, I finally found a perfect solution. Instead of hidding it somehow, I was able to modify the last item of the trail so that it shows the correct taxonomy name as well as the correct link. For thos who may be looking for a similar solution:

    I first finally found something with a bit of a code example I could use to google for a more specific solution here:

    https://wordpress.org/support/topic/plugin-breadcrumb-navxt-hiding-current-item?replies=8

    With that I figure that the hook I needed is bcn_after_fill and the $trail variable gave me another clue. Then I found these two things on Github:

    https://github.com/mtekk/Breadcrumb-NavXT-Extensions/blob/master/breadcrumb_navxt_remove_curitm.php

    https://github.com/mtekk/Breadcrumb-NavXT-Extensions/blob/master/breadcrumb_navxt_cust_paged_title.php

    That gave me the base code and conditional structure I needed and I changed the array_shift($trail->breadcrumbs); in the first example with a variation on $trail->trail[0]->set_title( … ) in the second. Tried set_url too and it worked.

    I already had a archive template for this and the following is the salient code I used to modify the breadcrumb just for the taxonomy archives controlled by that template. Here’s that code which is the same as the first Github example until this comment (and several lines for settings a couple variables which are not shown here) //Let’s change the title and the link :

    add_action( 'bcn_after_fill', 'zw3_modify_current_item' );
    function zw3_modify_current_item( $trail ) {
    	// Set some default values and variables
    
    	// How I set these variables I needed is not pertinent to this and very specific to the site I'm working on. But following is the salient part:
    
    	//Make sure we have a type
    	if( isset( $trail->breadcrumbs[0]->type ) && is_array( $trail->breadcrumbs[0]->type ) && isset( $trail->breadcrumbs[0]->type[1] ) )	{
    		//Check if we have a current item
    		if( in_array( 'current-item', $trail->breadcrumbs[0]->type ) ) {	
    
    			//Let's change the title and the link
    			$trail->trail[0]->set_title( $archive_title );
    			$trail->trail[0]->set_url( $archive_url. '?by=' . $taxonomy_name );
    		}
    	}
    }

    So now I have this working exactly as I really wanted. Removing that last item really was a last resort.

    Thanks!

    Thread Starter pixelyzed

    (@pixelyzed)

    Awesome Justin, thank you! I’ve tested the add_user_role hook locally and it seems to be working fine. I’m guessing it is called once for each role added right? Because the value of the $role argument seems to still be a string just like for set_user_role. The conditional logic for my function checks for that $role arg being equal to a specific string and that still works even when I set 2 new roles or more at once.

    Curious to know what other hooks might have worked for this prior to 4.3 but it doesn’t matter in this case as this is a brand new site that was all built on 4.3 and 4.3.1.

    Thanks again very much!

    @audiodane Who is your host? Out of curiosity, is it a LiteSpeed server?

    I’m getting exactly the same error on a site with a MailPoet signup form. If I try to use Gravity Forms for the signup, the form submission times out. Other Gravity Forms not tied to MailPoet submit without problem.

    There’s something weird going on here since the WP 4.3 upgrade.

    Thread Starter pixelyzed

    (@pixelyzed)

    Awesome! Updated on the live site with my code mod and all seems to work OK at this time.

    Thank you very much again!

    Thread Starter pixelyzed

    (@pixelyzed)

    Hi Mike,

    I do not want to prevent checkout as this is not an error message. This is just a friendly reminder to customers (if they have products with quantities of 2 and more) that, if they want their coffee in 1lb bags instead of the default 2lb bags, to add a note in the order notes box before submitting their order.

    So far if( ( is_cart() || is_checkout() ) && ! is_ajax() ) seems to be working fine but was just wondering if it may cause issues I’m not seeing now.

    Thanks!

    Thread Starter pixelyzed

    (@pixelyzed)

    Hi again,

    After a little research, changing the conditional from

    if( is_cart() || is_checkout() )

    to

    if( ( is_cart() || is_checkout() ) && ! is_ajax() )

    seems to work. Any circumstance where this might display the message in the wrong place in your opinion?

    Also, would love to understand the functional difference between wc_print_notice() and wc_add_notice() and why we’d choose one over the other.

    Thanks!

    Thread Starter pixelyzed

    (@pixelyzed)

    Hi Mike,

    Thanks for your reply.

    I know the HTML and text cannot be there. I didn’t know there was also a wc_add_notice() function which I just tested. It works without producing the error but, unlike wc_print_notice, it still shows the message on the final “Your order has been received” screen where it no longer makes sense and wc_print_notice didn’t do that.

    Is there another conditional check I should have to prevent the wc_add_notice message to appear on the final order screen? Thanks!

    Thread Starter pixelyzed

    (@pixelyzed)

    Btw, if it wasn’t clear, the entire AJAX response code is this:

    <div class="woocommerce-info">Si votre commande contient 2 livres et plus du même café, il sera livré en sacs de 2 livres. Si vous préférez le recevoir en sacs de 1 livre, veuillez le mentionner dans les <strong>notes de la commande</strong> sur la page de commande.</div>
    {"result":"success","redirect":"https:\/\/cafe-vrac.dev\/commander\/order-received\/7556?key=wc_order_55e7e5f396bb8"}

    Ok, FYI, I just nailed my issue but I have no idea how to fix it.

    Re-reading this thread I openend the Chrome Dev Tools and looked at the XHR requests to see the AJAX calls and saw the same kind of respons as honestaeb AND a much smalled bit of HTML code and text I recognized right away as it’s a notice I added myself via hook.

    In this case, the client sells coffee in 1 lb increments in either 1 or 2 lb bags and I needed to check if any product in cart has 2 units of qty and if so, show the notice.

    My function hooks on the woocommerce_check_cart_items hook. In there I have a conditional check for is_cart() || is_checkout(), inside that another check for quantity and if products are in specific categories then I use the wc_print_notice function to print a message.

    I just tested commenting out that code in my child theme’s functions.php and order went through without error. Here’s my entire code for this below. Any way I could modify that to avoid that error?

    Thanks!

    add_action( 'woocommerce_check_cart_items', 'wfd_two_pounds_bags_warning_check' );
    function wfd_two_pounds_bags_warning_check () {
    	global $woocommerce;
    
    	// Only run in the Cart or Checkout pages
      if( is_cart() || is_checkout() ) {
    
    		$coffee_cats = array( 15, 16, 17, 18, 19 );
    
    		// Loop through the products in the Cart
        foreach( $woocommerce->cart->cart_contents as $product_in_cart ) {
    			if( $product_in_cart['quantity'] >= 2 && has_term( $coffee_cats, 'product_cat', $product_in_cart['product_id'] ) ) {
    				$cart_message = 'Si votre commande contient 2 livres et plus du même café, il sera livré en sacs de 2 livres. Si vous préférez le recevoir en sacs de 1 livre, veuillez le mentionner dans les <strong>notes de la commande</strong> sur la page de commande.';
    
    				if ( '2' == get_current_blog_id() ) {
    					$cart_message = 'If your order contains 2lbs or more of the same coffee, it will be shipped in 2lbs bags. If you prefer to get certain or all of your coffees in 1lbs bags, please mention so in the <strong>Order Notes</strong> on the Checkout page.';
    				}
    
    				wc_print_notice( $cart_message, 'notice');
    				break;
    			}
    		}
    	}
    }

    Exact same problem here:

    SyntaxError: Unexpected token <

    Disabled all plugins but WooCommerce on my local copy, changed theme to TwentyTwelve, added the above code in wp-config. Nothing works. Still getting that error.

    Same here, the 1.0.0 update completely broke the plugin. The install instructions mention settings in a “catalog” tab that doesn’t exist and they’re not in General or Products>General or Products>Display or anywhere else that I can see and the buttons disappeared from the front end completely.

    But I just found out why. It seems the plugin changed the name of its folder or something. I went to my plugins page and got a notification the plugin had been deactivated because the file didn’t exist and I found the 1.0.0 version deactivated in the list. I activated it and now it works.

    A mention of this in the changelog would have been nice…

    I tested the new version on a dev site and indeed it seems to fix the issues. Both Ajax pagination and admin gallery sorting are working now.

    Thank you!

Viewing 15 replies - 61 through 75 (of 168 total)