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)
-   -   Mod for subcategories in columns with descriptions and icons (https://forum.x-cart.com/showthread.php?t=3848)

Glowinafuse 02-07-2006 10:02 AM

okay, I need my subcats names to be under the image for 4.0.17... Not sure what I need to do for this version.

Can someone please help me.

thanks in advance,

Glowinafuse 02-09-2006 09:16 AM

here is my code for the subcategories.tpl

please help please!!! I have not found out how to do it...

Code:

{* $Id: subcategories.tpl,v 1.29 2002/11/26 14:55:13 alfiya Exp $ *}
{if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"}



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



{ include file="customer/main/navigation.tpl" }
{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description|regex_replace:"/[\n]/":"
"}

{/if}


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

{section name=cat_num loop=$subcategories}

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

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

  <td valign="top" width="70" align="center">
  <a class="alt" href="home.php?cat={ $subcategories[cat_num].categoryid }">
  [img]icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]
  </a>
  </td>
  <td align=center><a class="alt" href="home.php?cat={ $subcategories[cat_num].categoryid }">
  {$subcategories[cat_num].category|escape}</a>

  { $subcategories[cat_num].description|escape }
{if $config.Appearance.count_products eq "Y"}


<font class=Text>
{if $subcategories[cat_num].product_count}
{ $subcategories[cat_num].product_count } {$lng.lbl_products}
{elseif $subcategories[cat_num].subcategory_count}
{ $subcategories[cat_num].subcategory_count } {$lng.lbl_categories|lower}
{/if}
</font>
{/if}


  </td>

{ if %cat_num.last% }
</tr></table>
{/if}

{/section}
{if $tmp and $products ne "" }
<br clear=_all>{*<hr size=1 noshade>*}
{/if}

{if $products eq "" and $tmp eq "0"}
{$lng.txt_no_products_in_cat}
{/if}




{include file="customer/main/products.tpl" products=$products}

{/capture}
{include file="dialog.tpl" title=$current_category.category|regex_replace:"/.*\//":"" content=$smarty.capture.dialog extra="width=100%"}

{if $products eq ""}
{if $f_products ne ""}



{include file="customer/main/featured.tpl"}
{/if}
{/if}
{ include file="customer/main/navigation.tpl" }


thanks in advance for the help...[/code]

almenzies 02-11-2006 06:16 AM

Subcategory description under link
 
Hi,

I'm trying to add the subcategory descriptions under the subcategory link on the category page, see:

http://www.bubblebathrooms.co.uk/Whirlpool-baths-p-1-c-243.html

Ideally I want the definition of a single ended bath to be next to the image and under the link "single ended baths" but I just can't seem to get the right code - would be most grateful for some guidance.

My current subcategories code is:
(I added the line " $subcategories[cat_num].description|escape}" to no avail:

{* $Id: subcategories.tpl,v 1.43.2.5 2004/12/01 15:15:49 mclap Exp $ *}
{if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"}

{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}
{if $active_modules.Special_Offers and $category_offers}



{include file="modules/Special_Offers/customer/category_offers_short_list.tpl}
{/if}
{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description|regex_replace: "/[\n]/":"
"}

{/if}
{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}
{if $subcategories}
<TABLE width="100%" border="0" cellspacing="5">
{foreach from=$subcategories item=subcat}
<TR>
{* SAFETYNET DSEFU MOD *}
{if $enable_seo_links == "Y"}
<TD align="left" nowrap width="40%">[img]{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_w eb_dir}/icon.php?categoryid={$subcat.categoryid}{/if}[/img]</TD>
<TD width="95%" align="left" valign="middle" nowrap><FONT class="ItemsList">{ $subcat.category|escape }</FONT>

{ $subcategories[cat_num].description|escape} </TD>
{else}
<TD align="left" nowrap width="40%">[img]{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_w eb_dir}/icon.php?categoryid={$subcat.categoryid}{/if}[/img]</TD>
<TD width="95%" align="left" valign="middle" nowrap><FONT class="ItemsList">{ $subcat.category|escape }</FONT>
</TD>
{/if}
{* END SAFETYNET DSEFU MOD *}
<TD width="40%" align="right" nowrap><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>
</TR>
{/foreach}
</TABLE>


{/if}
{if $tmp and $products ne "" }
<BR clear="left">
<HR size="1" 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}


{ include file="customer/main/navigation.tpl" }
{/if}


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



{include file="customer/main/featured.tpl"}
{/if}
{/if}
{ include file="customer/main/navigation.tpl" }

alru111 02-15-2006 08:47 PM

I have too many subcategories to be displayed on one page.
How can subcategories be broken down into several pages with
"ABCDEFGH..." or "Page1 Page2 Page 3..." on top

vikeny 02-22-2006 09:40 PM

A great Thank You to all those that have contributed to this great mod.

Unless I'm mistaken, It looks like the sub-cat icon is being sourced from the db instead of the file system.

Code:

[img]{$xcart_web_dir}/icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]

Will it be possible to change this so that the icon image is sourced from the file system?

alru111 03-03-2006 07:29 AM

change image location in admin area from db to file system

Touchy 03-05-2006 06:49 PM

Limiting the number sub categories displayed per page
 
Hi folks,

I see several people have asked but nobody has answered.

This mod is great but if you have a lot of sub categories, you end up with a huge list, that can take a long time to load.

Is it possible to paginate the display to say 10 sub categories per page.

We have large sub cat descriptions so adding more columns is not an option for us.

I think if this could be made possible this mod would be work for a lot more people.

Anybody Help or confirmation if it can be done would help everyone.

alru111 03-14-2006 08:41 AM

I received a quote from x-cart to make subcategory pagination with a switch in general options.
Email me if you want to split the cost.
forum@cellcorner.com

gargonzo 03-16-2006 08:17 AM

ok here is what i figured out with this "MOD"

Open the CAT you want to work on.. fill in the following fields.. this is so you know which field is which snippet of code below.

category: what you have + TITLE ( this will be the page title )
Description: what you have + DESCRIPTION
push OK/Save

now:

edit subcatagories.tpl
File location: /customer/main/subcategories.tpl

Add the following in your *.TPL

{$current_category.description|escape}

above is same as following:

{$current_category.description|regex_replace:"/[\n]/":""}

to pull in extra keywords or subcat descriptions:

{$subcat.description|escape}

the subcat pulls in descrips from ther subcats as well..

Now paste all that fun stuff into your TPL (subcats) and submit it -- then preview.. you should see everything working.

NOW-- for me to get to this stage.. i had to change the SQL statement as posted further back in this MOD ( page 6 i think ).

Everything is working GREAT.. except on one of my pages i'm getting the above duplicated...will figure it out.. unless someone has a solution.

good luck.

ciao
garz
4.07/php.linux

balinor 06-09-2006 05:19 PM

One of my all time favorite mods, but if you have your images in the filesystem (which is recommended for speed reasons) this mod will continue to pull the images from the db, as it is hard-coded in. To fix this, replace this:

Code:

[img]{$xcart_web_dir}/icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]

with this

Code:

{if $subcategories[cat_num].icon_url}[img]{$subcategories[cat_num].icon_url}[/img]{else}[img]{$xcart_web_dir}/default_icon.gif[/img]{/if}

You'll want to add in a height or width as well, as this will pull the full-sized image without it. You should notice a huge speed improvement on your category pages, particularly if you have a ton of sub-categories. The {if} statement simply shows the default_icon.gif image if there is no sub-category icon present. Enjoy!


All times are GMT -8. The time now is 08:12 AM.

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