Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Product Description Tabs Mode – My tabs stopped working and getting jQuery error
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Product Description Tabs Mode – My tabs stopped working and getting jQuery error
- This topic has 11 replies, 2 voices, and was last updated 10 years by Mohammad – SUPPORT.
-
Posted in: Neighborhood
-
July 16, 2014 at 9:43 pm #91957
Hello – recently I noticed that my product tabs are not working and are throwing JQuery errors. I have included a private link for you to see a sample page. When you try to navigate to any tab – think link does not work and you can then not get back to the main tab either.
All of my plugins are up to date, and I am only one update short of your latest theme release, but I noticed in that release you are stilling using the same jQuery version so I suspect this is not necessarily going to fix my problem.
I initially thought it might be an incompatibility with the plugin “WooCommerce Custom Product Tabs Lite” but the problem persists after disabling this plugin.
Any ideas what is happening? and how to fix it?
Many thanks!
Robb
July 17, 2014 at 10:01 am #92079Hi,
Please follow given below step:-
1- Upgrade theme first because current theme have many compatibility issues with latest woocommerce version.2-Deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).
Thanks 🙂
With Best Regards
Swift IdeasJuly 17, 2014 at 8:21 pm #92360Hi Mohammed – so I have done as you requested and unfortunately the problem continues. I am still unable to use the tabs.
I now have the latest theme, WP, and all plugins.
I tried disabling all plugins except those required by WooCommerce.
Can you please take a look at this. Not having the tabs work is a pretty big issue.
Thanks.
Robb
July 18, 2014 at 5:36 am #92424Hi,
Can you please provide wordpress admin login detail so i can check your setup?
ThanksJuly 18, 2014 at 4:58 pm #92657This reply has been marked as private.July 18, 2014 at 6:24 pm #92668Hi,
I have resolved this issue so please check.Code Remarks:- single-product.js at plugins\woocommerce\assets\js\frontend var show_id = $(this).attr('href').substring($(this).attr('href').indexOf('#')); $( 'div' + show_id, $tabs_wrapper).show();
Thanks
July 18, 2014 at 6:50 pm #92679That is awesome Mohammad – thank you very much (excellent support)!!!
I want to be able to redo your edit in the event that it gets overwritten with a future update – BUT I am unclear as to what you actually did. I have looked at the file …
plugins\woocommerce\assets\js\frontend\single-product.js
… and I can not see the line of code you mentioned. I looked at an older version of this file and can not see that code there either (in the event that you simply removed that line). So I am confused as to what you did, where and how can re-do it again in the future.
Cheers – and many thanks.
Robb
July 18, 2014 at 6:54 pm #92683Hi,
Sorry! It was single-product-min.js.
ThanksJuly 18, 2014 at 7:11 pm #92687Thank you for your quick reply!
So I see the file you mentioned. I now see your line of code. But I am worried about what will happen with this change the next time I update WooCommerce (which is constantly updating). I want to assume that you simply inserted that line of code into the original file. But it does not appear that is the case. Right? I looked at your code, all of it, and I just compared it to the latest version of the WooCommerce code as it would appear before your change and the two pages of code are quit a bit different. Not just the line you changed – and aside from your version being un-minified.
Here is the original file ….
jQuery(function(a){return"undefined"==typeof wc_single_product_params?!1:(a(".woocommerce-tabs .panel").hide(),a(".woocommerce-tabs ul.tabs li a").click(function(){var b=a(this),c=b.closest(".woocommerce-tabs");return a("ul.tabs li",c).removeClass("active"),a("div.panel",c).hide(),a("div"+b.attr("href"),c).show(),b.parent().addClass("active"),!1}),a(".woocommerce-tabs").each(function(){var b=window.location.hash,c=window.location.href,d=a(this);b.toLowerCase().indexOf("comment-")>=0?a("ul.tabs li.reviews_tab a",d).click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?a("ul.tabs li.reviews_tab a",a(this)).click():a("ul.tabs li:first a",d).click()}),a("a.woocommerce-review-link").click(function(){return a(".reviews_tab a").click(),!0}),a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>'),a("body").on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();return b.size()>0&&!c&&"yes"===wc_single_product_params.review_rating_required?(alert(wc_single_product_params.i18n_required_rating_text),!1):void 0}),void a("form.cart").submit(function(){a(this).find(":submit").attr("disabled","disabled")}))});
And your version …
jQuery( function( $ ) { // wc_single_product_params is required to continue, ensure the object exists if ( typeof wc_single_product_params === 'undefined' ) { return false; } // Tabs $( '.woocommerce-tabs .panel' ).hide(); $( '.woocommerce-tabs ul.tabs li a' ).click( function(e) { e.preventDefault(); var $tab = $( this ), $tabs_wrapper = $tab.closest( '.woocommerce-tabs' ); $( 'ul.tabs li', $tabs_wrapper ).removeClass( 'active' ); $( 'div.panel', $tabs_wrapper ).hide(); var show_id = $(this).attr('href').substring($(this).attr('href').indexOf('#')); $( 'div' + show_id, $tabs_wrapper).show(); $tab.parent().addClass( 'active' ); return false; }); $( '.woocommerce-tabs' ).each( function() { var hash = window.location.hash, url = window.location.href, tabs = $( this ); if ( hash.toLowerCase().indexOf( "comment-" ) >= 0 ) { $('ul.tabs li.reviews_tab a', tabs ).click(); } else if ( url.indexOf( "comment-page-" ) > 0 || url.indexOf( "cpage=" ) > 0 ) { $( 'ul.tabs li.reviews_tab a', $( this ) ).click(); } else { $( 'ul.tabs li:first a', tabs ).click(); } }); $( 'a.woocommerce-review-link' ).click( function() { $( '.reviews_tab a' ).click(); return true; }); // Star ratings for comments $( '#rating' ).hide().before( '<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>' ); $( 'body' ) .on( 'click', '#respond p.stars a', function() { var $star = $( this ), $rating = $( this ).closest( '#respond' ).find( '#rating' ); $rating.val( $star.text() ); $star.siblings( 'a' ).removeClass( 'active' ); $star.addClass( 'active' ); return false; }) .on( 'click', '#respond #submit', function() { var $rating = $( this ).closest( '#respond' ).find( '#rating' ), rating = $rating.val(); if ( $rating.size() > 0 && ! rating && wc_single_product_params.review_rating_required === 'yes' ) { alert( wc_single_product_params.i18n_required_rating_text ); return false; } }); // prevent double form submission $( 'form.cart' ).submit( function() { $( this ).find( ':submit' ).attr( 'disabled','disabled' ); }); });
So would I re-do this change next time woocommerce updates?
Robb
July 19, 2014 at 8:26 am #92769Hi,
I think that you will not re do this action. If you need then i am ready to help.
ThanksJuly 22, 2014 at 7:08 pm #93831OK – but isn’t this code likely to get overwritten next time there is a woocommerce update? They have updates every other month it seems.
July 23, 2014 at 5:24 am #93908Hi,
It will overwritten next time sure so you should have a backup of this file. Updated file should work otherwise you can use old file.
Thanks -
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.