New Landing How can we help? Themeforest Theme Support Neighborhood Product Description Tabs Mode – My tabs stopped working and getting jQuery error

Viewing 12 posts - 1 through 12 (of 12 total)
  • #91957
    kingrobb
    Member
    Post count: 31

    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

    #92079
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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 Ideas

    #92360
    kingrobb
    Member
    Post count: 31

    Hi 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

    #92424
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Can you please provide wordpress admin login detail so i can check your setup?
    Thanks

    #92657
    kingrobb
    Member
    Post count: 31
    This reply has been marked as private.
    #92668
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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

    #92679
    kingrobb
    Member
    Post count: 31

    That 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

    #92683
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Sorry! It was single-product-min.js.
    Thanks

    #92687
    kingrobb
    Member
    Post count: 31

    Thank 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

    #92769
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I think that you will not re do this action. If you need then i am ready to help.
    Thanks

    #93831
    kingrobb
    Member
    Post count: 31

    OK – but isn’t this code likely to get overwritten next time there is a woocommerce update? They have updates every other month it seems.

    #93908
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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

Viewing 12 posts - 1 through 12 (of 12 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