Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New SEO enhancement - HELP NEEDED


lech

Recommended Posts

Hi,

 

I'm developing what I hope to be an incredibly simple SEO contribution.

 

Problem:

 

Currently "buy now" and "add to cart" buttons on product listing and "new products" pages are links and not input buttons. So, regardless of whether you force cookies for sessions, you will give the spiders a headache when they crawl on from these page. I.e. the crawlers will go to these links and whether they're looking at a "cookies required" page each time (they don't like to see multiple identical pages - not sure how they react to the location HTTP header) or they manage to activate the shopping cart to some extent ("Prevent Spider Sessions" might be on in admin) YOU do not want them going there. There is nothing for them to see there anyway.

 

Solution

 

Change these links to image input buttons. I have not checked this out but logically it would seem that spiders will not crawl from forms - it just wouldn't make sense.

 

(will also turn the header links e.g. "Cart Contents" into input buttons)

 

This is my progress so far. In product_listings.php add

 

 ?echo '<form method="get" action="' . tep_href_link(basename($PHP_SELF)) . '">';
?echo '<input name="action" type="hidden" value="buy_now" />';

 

Just above

 

 ?$list_box_contents = array();

?for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
? ?switch ($column_list[$col]) {
? ? ?case 'PRODUCT_LIST_MODEL':
? ? ? ?$lc_text = TABLE_HEADING_MODEL;
? ? ? ?$lc_align = '';
? ? ? ?break;

 

Look for the 'PRODUCT_LIST_BUY_NOW': case that prints the current link button and replace the $lc_text with

 

'<input name="products_id" type="image" src="/includes/languages/english/images/buttons/button_buy_now.gif" value="' . $listing['products_id'] . '" />'

 

 

Finally add the close form tag

 

</form>

 

just above

 

 ?if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
?<tr>
? ?<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
? ?<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
?</tr>
</table>
<?php
?}
?>

 

At the end of the script.

 

 

It works but something strange happens

 

I want this explained and fixed before we do the rest. When you click to buy on the product listings page two GET variables are passed to shopping_cart.php

 

products_id_x=27 & products_id_y=11

 

And these don't appear to have anything to do with the product just added. Regardless they should not be there. Can anyone explain this?

 

Once this is sorted out the rest will be easy - New Products will be delt with in exactly the same way.

 

Note that on product info pages we have input buttons so we are ok there.

 

 

*You can download the development files here

Edited by Johnson
Link to comment
Share on other sites

There's a contribution that changes all the buy now links to forms. That fixes the issue.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

HHHHHHHHAAAAAAAAAAAAHAHHAHAHAHAHA

 

Thanks

 

Just like me. Normally I look for things, but recently I've been getting headaches from it so i just plunge ahead.

 

What's the link?

 

Lech

Link to comment
Share on other sites

Sorry I was being lazy. I found it - "buy now" links to forms - by Joshua Dechant. It has apparently been merged with "sid killer".

 

But yuk. This is exactly what i did not want to do - create a seperate form for each button. But what the heck - if it works it works.

 

Lech

Edited by lech
Link to comment
Share on other sites

Well, if you have a better way to do it, I would certainly encourage you to do so. And since you're going to be in there anyways, a contribution making this chagne would be nice.

 

I wonder how this was addressed in the new CVS preview of MS3?

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Hi,

 

I'm developing what I hope to be an incredibly simple SEO contribution.

 

Problem:

 

Currently "buy now" and "add to cart" buttons on product listing and "new products" pages are links and not input buttons. So, regardless of whether you force cookies for sessions, you will give the spiders a headache when they crawl on from these page. I.e. the crawlers will go to these links and whether they're looking at a "cookies required" page each time (they don't like to see multiple identical pages - not sure how they react to the location HTTP header) or they manage to activate the shopping cart to some extent ("Prevent Spider Sessions" might be on in admin) YOU do not want them going there. There is nothing for them to see there anyway.

 

Solution

 

Change these links to image input buttons. I have not checked this out but logically it would seem that spiders will not crawl from forms - it just wouldn't make sense.

 

(will also turn the header links e.g. "Cart Contents" into input buttons)

 

This is my progress so far. In product_listings.php add

 

 ?echo '<form method="get" action="' . tep_href_link(basename($PHP_SELF)) . '">';
?echo '<input name="action" type="hidden" value="buy_now" />';

 

Just above

 

 ?$list_box_contents = array();

?for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
? ?switch ($column_list[$col]) {
? ? ?case 'PRODUCT_LIST_MODEL':
? ? ? ?$lc_text = TABLE_HEADING_MODEL;
? ? ? ?$lc_align = '';
? ? ? ?break;

 

Look for the 'PRODUCT_LIST_BUY_NOW': case that prints the current link button and replace the $lc_text with

 

'<input name="products_id" type="image" src="/includes/languages/english/images/buttons/button_buy_now.gif" value="' . $listing['products_id'] . '" />'

Finally add the close form tag

 

</form>

 

just above

 

 ?if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
?<tr>
? ?<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
? ?<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
?</tr>
</table>
<?php
?}
?>

 

At the end of the script.

It works but something strange happens

 

I want this explained and fixed before we do the rest. When you click to buy on the product listings page two GET variables are passed to shopping_cart.php

 

products_id_x=27 & products_id_y=11

 

And these don't appear to have anything to do with the product just added. Regardless they should not be there. Can anyone explain this?

 

Once this is sorted out the rest will be easy - New Products will be delt with in exactly the same way.

 

Note that on product info pages we have input buttons so we are ok there.

 

if you have an input of type image you get x and y values. if you then name that input "products_id" then you get the ones you get.

 

<input name="products_id" type="image"

Treasurer MFC

Link to comment
Share on other sites

EDIT - just seen above post

 

Unfortunetly I have to move quickly, but my method above works just produces some strange GET vars. If anyone can explain than then we're done. I will have a look too.

 

On your later point can i just say that I am shocked that the clever people designing OSC haven't addressed this issue previously. Absolutely NO DISRESPECT to them - without them I would have missed out on an excellent learning experience and maybe even never have started coding - but I am still surprised.

Edited by lech
Link to comment
Share on other sites

I see, x and y coordinates of the position where the image was clicked. So I can just unset these in application top's 'buy_now' case.

 

Question: The previous contribution uses POST method. Do Crawlers follow the GET methods right?

Link to comment
Share on other sites

Just posted it - "More SE blocks". All forms use post method (just to be on the safe side).

 

 

 

I have a product_new and had a product_listing with only one form for all add to cart buttons working nicely, but I decided to scrap it for two reasons:

 

The image fields required a direct link to the image - I don't know if there is a ready function which just returns the location as oppose to drawing something. Direct links - obvious problems.

 

The second reason, when changing the sort links in product listings to buttons there are problems with placing the single form - there is a way round it by all means, but it's really not worth the trouble unless someone comes up with a reason why having 10+ forms on a page is really bad apart from just looking ugly.

 

So I reverted back to the old method for the product_listing. I.e. No improvement/changes on the original "buy now" links to forms.

 

Well enjoy testing this, my first contribution code named "dam buster" (these dams are holding back visitors...). I'm gonna shut up now.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...