Phil_Malaysia Posted August 27, 2012 Share Posted August 27, 2012 Hello Everyone, I'm using 1.4.8 Prestahop and have been trying to figure out how to name my sub-category images. Can someone help me? I set up two sub categories under directory and kids toys on my site. SEOquake tells me that missing ALT attributes are not good for SEO. Help & Thanks, Phil http://www.kidstoysmalaysia.com.my Link to comment Share on other sites More sharing options...
Bazze Posted August 27, 2012 Share Posted August 27, 2012 Hello Everyone, I'm using 1.4.8 Prestahop and have been trying to figure out how to name my sub-category images. Can someone help me? I set up two sub categories under directory and kids toys on my site. SEOquake tells me that missing ALT attributes are not good for SEO. Help & Thanks, Phil http://www.kidstoysmalaysia.com.my You can change it in your category.tpl file in your theme directory, around line 53. Link to comment Share on other sites More sharing options...
Phil_Malaysia Posted August 27, 2012 Author Share Posted August 27, 2012 Thanks for replying Bazze, I found the code on line 53 but how do I edit it? Here's the code in the category.tpl file {/if} {if isset($subcategories)} <!-- Subcategories --> <div id="subcategories"> <h2>{l s='Subcategories'}</h2> <ul> {foreach from=$subcategories item=subcategory} <li> <a class="bgcolor bordercolor" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt=" " /> {else} <img src="{$img_cat_dir}default-medium.jpg" alt=" " /> {/if} Thanks, Phil Link to comment Share on other sites More sharing options...
Bazze Posted August 28, 2012 Share Posted August 28, 2012 Thanks for replying Bazze, I found the code on line 53 but how do I edit it? Here's the code in the category.tpl file {/if} {if isset($subcategories)} <!-- Subcategories --> <div id="subcategories"> <h2>{l s='Subcategories'}</h2> <ul> {foreach from=$subcategories item=subcategory} <li> <a class="bgcolor bordercolor" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt=" " /> {else} <img src="{$img_cat_dir}default-medium.jpg" alt=" " /> {/if} Thanks, Phil Well, that depends on what you want in the alt attribute. What do you want there? Link to comment Share on other sites More sharing options...
Phil_Malaysia Posted August 28, 2012 Author Share Posted August 28, 2012 Hello Bazze, I would like to give each individual sub-category image and ALT attribute name. I did test the code and put a "stub" value as indicated below: <img src="{$img_cat_dir}default-medium.jpg" alt="test value " /> But this did not help. When I analyzed the website the sub-categories still showed as empty. Thanks, Phil http://www.kidstoysmalaysia.com.my Link to comment Share on other sites More sharing options...
Bazze Posted August 29, 2012 Share Posted August 29, 2012 Hello Bazze, I would like to give each individual sub-category image and ALT attribute name. I did test the code and put a "stub" value as indicated below: <img src="{$img_cat_dir}default-medium.jpg" alt="test value " /> But this did not help. When I analyzed the website the sub-categories still showed as empty. Thanks, Phil http://www.kidstoysmalaysia.com.my You should try to add it to the line: <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt=" " /> instead. Link to comment Share on other sites More sharing options...
Phil_Malaysia Posted August 30, 2012 Author Share Posted August 30, 2012 (edited) Bazze, Here's my the content of my category.tpl file. I put in Bold type the code that I inserted. Should I recompile the code? As I still get the same message from SEOquake about missing ALT attributes. Thanks Again! Phil {include file="$tpl_dir./breadcrumb.tpl"} {include file="$tpl_dir./errors.tpl"} {if isset($category)} {if $category->id AND $category->active} <h1> {strip} {$category->name|escape:'htmlall':'UTF-8'} {if isset($categoryNameComplement)} {$categoryNameComplement|escape:'htmlall':'UTF-8'} {/if} <span class="category-product-count"> {include file="$tpl_dir./category-count.tpl"} </span> {/strip} </h1> {if $scenes} <!-- Scenes --> {include file="$tpl_dir./scenes.tpl" scenes=$scenes} {* {else} <!-- Category image --> {if $category->id_image} <div class="align_center"> <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" /> </div> {/if} *} {/if} {if $category->description} <p class="cat_desc">{$category->description}</p> {/if} {if isset($subcategories)} <!-- Subcategories --> <div id="subcategories"> <h2>{l s='Subcategories'}</h2> <ul> {foreach from=$subcategories item=subcategory} <li> <a class="bgcolor bordercolor" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt=" " /> <!-- old code <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" /> --> {else} <img src="{$img_cat_dir}default-medium.jpg" alt="{$category->name|escape:'htmlall':'UTF-8'}" /> {/if} <span>{$subcategory.name|escape:'htmlall':'UTF-8'|truncate:20:'...'}</span> </a> </li> {/foreach} </ul> </div> {/if} {if $products} {include file="$tpl_dir./product-sort.tpl"} {include file="$tpl_dir./product-list.tpl" products=$products} {* {include file="$tpl_dir./product-compare.tpl"}*} {include file="$tpl_dir./pagination.tpl"} {elseif !isset($subcategories)} <p class="warning">{l s='Comeback soon where almost there!'}</p> {/if} {elseif $category->id} <p class="warning">{l s='This category is currently unavailable.'}</p> {/if} {/if} http://www.kidstoysmalaysia.com.my/ Edited August 30, 2012 by Phil_Malaysia (see edit history) Link to comment Share on other sites More sharing options...
Bazze Posted August 30, 2012 Share Posted August 30, 2012 (edited) The old code seemed to be correct. If you have smarty cache on, you should enable force recompile (to make sure it recompiles) and then turn it back of once you've visited the page. You could also clear the cache directory. Edited August 30, 2012 by Bazze (see edit history) Link to comment Share on other sites More sharing options...
Phil_Malaysia Posted September 5, 2012 Author Share Posted September 5, 2012 Hello Bazze, How would I remove the images all together for sub-categories? As I did clear my cache and forced a recompile. When I test my site it still shows "missing ALT attributes". I figured I'd be better off with no images for the sub-category. Hope your still out there! Any feedback is welcome, Thanks, Phil Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now