X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Modifying sub-category table (https://forum.x-cart.com/showthread.php?t=1117)

devineone 01-06-2003 05:07 AM

Modifying sub-category table
 
I am trying to modify the sub categories. Currently they are listed in one single column. However I have more than 15 different product lines in the sub category. Is it possible to make them line up in separate columns so that there is not so much wasted space. The pictures start too low down on the page with one column of categories. Maybe 4 columns of 4 different product lines. Any help would be appreciated.


Thanks
Cory

Ventrue 01-08-2003 07:10 PM

I have my Subs in two columns
 
I looked through the Smarty Code website and figured out how to get mine into two columns, I am sure you can easily do four with some modifications.

Here is the code for Two Columns
Code:

<table width=100%>
<TR>
<TD width=100%>
<table border=0 cellspacing=5 width=100%>
<TR>
<TD colspan=3><Center><U>Shop by Category</U>
</TD>
</TR>
<TR>
<td align=left valign=top width=50%>
{section name=cat_num loop=$subcategories max=4}

<font size=2>{ $subcategories[cat_num].category|escape }</font>


{ if %cat_num.last% }

{/if}
{/section}
</td>
<TD width=1 bgcolor=#B10304></TD>
<td align=left valign=top width=50%>
{section name=cat_num loop=$subcategories start=4}

<font size=2>{ $subcategories[cat_num].category|escape }</font>


{/section}
</TD>
</tr>
<TR>
<TD colspan=3 height=1 bgcolor=#B10304></TD>
</TR>
</table>

The Key is this "start=4}" You would put that at each place you would like it to start a new column.

So for example in column one you would have the code with the "max=4}" which means only 4 products per line. on the next column you would put "{section name=cat_num loop=$subcategories start=4}" this starts the second column on the fifth product and continues on till the 8th product. On the third line you would put "{section name=cat_num loop=$subcategories start=8}" and this would start that line on the 9th product and so on and so on. Though the Key here is the <table> code like in my example, that code is what allows it to show up as 4 columns.

Good Luck, If you need more help let me know.


[/code]

B00MER 01-08-2003 08:12 PM

You could also use is div by.

devineone 01-13-2003 07:23 AM

How would you use the "DIV by" to make your subcategories appear in columns?

B00MER 01-13-2003 09:11 AM

Code:

<table border="0" cellspacing="5" cellpadding="0" width="100%"><Tr>

{section name=product loop=$f_products}

{if $smarty.section.product.index is div by 3}
  </tr><tr align="center" valign="top">
{/if}

{* Product stuff here *}

</td></tr></table>

{/section}


This is how I did it with the product listing same scenerio with the category list. ;)

devineone 01-13-2003 10:01 AM

Boomer, Hate to do this but can't get it without a parse error. When I follow the example code you gave, it ain't working. What would I be doing wrong?


This is the code that I am using:

Code:

{* $Id: subcategories.tpl,v 1.21 2002/09/10 12:36:34 zorg Exp $ *}
{ include file="location.tpl" }
{ include file="customer/main/navigation.tpl" }

<p align="center">
{if ($page eq "")||($page eq "1")}{$current_category.description|regex_replace:"/

[\n]/":"
"}

{/if}
<p align="center">{capture name=dialog}
{if $subcategories}
[img]../icon.php?categoryid={$cat}[/img]
{/if}
</p>
{if $current_category.categoryid eq 282}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="F8F9F9"><div align="left">[img]http://www.oceansbridge.com/img/monet-bio-intro1.gif[/img]</div></td>
  </tr>
  <tr>
    <td bgcolor="F8F9F9"></td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="1"

bgcolor="375d7e">
        <tr> </tr>
      </table>
      <hr noshade></td>
  </tr>
</table>
{elseif $current_category.categoryid eq 123}
{include file="file_with_code2.txt"}
{else}
{section name=cat_num loop=$subcategories}
{ if %cat_num.first% }
{/if}
<table border=0 cellspacing=5 width=95%>

{section name=subcat loop=$subcategories}

{if $smarty.section.subcat.index is div by 3}
  </tr><tr align="center" valign="top">
{/if}

<a href="home.php?cat={ $subcategories[cat_num].categoryid }"><font

class="TableCenterSubCategoryListTitleBlue">{

$subcategories[cat_num].category|escape }</font></a>
 
</td>
<td align=right nowrap><font class="TableCenterSubCategoryListQuantityBlue">{

$subcategories[cat_num].product_count } {$lng.lbl_products}</font></td>
</tr>
{ if %cat_num.last% }
</table>
{/if}
{/section}

{/if}

{if $subcategories ne "" and $products ne ""}
<hr size=1 noshade>
{/if}
{include file="customer/main/products.tpl" products=$products}
{if $products eq "" and $subcategories eq ""}
{$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%"}
{if $products eq ""}
{if $f_products ne ""}


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


B00MER 01-13-2003 11:48 AM

Just updated your post, try that. :wink:

devineone 01-13-2003 05:28 PM

Thanks,

But running into the same problem. Not sure what it is.

Parse error: parse error in /usr/local/plesk/apache/vhosts/oceansbridge.com/httpdocs/cart/templates_c/%%103/%%1035601712/subcategories.tpl.php on line 129


Cory

chawla@moviesandgamesonli 05-10-2003 02:46 AM

I get the same parse error, when i tried the above code, has anyone found out how to do this without the error?

jeffseo 05-12-2003 08:49 AM

It lokd great but where can I do this?
I mean what .tpl file or .php file ?
Where should I start from?


All times are GMT -8. The time now is 05:15 PM.

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