New Landing How can we help? Themeforest Theme Support Dante PHP error tabs.php line 49

Viewing 15 posts - 1 through 15 (of 44 total)
  • Posted in: Dante
  • #129797
    crease
    Member
    Post count: 101

    I am getting this error in my error_log:

    PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /home/langleyd/public_html/wp-content/themes/dante/woocommerce/single-product/tabs/tabs.php on line 49

    any ideas whats causing it?

    This is line 49:

    <?php call_user_func( $tab[‘callback’], $key, $tab ) ?>

    #129888
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    The developer of theme will assist you shortly.
    Thanks
    Mohammad

    #130323
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hi @crease

    That’s odd. Not getting the issue here. Have you tried disabling any active plugins? What version of the theme/WooCommerce are you using?

    – Ed

    #130775
    crease
    Member
    Post count: 101

    I am using the latest version on both.

    I have added this content to my functions.php file to add an additional tab:

    add_filter( ‘woocommerce_product_tabs’, ‘woo_new_product_tab’ );
    function woo_new_product_tab( $tabs ) {

    // Adds the new tab
    $tabs[‘custom_tab’] = array(
    ‘title’ => __( ‘Tab Title’, ‘woocommerce’ ),
    ‘priority’ => 50,
    ‘callback’ => ‘woo_new_product_tab_content’
    );
    return $tabs;}

    function woo_new_product_tab_content() {
    // The new tab content
    echo ‘<p>Additional copy for tab here</p>’;
    }

    add_filter( ‘woocommerce_product_tabs’, ‘woo_reorder_tabs’, 98 );
    function woo_reorder_tabs( $tabs ) {
    $tabs[‘tab-downloads’][‘priority’] = 5; // first
    return $tabs;
    }

    Not sure if that would cause a conflict. I will disable it for now and see. But why is the error within the tabs file of the dante theme and not in the changes I have made?

    #130780
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    The error would show there because that is where the tabs code is run. Let me know if it is because of that code – I can’t see anything wrong first glance.

    – Ed

    #130798
    crease
    Member
    Post count: 101

    Yes I remove this code and the error vanished put it back in and pop its there again.

    I only displays front end for a second though while the content loads in, if that makes a difference.

    #131133
    laranz – SUPPORT
    Member
    Post count: 3186

    Hi,

    I think, you create a tab called custom_tab and try to order the priority of another tab with some other name like tab-downloads? That didn’t registered yet??

    Try this code.

    add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
    function woo_new_product_tab( $tabs ) {
    
    // Adds the new tab
    $tabs['custom_tab'] = array(
    'title' => __( 'Tab Title', 'woocommerce' ),
    'priority' => 50,
    'callback' => 'woo_new_product_tab_content'
    );
    return $tabs;}
    
    function woo_new_product_tab_content() {
    // The new tab content
    echo '<p>Additional copy for tab here</p>';
    }
    
    add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
    function woo_reorder_tabs( $tabs ) {
    $tabs['custom_tab']['priority'] = 5; // first
    return $tabs;
    }

    Let us know,

    Thanks,
    laranz.

    #131243
    crease
    Member
    Post count: 101

    Thanks I think that has sorted it. I will keep and eye on the error log and let you know. Thanks for your help.

    #131244
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I glad that issue resolved. Great, thanks Laranz.
    Mohammad

    #138828
    alemarengo
    Member
    Post count: 695

    Hi Ed and his guys.
    I have little trouble I’d like you to help me fix.

    I added the following in functions.php:

    add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
    function woo_reorder_tabs( $tabs ) {
    
    	$tabs['reviews']['priority'] = 15;
    	$tabs['description']['priority'] = 10;
    	$tabs['additional_information']['priority'] = 5;
    
    	return $tabs;
    }
    
    add_filter( 'woocommerce_product_tabs', 'description_tab', 99 );
    function description_tab( $tabs ) {
    global $post, $product;
    $exists = sf_get_post_meta($post->ID, 'sf_product_description', true);
    	if (empty($exists)) {
    		unset($tabs['description']);
    		}
    	return $tabs;
    }

    With those lines I reached two goals:
    1) to order tabs
    2) hide tabs “description” if its content is void

    Unfortunately, it seems to be in conflict with your code because I noticed the following error in error.log:
    [Sun Jan 04 10:24:10 2015] [warn] [client 207.46.13.11] mod_fcgid: stderr: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /data/vhosts/puntobianco.net/httpdocs/assets/themes/dante/woocommerce/single-product/tabs/tabs.php on line 49
    which is the same of this topic.

    ___
    Strange thing is that I’m pretty sure that before yesterday there was also “Reviews” tab visible. Today… after noticing error in error.log I cannot see it anymore…
    ___

    Is there a way for me to use my snippet in a compatible way with your tabs.php?
    I hope so. 🙂

    #138829
    alemarengo
    Member
    Post count: 695

    Maybe I should add some other additional info about this error:
    you may see in the attached screenshots the following:
    – duvet named “Canadese” has no content for “Description”, Reviews tab is visible;
    – duvet named “Caldapiuma” has content for “Description”, Reviews tab is… not visible.
    The following what appears in error.log
    [Sun Jan 04 11:02:07 2015] [warn] [client 151.49.194.140] mod_fcgid: stderr: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /data/vhosts/puntobianco.net/httpdocs/assets/themes/dante/woocommerce/single-product/tabs/tabs.php on line 49, referer: http://www.puntobianco.net/categoria-prodotto/letto/piumini-oca/

    Please, note that at the time I was writing that I commented the snippet
    /*add_filter( ‘woocommerce_product_tabs’, ‘description_tab’, 99 );
    function description_tab( $tabs ) {
    global $post, $product;
    $exists = sf_get_post_meta($post->ID, ‘sf_product_description’, true);
    if (empty($exists)) {
    unset($tabs[‘description’]);
    }
    return $tabs;
    }*/

    Hope you can help me finding what’s happening with your tabs.php.
    Thanks in advance.

    Attachments:
    You must be logged in to view attached files.
    #138832
    alemarengo
    Member
    Post count: 695

    My final draft is the following:

    add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
    function woo_reorder_tabs( $tabs ) {
    
    	$tabs['additional_information']['priority'] = 5;
    	return $tabs;
    }
    
    add_filter( 'woocommerce_product_tabs', 'description_tab', 99 );
    function description_tab( $tabs ) {
    global $post;
    $exists = sf_get_post_meta($post->ID, 'sf_product_description', true);
    	if ($exists == "") {
    		unset($tabs['description']);
    	}
    	return $tabs;
    }

    error.log seems to be register any other incompatibility with your tabs.php
    In regards to the two products as in the examples above, now they’re looking as expected.

    What do you think about this snippet consistency?
    And in addition, is it possible to join my two functions in only one?

    #139134
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    You can join the function like so:

    add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
    function woo_reorder_tabs( $tabs ) {
    
    global $post;
    
    $tabs['additional_information']['priority'] = 5;
    
    $exists = sf_get_post_meta($post->ID, 'sf_product_description', true);
    if ($exists == "") {
        unset($tabs['description']);
    }
    
    return $tabs;
    
    }

    Hope that helps.

    – Ed

    #140555
    alemarengo
    Member
    Post count: 695

    Hi Ed!
    Thanks for your reply.
    Joining functions like suggested works well.

    Even though I’m sorry to bother you again, but since I transferred my Dante featured ecommerce in a new dedicated server the only (!) error in error.log that I see is the following:
    Sat Jan 10 08:53:07 2015] [warn] [client 66.249.64.149] mod_fcgid: stderr: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /................/themes/dante/woocommerce/single-product/tabs/tabs.php on line 49
    Is it possible to investigate what may cause this issue?
    Waiting for your prompt reply, many thanks.

    #140630
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Is that after the code change? Do you still get it if you remove that function?

    – Ed

Viewing 15 posts - 1 through 15 (of 44 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register