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)

finestshops 08-02-2003 04:49 PM

Mod for subcategories in columns with descriptions and icons
 
Here is new subcategories.tpl to display subcategories in columns
with descriptions and icons. Example here:
http://www.bitsnspu.finestshops.com/store/customer/home.php?cat=2

Enjoy :wink:

Code:

{* $Id: subcategories.tpl,v 1.29 2002/11/26 14:55:13 alfiya Exp $ *}
{ include file="location.tpl" }
{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=left><a class="alt" href="home.php?cat={ $subcategories[cat_num].categoryid }">
        {$subcategories[cat_num].category|escape}</a>

        { $categories[cat_num].description|escape }
        </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}

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




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

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


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


jeeya 08-02-2003 04:57 PM

.
 
that look good, do you know code if I want to movie subcatagories under the featured products instead of top on it,

finestshops 08-02-2003 05:19 PM

Re: .
 
Quote:

Originally Posted by raxitpatel
if I want to movie subcatagories under the featured products instead of top on it


Just move this code from the end
Code:

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


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


before this one

Code:

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

{section name=cat_num loop=$subcategories}
...


lizlarry 08-16-2003 09:01 AM

Thank you !! I modified this a tiny bit and I have exactly what I need. Woo hoo!!!
:D
Liz

toby5482 09-15-2003 12:28 PM

How do you get the subcatergory text to be underneath the icon, rather than to the right hand side?

PhilJ 09-15-2003 01:41 PM

this is for v3.4.5

Code:

{* $Id: subcategories.tpl,v 1.32 2003/04/24 09:50:33 svowl Exp $ *}
{ include file="location.tpl" }
{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}





{* ==================== Sub categories mod start *}

{section name=cat_num loop=$subcategories}
{ if %cat_num.first% }
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
{/if}
{ if %cat_num.index% is div by 3}
<tr>
{/if}
<td align="center" valign="top">
<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
[img]../icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]



<font size="3">{ $subcategories[cat_num].category|escape }</font>
{if $config.Appearance.count_products eq "Y"}
        {if $subcategories[cat_num].product_count}

        ({ $subcategories[cat_num].product_count } Products)
        {elseif $subcategories[cat_num].subcategory_count}
({ $subcategories[cat_num].subcategory_count } Subcategories)</a>
        {/if}
{/if}

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

{* ==================== Sub categories mod end *}






{if $tmp and $products ne "" }
<br clear=_all><hr size=1 noshade>
{/if}
{include file="customer/main/products.tpl" products=$products}
{if $products eq "" and $tmp eq "0"}
{$lng.txt_no_products_in_cat}
{/if}
{/capture}
{include file="dialog.tpl" title=$current_category.category_name|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" }




specify the number of columns where it says 'div by 3'

dealsondeals 09-15-2003 07:45 PM

:wink: Very Nice! Good job! Definitely one to put in the archive for later use.

Regards,

Glen

toby5482 09-16-2003 04:13 AM

Thanks for that PhilJ, works a treat.

longseason 10-06-2003 10:30 PM

Display works fine but new warning appears
 
I copied over the mod to subcatagories.tpl and the layout works great except now I get a warning-

Warning: Unknown modifier '/' in /x-cart/Smarty-2.5.0/plugins/modifier.regex_replace.php on line 13

Any ideas on how to get rid of it? If I restore the file to default the message goes away. I tried to check the file but don't know enough about php to figure it out. I'm using x-cart 3.4.8, php 4.2.3.

Any help would be great.
thanks.[/b]

rickallen1 10-08-2003 11:04 AM

Same problem here
 
Warning: Unknown modifier '/' in /home/virtual/site42/fst/var/www/html/store/Smarty-2.5.0/plugins/modifier.regex_replace.php on line 13

Note that magic_quotes_gpc is disabled on my server. Do I need to add a couple of escapes someplace?

This is exactly the kind of mod I was looking for. Looks great on the demo site.

Thanks.


All times are GMT -8. The time now is 01:58 AM.

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