Post by omass » Mon Aug 12, 2013 2:16 pm

Hi all,

I would like to know, if there is anyone, who managed to do this: Links directly to the review tab of your product detail page. What I need is a link, which I want to send to customer and when customer opens it, it goes directly to a certain product review tab. I found one solution modifying tab.js, adding this code:

Code: Select all

<!-- code to make the text links point to a specific tab -->
$(document).ready(function() {
    if(window.location.hash.length > 1) {
        $('a[href="' + window.location.hash + '"]').click();
    }
});
<!-- end of code -->


Unfortunately, after adding this code, nothing happens, or maybe I am not sure how to use it.

Thank you for your help.

New member

Posts

Joined
Sat Jan 12, 2013 3:16 am

Post by corinth » Thu Oct 03, 2013 10:04 am

Have you tried to create a page jump (ie. <a name>) just above the review tab and then link to the page jump?

Newbie

Posts

Joined
Fri Sep 27, 2013 11:37 am

Post by omass » Thu Oct 03, 2013 2:23 pm

Hi corinth, could you please write me these steps in more details, so I can try? Never tried page jumps. Thanks a lot.

New member

Posts

Joined
Sat Jan 12, 2013 3:16 am

Post by CZechBoY » Thu Oct 03, 2013 2:31 pm

Code: Select all

$(document).ready(function() {
   if(window.location.hash.indexOf('tab-') == 0) {
       $('a[href="' + window.location.hash + '"]').click();
       $('html, body').animate({
           scrollTop: $("" + window.location.hash).offset().top
       }, 2000);
  }
});

Mass update product descriptions/Hromadná změna popisků zboží


User avatar
Active Member

Posts

Joined
Mon Mar 19, 2012 1:39 am
Location - Europe, Czech republic; Hradec Králové, Brno

Post by omass » Thu Oct 03, 2013 3:13 pm

Thanks for the code, I will let you know if this works.

New member

Posts

Joined
Sat Jan 12, 2013 3:16 am

Post by omass » Thu Oct 03, 2013 3:30 pm

Ok tried, but still need help.

/catalog/view/javascript/jquery/tabs.js at the end of this file added the code you have provided. After that nothing is changed while changing tabs, same product link. Am I doing something wrong? Thank you for help.

New member

Posts

Joined
Sat Jan 12, 2013 3:16 am

Post by CZechBoY » Thu Oct 03, 2013 5:34 pm

It works for me ;-)
But you must change == 0 to == 1 - I forgot for the # hash character.

Code: Select all

$(document).ready(function() {
   if(window.location.hash.indexOf('tab-') == 1) {
       $('a[href="' + window.location.hash + '"]').click();
       $('html, body').animate({
           scrollTop: $("" + window.location.hash).offset().top
       }, 2000);
  }
});

Mass update product descriptions/Hromadná změna popisků zboží


User avatar
Active Member

Posts

Joined
Mon Mar 19, 2012 1:39 am
Location - Europe, Czech republic; Hradec Králové, Brno

Post by omass » Thu Oct 03, 2013 5:48 pm

Changed that, now if I understand correctly, I should write link like that: domain-name/product2#tab-review in order to open review tab, but still it opens description tab as per default. Maybe I should add something in .tpl files as well? Or only above code in tabs.js? My tabs.js looks like that:

Code: Select all

$.fn.tabs = function() {
	var selector = this;
	
	this.each(function() {
		var obj = $(this); 
		
		$(obj.attr('href')).hide();
		
		$(obj).click(function() {
			$(selector).removeClass('selected');
			
			$(selector).each(function(i, element) {
				$($(element).attr('href')).hide();
			});
			
			$(this).addClass('selected');
			
			$($(this).attr('href')).fadeIn();
			
			return false;
		});
	});

	$(this).show();
	
	$(this).first().click();
};
$(document).ready(function() {
   if(window.location.hash.indexOf('tab-') == 1) {
       $('a[href="' + window.location.hash + '"]').click();
       $('html, body').animate({
           scrollTop: $("" + window.location.hash).offset().top
       }, 2000);
  }
});

New member

Posts

Joined
Sat Jan 12, 2013 3:16 am

User avatar
Active Member

Posts

Joined
Mon Mar 19, 2012 1:39 am
Location - Europe, Czech republic; Hradec Králové, Brno

Post by omass » Thu Oct 03, 2013 10:13 pm

works nicely, just like I want to do, but unfortunately it does not work for me.

New member

Posts

Joined
Sat Jan 12, 2013 3:16 am

Post by CZechBoY » Thu Oct 03, 2013 10:50 pm

Send link to your site (here or pm).

Mass update product descriptions/Hromadná změna popisků zboží


User avatar
Active Member

Posts

Joined
Mon Mar 19, 2012 1:39 am
Location - Europe, Czech republic; Hradec Králové, Brno

Post by nettopia » Thu Jan 16, 2020 10:10 pm

CZechBoY wrote:
Thu Oct 03, 2013 10:50 pm
Send link to your site (here or pm).
So did you solve it for him? I need help on this to. Can you help me out aswell?

Newbie

Posts

Joined
Sat Oct 12, 2019 11:30 pm
Who is online

Users browsing this forum: No registered users and 13 guests