Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

NodsDorf

Addon to stop bots from following action=buy_now on the buttons

11 posts in this topic

Just noticed this today in a SEOmoz report. We are seeing 302 errors from redirection to the cookie usage page as the bots are trying to follow the buy now buttons on our site. Shouldn't those all be nofollow?

 

Maybe there is a mod that deals with this if so I missed it, but nofollow should be part of basic code when generating action buttons.... I think.

 

I think it will be a fairly simple fix, if I find a solution I'll post it, or if you have one I'd appreciate the code.

 

Thanks,

Don

Share this post


Link to post
Share on other sites

The cart and checkout pages should be in your robots.txt file so the bots will leave them alone. Having them redirected to the cookies page is actually harmless, so I wouldn't put too much effort into fixing this.

 

Regards

Jim

Share this post


Link to post
Share on other sites

Hi Jim,

 

Indeed shopping cart / checkout pages are blocked via robots.txt, but the URL being displayed on the page is like

 href="http://www.rubberstore.com/catalog/as568-nitrile-c-33_39_43.html?products_id=29&action=buy_now&sort=3a

 

If nothing more its annoying to see kathousand errors via Seomoz reports, I just need to figure out how to add the nofollow attribute in the product_listing where the button is generated.

Share this post


Link to post
Share on other sites

Try something like this:

 

if( isset( $_GET['action'] && $_GET['action'] != '' ) {
// Output a noindex/nofollow tag here
}

 

Regards

Jim

NodsDorf likes this

Share this post


Link to post
Share on other sites

HI Jim,

 

Thanks for the idea there, I got around to trying to fix this today and I am coming up blank on where to put the nofollow to get it to parse correctly.

 

In /includes/modules/product_listing.php

I'm assuming I need to edit this code:

case 'PRODUCT_LIST_BUY_NOW':
	    $prod_list_contents .= '	    <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing[$x]['products_id'])) . '</td>';
	    break;

However no matter were I try and put rel="nofollow" the link is not coming out correctly.

 

I don't really think I need to check to see if there is an action set, so I was just trying to stick the tag in there. I can't think of any reason for these buttons not to have a no follow tag, since the product image and the product name already link to the product page, and the button will always link to "add to cart" action.

Share this post


Link to post
Share on other sites

I think this will work. Not tested, so beware bugs:

 

				    $prod_list_contents .= '	    <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']), NULL, array('params'=>'rel="nofollow"')) . '</td>';

 

Regards

Jim

NodsDorf likes this

Share this post


Link to post
Share on other sites

Thanks Jim

 

I'll let you know how it goes when I get into work tomorrow, really appreciate the continued help.

Share this post


Link to post
Share on other sites

Jim that was absolutely spot on

 

I was thinking that you could add the rel=nofollow into one of the all ready defined functions. Good call... and off the top of your head very nice!

 

<span class="tdbLink"><a id="tdb3" href="http://www.rubberstore.com/test/catalog/as568-nitrile-c-33_39_43.html?products_id=31&action=buy_now&sort=2a" rel="nofollow">Buy Now</a></span>

 

Thank you very much!

Share this post


Link to post
Share on other sites

Option 2 won't reliably work. The robots.txt standard does not allow wildcards in file/directory names. Some search engines might allow them, but they don't have to.

 

Regards

Jim

Share this post


Link to post
Share on other sites