Home Page › Forums › WooCommerce Custom Tabs › Error on product page
- This topic has 6 replies, 2 voices, and was last updated 8 years, 6 months ago by
WebshopLogic.
-
AuthorPosts
-
Participant
Have just installed v1.0.10 and am getting the following error on the frontend product page:
Warning: Wrong parameter count for array_unique() in /wp-content/plugins/woocommerce-custom-tabs/woocommerce-custom-tabs.php on line 172
Warning: Invalid argument supplied for foreach() in /wp-content/plugins/woocommerce-custom-tabs/woocommerce-custom-tabs.php on line 188
I also can’t see anything on the Product edit screen to edit the tabs.
I’ve enabled the plugin in Settings and enabled ‘Enable product category dependent product tab pages’
KeymasterHi David!
Please ensure that you created tab types in the “Product tabs” menu.
You can find more information about it here: http://webshoplogic.com/product/woocommerce-custom-tabs-pro-plugin/
(Documentation tab -> “How tab types can be defined?” section)We suppose if you create tab types, the problem will be solved.
If so, please let me know, and we will make an error handler for notify users if there is no tab type defined.
Peter Rath
ParticipantWell yes, I had already created tab types see attached screenshots. They are assigned to a product category, I’ve also tried the ‘Use for all products’ option as well to get something to display.
Attachments:
You must be logged in to view attached files.
ParticipantHi,
Any update on this? I really need to get this resolved.
Let me know if you need any more details to resolve this.
David
KeymasterHi David!
Please let me know what was the solution. If you agree, we will make it available in the next version. Thank you for this help.
Best Regards,
Peter Rath
WebshopLogicParticipantHi Peter,
The issue I was having was in woocommerce-custom-tabs.php line 172. If one of the two arrays you are merging is empty it was throwing a fatal error. I managed to fix it with the following code (I’m sure it could be written a bit more concisely):
// line 172 woocommerce-custom-tabs.php // REMOVE -> $product_tabpage_postslist = array_unique ( array_merge ( $product_tabpage_postslist_1, $product_tabpage_postslist_2 ), SORT_REGULAR); // ADD $product_tabpage_postslist = array(); if ( count($product_tabpage_postslist_1) > 0 && count($product_tabpage_postslist_2) > 0 ) { //array_unique works with an array of objects using SORT_REGULAR: $product_tabpage_postslist = array_unique ( array_merge ( $product_tabpage_postslist_1, $product_tabpage_postslist_2 ), SORT_REGULAR); } else if ( count($product_tabpage_postslist_1) > 0 ) { $product_tabpage_postslist = $product_tabpage_postslist_1; } else if ( count($product_tabpage_postslist_2) > 0 ) { $product_tabpage_postslist = $product_tabpage_postslist_2; }
Hope it helps
Cheers,
DavidKeymasterHi David!
I am glad that everything is okay.
Thanks for your help, we will use this or similar fix in the following release soon.Cheers,
Peter -
AuthorPosts
- You must be logged in to reply to this topic.