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)
-   -   How Can I do this. . . (https://forum.x-cart.com/showthread.php?t=52992)

inkcarts 03-25-2010 05:46 AM

How Can I do this. . .
 
Let's say I have a Category, with X number of subcategories. . .

I'd like to lay them out in 4 columns, instead of reading left to right though, I'd like to lay them out in 4 columns, top to bottom. . Let me see if i can explain that better. . . .


I'd like to count the number of subcategories, then divide by the number of columns.

So, if there are 100 subcategories, and I want them in 4 columns. .

100/4 = 25 in each column

<ul>
then 25 <li>subcat</li>'s
</ul>
<ul>
then 25 more <li>subcat</li>'s
</ul>
<ul>
then 25 more <li>subcat</li>'s
</ul>
<ul>
then 25 more <li>subcat</li>'s
</ul>

Any ideas how I can do this?

Thanks!
Lyn

gizmo 03-25-2010 01:44 PM

Re: How Can I do this. . .
 
They only solution I can give is to create your categories and then manually code it to show your own css driven style categories (Exactly as you want it) I don't think this would be possible with x-carts css, and code...

Maybe there is some one with better knowledge than me though that can help.

gb2world 03-27-2010 02:14 PM

Re: How Can I do this. . .
 
You should be able to do it using smarty or php.

In smarty:
Your subcategories are in this array: $subcategories
number of items in the array: {$subcategories|@count}
You can set smarty variables to determine the subcats per column:
{assign var="subcats_count" value=$subcategories|@count}
{assign var="subcats_per_section" value=$subcats_count/4}

You can create loops in smarty using the variables to get the desired outcome. You can set a variable inside your loop to count where you are, and when you reach the desired subcategory count, you can start a new unordered list.


All times are GMT -8. The time now is 07:11 AM.

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