View Single Post
  #1  
Old 09-13-2005, 02:47 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default Boost SEO with better ALT text - V4.0.x

I was working on a store that uses products in three columns and also uses images for recommended products and upselling products. All these make a call on the product_thumbnail.tpl file but dont use ALT tags very well and where they do they only use the product title. Its a bit of a waste of time as for the most part the product title is already on the page with thie thumbnail. Instead of that its much better to use the product description as this is only used on the main product detail page.

This was done on V4.0.15 but should work on most versions. just follow the example and it should make sense

so.....

edit product_thumbnail.tpl

Code:
{* $Id: product_thumbnail.tpl,v 1.14 2004/06/24 09:53:29 max Exp $ *} {if $config.Appearance.show_thumbnails eq "Y"}[img]{if $tmbn_url}{$tmbn_url}{else}{if $full_url}{$http_location}{else}{$xcart_web_dir}{/if}/image.php?productid={$productid}{if $file_upload_data.file_path}&tmp=y{/if}{/if}[/img]{/if}

in that file we changed

Code:
alt="{$product|escape}"
to
Code:
alt="{$alt|strip_tags:false|strip}"

I updated this with extra modifiers to remove any html content that may be in the detailed description

next we need to adjust the files that call product_thumbnail.tpl.

First up is products_t.tpl

change


to

Code:
<A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}">{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url alt=$products[product].fulldescr|replace:" ":""}</A>

Next up, you can change products.tpl too. only need to do this if your not using products_t.tpl

find

Code:
{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url}

change to

Code:
{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url alt=$products[product].fulldescr|replace:" ":""}

my recommends file was changed like this. there are plenty of mods in the forum to improve on this layout but this example will give you an idea of using the description

Code:
{* $Id: related_products.tpl,v 1.10 2004/05/28 12:21:13 max Exp $ *} {if $recommends} {capture name=recommends} <TABLE border="0" cellpadding="0" cellspacing="0"> <TR> {section name=num loop=$recommends} <TD width="100" align="center" valign="top"><A href="product.php?productid={$recommends[num].productid}"> {include file="product_thumbnail.tpl" productid=$recommends[num].productid tmbn_url=$recommends[num].tmbn_url image_y=75 alt=$recommends[num].fulldescr|replace:" ":""}</A> {$recommends[num].product}</TD> <TD width="10"></TD> {/section} </TR> </TABLE> {/capture} {include file="dialog.tpl" title=$lng.lbl_recommends content=$smarty.capture.recommends extra="width=100%"} {/if}

to pass the description over you need to edit

/modules/Upselling_Products/related_products.php

adjust the start of the sql call like this

Code:
$product_links = func_query("SELECT DISTINCT $sql_tbl[products].fulldescr, $sql_tbl[products].productid,

basically just added - $sql_tbl[products].fulldescr, to the call

Im sure there are a few tweaks that can be had so feel free to chip in. This should give you a good boost of text on any page though and help out a bit with your SEO. just remember to add good content to your product descriptions
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote