X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Boost SEO with better ALT text - V4.0.x (https://forum.x-cart.com/showthread.php?t=16546)

shan 09-13-2005 02:47 AM

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 :-)

GM 09-20-2005 07:28 PM

Nice one Shan, I just want to add that it also helps to name your image files by the product name ie. cell_phone.jpg (every bit helps)

Dongan 09-20-2005 08:23 PM

Nice tweak. Minimum effort and manimum effect.

shan 09-21-2005 12:56 AM

only thing you gotta watch with this one is if you use a lot of html in your product description. A way around this is to use the short description field instead and fill that with a description without the html and other good keywords

cotc2001 09-21-2005 06:15 AM

Nice mod, i'll have to try it later, is there anyway to truncuate the description though to about first 120 chars??? reason being is that my descriptions are quite long.

shan 09-21-2005 06:19 AM

in product_thumbnail.tpl

Code:

alt="{$alt|escape|truncate:200}"

more info here

http://smarty.php.net/manual/en/language.modifier.truncate.php

MythNReality 09-22-2005 07:21 PM

shan,

Here's my related products, where should I place the code?

Quote:

{* $Id: related_products.tpl,v 1.7.6.1 2004/12/06 svowl Exp $ *}
{if $product_links ne ""}

{capture name=dialog}
{assign var="tmp" value="0"}

{section name=cat_num loop=$product_links}
{if $product_links[cat_num].productid}{assign var="tmp" value="1"}{/if}
{/section}

{section name=cat_num loop=$product_links}

{ if %cat_num.first% }
<table border=0 cellspacing=5 width=100%>
{/if}

{if $smarty.section.cat_num.index is div by 3}
</tr><tr valign="top">
{/if}

<td width="250" align="center">
{include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=$config.Appearance.thumbnail_width product=$product_links[cat_num].product tmbn_url=$product_links[cat_num].tmbn_url}




<a href="product.php?productid={ $product_links[cat_num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>
<span class="ProductTitle">{ $product_links[cat_num].product|escape}</span>
</a></td>
{ if %cat_num.last% }
</tr></table>
{/if}
{/section}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra="width=100%"}
{/if}

Thanks for the help!

rossco 09-24-2005 03:14 AM

Hi

I've tried this in 4.0.12 with no success. Any thoughts would be gratefully received.

Allan

rossco 09-29-2005 05:49 AM

Just another quickie.

You say to name your jpg's so that they reflect the product name, xcart renames all images so how do I get around that.

I'm very keen on SEO and so far it's paying off on our site so as you say every little helps.

Allan

shan 09-29-2005 05:53 AM

Quote:

Originally Posted by rossco
Just another quickie.

You say to name your jpg's so that they reflect the product name, xcart renames all images so how do I get around that.

I'm very keen on SEO and so far it's paying off on our site so as you say every little helps.

Allan


your right, theres no real way around the way xcart names things at the mo. Anything you add by hand though could be named cleverly

shan 09-29-2005 05:57 AM

i edited the main post to to strip html tags from the detailed description when its used as alt tags

rossco 09-30-2005 07:35 AM

Shan, Hi

Any thoughts on the 4.0.12 issue and the question raised by MythNreality?

Allan

shan 10-02-2005 11:56 AM

Quote:

Originally Posted by rossco
Shan, Hi

Any thoughts on the 4.0.12 issue and the question raised by MythNreality?

Allan


Hi Allan,

the mod will pretty much work for any version. Its just passing the description via the $alt variable to the thumbnail template. If you follow the code in the first post you shouldnt have any problems

mffowler 10-04-2005 04:29 PM

Thanks shan! This a great mod. I just implemented a three column thumb. display for recommends and the alt addition improved it even more.

For anyone who doesn't completely see the value: one can't underestimate the value of data on a web page. A search engine can hit a site at any level of the hierarchy and having random content (even on the html catalog pages) of high value (like alt and tilte tags) can send a spider amongst the stack vs. level by level like most straight formed site maps.

One thing to keep in mod: never over do it. Keep it simple, but make simplicity count for something. At the end of the day, content is king and having valuable dynamic content of value is what make Google to begin with......

Thanks shan.

- Mike

mffowler 10-04-2005 04:31 PM

Oh... another decent SEO trick is tweaking Smarty. Use replacement code to have better, longer, more detailed product naming without a huge string used for every call. this works in the ALT and TITLE tags as well as any other Smarty call for a spread.

- Mike

Isleman 01-26-2006 01:36 AM

I am very keen to get this Mod on my website but it doesn't work .
After I aply the modified files instead of thumbnail product name i would expect to see the truncated description but I don't get anything .
Do you think is it because i use Dsefu Mod ? Anybody used these mod combined with Safetynet Dsefu Mod ?

Here is a portion of my products_t.tpl

{* SAFETYNET DSEFU MOD *}
{if $enable_seo_links == "Y"}
{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}

{else}
{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}

{/if}
{* END SAFETYNET DSEFU MOD *}

As you can see I am not sure to which line to apply the mod . I tried either but not luck .

hooter 01-26-2006 01:52 AM

@Isleman,

Has nothing to do with DSEFU mod - if you follow Shan's instructions implicitly from the top of this thread and place the code where he says to place it, it will work. 8)

PM me your ftp info and I'll get it working for you.

Isleman 01-26-2006 03:03 AM

Quote:

Originally Posted by hooter
@Isleman,

Has nothing to do with DSEFU mod - if you follow Shan's instructions implicitly from the top of this thread and place the code where he says to place it, it will work. 8)

PM me your ftp info and I'll get it working for you.


Hooter excellent job is working like a treat .
I just tested now with a keyword density analyzer and what can I say " wow".
All the alt tags are picked up now with my keywords.
This mod toghether with DSEFU mod is the best x-cart add-on for SEO.

P.S. As you could see on my website I had Bestsellers on the left side . Before they use to have an alt tag just with the product title now that is gone and nothing is displayed as an alt tag with them . Is it possible to get the same description ALT tag for these ?

shan 01-27-2006 05:20 AM

I might just release this as a mod as Ive improved on it since i posted it here

cotc2001 01-27-2006 08:04 AM

what a good idea :D i'd probably buy it

mitash 01-30-2006 01:30 PM

Quote:

Originally Posted by shan
only thing you gotta watch with this one is if you use a lot of html in your product description. A way around this is to use the short description field instead and fill that with a description without the html and other good keywords


Nice mod Shan,

How about creating another field for a product and only adding specific keywords in that field related to a product and calling that field..?

It will be tedious to add the keywords however results will be great...from SEO perspective...

What do you guys think about that...

shan 01-31-2006 06:52 AM

yes, could add this as an option and have it so that it checks for the meta tags first and if not shows the description

alru111 02-12-2006 02:18 PM

Following the above example I fixed subcategories' icons.
But for some reason. I can only call 'categoryid' or 'category'
not 'description' or 'meta_descript' as I initially wanted.


All times are GMT -8. The time now is 03:52 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.