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
  #1  
Old 08-02-2003, 04:49 PM
  finestshops's Avatar 
finestshops finestshops is offline
 

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

Default 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

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" }
__________________
Best regards,

Anton Pachkine
finestshops.com/x-cart
Reply With Quote
  #2  
Old 08-02-2003, 04:57 PM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default .

that look good, do you know code if I want to movie subcatagories under the featured products instead of top on it,
Reply With Quote
  #3  
Old 08-02-2003, 05:19 PM
  finestshops's Avatar 
finestshops finestshops is offline
 

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

Default 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} ...
__________________
Best regards,

Anton Pachkine
finestshops.com/x-cart
Reply With Quote
  #4  
Old 08-16-2003, 09:01 AM
 
lizlarry lizlarry is offline
 

Advanced Member
  
Join Date: Jul 2003
Posts: 45
 

Default

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

Liz
Reply With Quote
  #5  
Old 09-15-2003, 12:28 PM
 
toby5482 toby5482 is offline
 

Advanced Member
  
Join Date: Sep 2003
Location: UK
Posts: 34
 

Default

How do you get the subcatergory text to be underneath the icon, rather than to the right hand side?
Reply With Quote
  #6  
Old 09-15-2003, 01:41 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default

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'
Reply With Quote
  #7  
Old 09-15-2003, 07:45 PM
 
dealsondeals dealsondeals is offline
 

eXpert
  
Join Date: Dec 2002
Location: Dallas, Texas, USA
Posts: 231
 

Default

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

Regards,

Glen
__________________
Never understimate stupidity.
--------
X-Cart Version: 3.5.2
Hosting:mind-in-design.net
Configuration: Virtual Dedicated Server || Intel Pentium 4 2.4 GHZ CPU || 1024MB PC2100 DDR RAM || Linux || PHP 4.3.2 || MySQL server 4.0.14
Reply With Quote
  #8  
Old 09-16-2003, 04:13 AM
 
toby5482 toby5482 is offline
 

Advanced Member
  
Join Date: Sep 2003
Location: UK
Posts: 34
 

Default

Thanks for that PhilJ, works a treat.
Reply With Quote
  #9  
Old 10-06-2003, 10:30 PM
 
longseason longseason is offline
 

Newbie
  
Join Date: Sep 2003
Posts: 7
 

Default 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]
Reply With Quote
  #10  
Old 10-08-2003, 11:04 AM
 
rickallen1 rickallen1 is offline
 

Newbie
  
Join Date: Sep 2003
Location: Michigan, USA
Posts: 2
 

Default 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.
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 12:57 PM.

   

 
X-Cart forums © 2001-2020