View Single Post
  #7  
Old 08-23-2012, 01:20 PM
 
paul@dimoda.com.au paul@dimoda.com.au is offline
 

Senior Member
  
Join Date: Aug 2007
Location: Perth, Australia
Posts: 148
 

Default Re: Category images on front page

Quote:
Originally Posted by totaltec
Hi mekon. This is where we keep our code snippets! Agreed it would be nice if they were organized...

Well I mocked up some code for you. Try adding this to /common_files/customer/main/welcome.tpl
PHP Code:
{foreach from=$categories_menu_list item=category name=front_cats}

  <
span class="subcategories" style="min-width: {$subcat_div_width}px; width: {$subcat_div_width}px; min-height: {$subcat_div_height}px;">
    {if 
$category.is_icon}
      <
a href="home.php?cat={$category.categoryid}"><img src="{get_category_image_url category=$category}" alt="{$category.category|escape}width="{$category.image_x}height="{$category.image_y}/></a>
    {else}
      <
img src="{$ImagesDir}/spacer.gif" alt="" width="1" height="{$subcat_img_height}/>
    {/if}
    <
br />
    <
a href="home.php?cat={$category.categoryid}">{$category.category|escape}</a><br />
    {if 
$config.Appearance.count_products eq "Y"}
      {if 
$category.product_count}
        {
$lng.lbl_N_products|substitute:products:$category.product_count}
      {elseif 
$category.subcategory_count}
        {
$lng.lbl_N_categories|substitute:count:$category.subcategory_count}
      {/if}
    {/if}
  </
span>

{/foreach} 

This is a superstar piece of code and I also do not know why it is not standard in x-cart...

I was able to simple drop this code into a static page and voila - there is my category listing!
__________________
X-Cart Gold 4.1.10, 4.1.18, 4.4.4, 4.4.5
Reply With Quote