Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Mod for subcategories in columns with descriptions and icons

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #271  
Old 09-19-2008, 06:30 PM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default Re: Mod for subcategories in columns with descriptions and icons

Hi toddpatterson,

Please try to replace customer/main/subcategories.tpl with this file:

{* $Id: subcategories.tpl,v 1.55.2.1 2006/06/27 08:20:37 svowl Exp $ *}
{if $active_modules.Bestsellers ne "" and $config.Bestsellers.bestsellers_menu ne "Y"}

{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}

{if $active_modules.Special_Offers && $category_offers}
<br /><br />
{include file="modules/Special_Offers/customer/category_offers_short_list.tpl"}
{/if}
{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description}<br /><br />{/if}
{capture name=dialog}
{assign var="tmp" value="0"}
{foreach from=$subcategories item=c key=catid}
{if $c.category}{assign var="tmp" value="1"}{/if}
{/foreach}


{if $subcategories}

{*
<table cellspacing="5" width="100%">
{foreach from=$subcategories item=subcat}
<tr>
{if $tmp and $first_subcat ne "Y"}
<td valign="top" rowspan="{count value=$subcategories print="Y"}"><img src="{if $current_category.icon_url}{$current_category.icon _url}{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}" alt="" /></td>
{assign var="first_subcat" value="Y"}
{/if}
<td class="SubcatTitle"><a href="home.php?cat={ $subcat.categoryid }"><font class="ItemsList">{ $subcat.category|escape }</font></a><br /></td>
<td class="SubcatInfo">{if $config.Appearance.count_products eq "Y"}
{if $subcat.product_count}{ $subcat.product_count } {$lng.lbl_products}
{elseif $subcat.subcategory_count}{ $subcat.subcategory_count } {$lng.lbl_categories|lower}
{/if}
{/if}</td>
</tr>
{/foreach}
</table>
*}

{* subcategories in 4 columns mod by Finestshops.com *}
<table border=0 cellspacing="0" cellspacing="0" width="100%">
{foreach from=$subcategories key=k item=subcat name=subcategories}
{if $smarty.foreach.subcategories.index is div by 4}
</tr><tr valign="top">
{/if}
<td valign="top" width="25%" align="center">

<A href="home.php?cat={ $subcat.categoryid }"><IMG alt="{* $subcat.category|escape *}" border="0" src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_w eb_dir}/icon.php?categoryid={$subcat.categoryid}{/if}"></a>
<br>
<A href="home.php?cat={ $subcat.categoryid }"><FONT class="ItemsList">{ $subcat.category|escape }</FONT></A>
<br>
<FONT class="Text">{if $config.Appearance.count_products eq "Y"}
{if $subcat.product_count}{ $subcat.product_count } {$lng.lbl_products}
{elseif $subcat.subcategory_count}{ $subcat.subcategory_count } {$lng.lbl_categories|lower}
{/if}
{/if}
</FONT>
</td>
{/foreach}
</tr>
</table>
{* subcategories in 4 columns mod by Finestshops.com *}

<table width="100%" cellpadding="5" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<tr>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<td width="{$width}%" class="PListCell">

