Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Questions
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 19th, 2012, 06:08 PM
worldcorponline worldcorponline is offline
 
Join Date: Mar 2012
Posts: 5
Default Prevent Datafeedr from processing same page links

I have the following code in my Datafeedr Factory Product Detail template:

Code:
    
<ul class="tabs">
      <li><a href="#tab-description">Description</a></li>
      <li><a href="#tab-attributes">Additional Information</a></li>
</ul>
However, when processed and displayed on my site the code comes out as this:

Code:
    
<ul class="tabs">
      <li><a href="http://mysite.com/store#tab-description">Description</a></li>
      <li><a href="http://mysite.com/store#tab-attributes">Additional Information</a></li>
</ul>
Is there any way to prevent the store URL from being prepended to the same page anchor URL? For my JS to work the href must only have the #tab-xxx part. Unfortunately I didn't write the JS (it's WooCommerce) so editing it to strip back out the store URL is problematic.
__________________
wco12
  #2  
Old March 19th, 2012, 06:18 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

This isn't Datafeedr doing this. It's the browser, I think.

Are you trying to target those links via their CSS ID? Usually, that's how JS works.

My guess is that it's supposed to be like this:

HTML Code:
<ul class="tabs">
      <li><a href="#tab-description" id="tab-description">Description</a></li>
      <li><a href="#tab-attributes" id="tab-attributes">Additional Information</a></li>
</ul>
But I guess I could be wrong about that.

Eric
  #3  
Old March 19th, 2012, 07:13 PM
worldcorponline worldcorponline is offline
 
Join Date: Mar 2012
Posts: 5
Default

It does grab a CSS id, but that is on a different element that the JS switches visibility on. In the default WooCommerce setup there is a chain of hooks that ultimately results in tabs being added to an unordered list with this code:

PHP Code:
<li><a href="#tab-description"><?php _e('Description''woocommerce'); ?></a></li>
Here is the actual rendered page HTML for an example product page that functions properly:

HTML Code:
<div class="woocommerce_tabs">
    <ul class="tabs">
        <li><a href="#tab-description">Description</a></li>
        <li><a href="#tab-attributes">Additional Information</a></li>
    </ul>

    <div class="panel" id="tab-description">
        <h2>Product Description</h2>
         <!-- @@3.5.3931 -->
        <p>Here is my product's description</p>
    </div>

    <div class="panel" id="tab-attributes">
        <h2>Additional Information</h2>
        <p>Here's additional info about my product</p>
    </div>
</div>		
Normally, when you click on one of the tab links it switches which tab is visible using this JS:

Code:
	/* Tabs */
	$('div.woocommerce_tabs .panel').hide();
	$('div.woocommerce_tabs ul.tabs li a').click(function(){
		
		var $tab = $(this);
		var $tabs_wrapper = $tab.closest('div.woocommerce_tabs');
		
		$('ul.tabs li', $tabs_wrapper).removeClass('active');
		$('div.panel', $tabs_wrapper).hide();
		$('div' + $tab.attr('href')).show();
		$tab.parent().addClass('active');
		
		return false;	
	});
	$('div.woocommerce_tabs').each(function() {
		var hash = window.location.hash;
		if (hash.toLowerCase().indexOf("comment-") >= 0) {
			$('ul.tabs li.reviews_tab a', $(this)).click();
		} else {
			$('ul.tabs li:first a', $(this)).click();
		}
	});
For some reason the two hash URLs are being replaced by the store URL + the hash anchor fragment. It shouldn't be the browser since the anchors render properly in the normal WooCommerce shop, just not in the Datafeedr store. I'll have to mess around with putting random URLs in other locations to hunt it down. It could be something goofy with WordPress pages vs posts.

edit: Found some other references to this occurring with WordPress pages. That seems to be the issue.
__________________
wco12

Last edited by worldcorponline : March 19th, 2012 at 07:20 PM.
  #4  
Old March 19th, 2012, 07:31 PM
worldcorponline worldcorponline is offline
 
Join Date: Mar 2012
Posts: 5
Default

Problem solved.

It ended up being the Google Analytics for WordPress plugin. In case anyone runs into this issue in the future, the solution was to put a space in front of the anchor's #

HTML Code:
<li><a href=" #tab-description">Description</a></li>
The GA plugin passes this by, but the WooCommerce JS (and typically other similar JS) still grabs it properly.
__________________
wco12
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
prevent google from indexing some sites blnklaus Questions 6 March 8th, 2012 09:26 AM
Can I prevent text from displaying on category page 2 and up? cashnow Questions 6 February 23rd, 2011 07:45 PM


All times are GMT -5. The time now is 12:55 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.