<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}" class="ProductTitle">{$products[product].product}</a><br />
{if $config.Appearance.display_productcode_in_list eq "Y" and $products[product].productcode ne ""}
{$lng.lbl_sku}: {$products[product].productcode}<br />
{/if}
<table cellpadding="3" cellspacing="0" width="100%">
<tr>
<td height="100" nowrap="nowrap" align="center">{include file="product_thumbnail_cust.tpl" product=$products[product]}</td>
</tr>
</table>
<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}">{$lng.lbl_see_details}</a>
{if $products[product].product_type ne "C"}
<br />
<br />
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $config.General.unlimited_products ne "Y" && ($products[product].avail le 0 or $products[product].avail lt $products[product].min_amount) && $products[product].variantid}
&nbsp;
{elseif $products[product].taxed_price ne 0}
{if $products[product].list_price gt 0 and $products[product].taxed_price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%3.0f" assign=discount}
{if $discount gt 0}
<font class="MarketPrice">{$lng.lbl_market_price}: <s>
{include file="currency.tpl" value=$products[product].list_price}
</s></font><br />
{/if}
{/if}
<font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</font><br /><font class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</font>{if $discount gt 0}{if $config.General.alter_currency_symbol ne ""},{/if} {$lng.lbl_save_price} {$discount}%{/if}
{if $products[product].taxes}<br />{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}{/if}
{if $active_modules.Special_Offers ne "" and $products[product].use_special_price ne ""}
{include file="modules/Special_Offers/customer/product_special_price.tpl" product=$products[product]}
{/if}
{else}
<font class="ProductPrice">{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
{if $active_modules.Feature_Comparison ne '' && $products[product].fclassid > 0}
<div align="center" style="width: 100%; padding-top: 10px;">
{include file="modules/Feature_Comparison/compare_checkbox.tpl" id=$products[product].productid}
</div>
{/if}
{*** Uncomment it if you need 'Buy Now' button ***
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{/if}
*** Uncomment it if you need 'Buy Now' button ***}
{/if}
</td>

{capture name=prod_index}
{math equation="index+x+1" index=%product.index% x=$config.Appearance.products_per_row}
{/capture}
{if $smarty.capture.prod_index is div by $config.Appearance.products_per_row }
</tr>
{/if}

{/section}

{if $cell_counter lt $config.Appearance.products_per_row}
{section name=rest_cells loop=$config.Appearance.products_per_row start=$cell_counter}
<td class="SectionBox">&nbsp;</td>
{/section}
</tr>
{/if}

</table>

{/if}


{if $tmp and $products ne "" }
<br clear="left" />
<hr size="1" noshade="noshade" />
{/if}
{if $products}
{if $sort_fields}
<div align="right">{include file="main/search_sort_by.tpl" sort_fields=$sort_fields selected=$search_prefilled.sort_field direction=$search_prefilled.sort_direction url="home.php?cat=`$cat`&"}</div>
{/if}
{if $total_pages gt 2}
<br />
{ include file="customer/main/navigation.tpl" }
{/if}
<br />
{include file="customer/main/products.tpl" products=$products}
{/if}
{if $products eq "" and $tmp eq "0"}
{$lng.txt_no_products_in_cat}
{/if}
{/capture}
{include file="dialog.tpl" title=$current_category.category content=$smarty.capture.dialog extra='width="100%"'}
{if $products eq ""}
{if $f_products ne ""}
<p />
{include file="customer/main/featured.tpl"}
{/if}
{/if}
{ include file="customer/main/navigation.tpl" }
__________________
Best regards,

Anton Pachkine
finestshops.com/x-cart
Reply With Quote

The following user thanks finestshops for this useful post:
crazyoval (04-14-2009)
  #272  
Old 09-20-2008, 12:37 AM
  toddpatterson's Avatar 
toddpatterson toddpatterson is offline
 

Senior Member
  
Join Date: Aug 2004
Location: Arkansas
Posts: 140
 

Default Re: Mod for subcategories in columns with descriptions and icons

Thanks a million! It looks like that is EXACTLY what I was looking for. I appreciate it!

Todd
__________________
B&T sales
xCart 5 Business
Core Version: 5.3.5
Reply With Quote
  #273  
Old 10-15-2008, 10:11 PM
 
aerogear2000 aerogear2000 is offline
 

Senior Member
  
Join Date: Jul 2007
Posts: 143
 

Default Re: Mod for subcategories in columns with descriptions and icons

Hello I have 4.1.11 which post will show me how to do this mod, post number please
__________________
Runing on Linux server
X-cart 4.1.8 GOLD
Reply With Quote
  #274  
Old 10-16-2008, 11:58 AM
 
barryb12000 barryb12000 is offline
 

Member
  
Join Date: Sep 2008
Posts: 13
 

Default Re: Mod for subcategories in columns with descriptions and icons

I used #271 and it worked for me just fine
__________________
BarryB
X-Cart Gold 4.1.11
Reply With Quote

The following user thanks barryb12000 for this useful post:
crazyoval (04-14-2009)
  #275  
Old 10-20-2008, 05:07 PM
 
gotpump gotpump is offline
 

eXpert
  
Join Date: Aug 2008
Posts: 272
 

Default Re: Mod for subcategories in columns with descriptions and icons

Great mod. Anyway to remove the product list from the main page though?

Shows all my categories on my welcome page but also is including product images with price. Any way to get rid of this?
__________________
X-Cart DB Version: 5
Reply With Quote
  #276  
Old 11-30-2008, 05:49 AM
  altairastro's Avatar 
altairastro altairastro is offline
 

Newbie
  
Join Date: Nov 2008
Posts: 9
 

Default Re: Mod for subcategories in columns with descriptions and icons

Hi Guys I tried the code in post #271 which had some interesting effects

- displays the category thumbnail and a header link
- unfortunately it doesn't show the category description text
- it seems to have swapped sides with the lefthand navigation which has jumped to the righthand side of the page...

looks like I need to make some changes any ideas?

Nick
__________________
Nick

X-Cart 4.1.11 (just installed)

www.altairastro.com
Reply With Quote
  #277  
Old 12-09-2008, 09:44 AM
 
Bobarra_Webmaster Bobarra_Webmaster is offline
 

Newbie
  
Join Date: Nov 2008
Posts: 9
 

Default Re: Mod for subcategories in columns with descriptions and icons

Hi, I tried using this mod. I liked the way you were pulling in information. I changed it a bit to make a <ul> instead, but there is something wrong. It's not pulling any data from the database. The loop works fine, all the HTML gets populated, but wherever the data should appear, the HTML is blank. Is there a reason why this wouldn't pull in data for me? Maybe the version?

Below is the code, thanks very much to anyone who considers this small issue.

Code:
{capture name=dialog} {assign var="tmp" value="0"} {section name=cat_num loop=$subcategories} {if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if} {/section} <ul id="subcategories"> {section name=cat_num loop=$subcategories} <li> <a href="home.php?cat={$subcategories[cat_num].categoryid}"><img src="{$xcart_web_dir}/image.php?id={$subcategories[cat_num].categoryid}&amp;type=C" alt="" class="p_img" /></a> <p class="subcategory_p_title"><a href="home.php?cat={$subcategories[cat_num].categoryid}">{$subcategories[cat_num].category|escape}</a></p> <p class="subcategory_p_desc">{$categories[cat_num].description|escape}</p> </li> {/section} </ul>
__________________
Version 4.1.10
Reply With Quote
  #278  
Old 12-17-2008, 11:17 AM
  davidsaldana's Avatar 
davidsaldana davidsaldana is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 187
 

Default Re: Mod for subcategories in columns with descriptions and icons

this is a great mod. Looking for a modified version, which would read as follows:

CategoryA (Image)
CategoryA (title)
SubcategoryA (title)
SubcategoryB (title)
SubcategoryC (title)

Does anyone know how to modify the code to do that???
__________________
4.4
Code:
Hello World
Reply With Quote
  #279  
Old 01-21-2009, 07:46 PM
 
hyper1 hyper1 is offline
 

Advanced Member
  
Join Date: Jun 2008
Posts: 52
 

Default Re: Mod for subcategories in columns with descriptions and icons

I am using the code from post #271 to display my subcategories using version 4.1.10, although I changed the code to only display one category image and title per row. I have read and re-read this post over and over and I cannot find code that will work in v4.1.10 that allows for the inclusion of the category description within the row. When complete, I would like to display the category image on the left, then the category title to the right of the image and the category description below the category description. Would someone please help me understand how to add the additional code to the template(s) in v4.1.10?

Thank you so much in advance,
__________________
Tim
x-cart pro 4.1.11, x-AOM, CDSEO, css layout - no tables (almost), free social bookmarking mod (xcartmod.co.uk - thanks), altered cart On Sale, One Page Checkout and Smart Search (all amazing products), Custom Code from CFL (the best), Hands-On Hosting for live site
Reply With Quote
  #280  
Old 01-22-2009, 05:05 AM
 
GiZ GiZ is offline
 

Member
  
Join Date: Oct 2007
Posts: 11
 

Default Re: Mod for subcategories in columns with descriptions and icons

I moved the code for the css to the skin1_c.css and this worked.
__________________
X-Cart version - 4.1.8
PHP - 5.24
MySQL server version 5.0.45
Web server - Apache/2.2.6 (FreeBSD) mod_ssl/2.2.6 OpenSSL/0.9.7e-p1 PHP/5.2.4 with Suhosin-Patch
O.S. - FreeBSD 6.2-RELEASE
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

   

 
X-Cart forums © 2001-2020