Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Declaring a Category for Subcategories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-05-2009, 11:23 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Declaring a Category for Subcategories

Simply put. In the front page of the site I have a "Foreach" pulling from the Categories Array.

Each Category is coming out just fine, with descriptions and pictures and everything.

But I'm trying to get the Subcategories to show up for EACH category.

Unfortunately, whenever I try to use the syntax for Subcategories [$subcategories] it just pulls up the categories all over again. Image Included.

http://frozeninksecret.com/tmp/cat.jpg

Code:
{foreach from=$categories item=cat} <div class="bot_products"> <a class="bot_products_img" href="home.php?cat={ $cat.categoryid }"><img src="{$xcart_web_dir}/image.php?id={ $cat.categoryid }&amp;type=C" alt="" /></a> <a class="bot_products_txt" href="home.php?cat={ $cat.categoryid }"><b>{ $cat.category }</b></a> <br /><br /> <div style="OVERFLOW: hidden; HEIGHT: 72px; font-size:12px"> {foreach from=$subcategories item=subcat} <a href="home.php?cat={ $subcat.categoryid }">{ $subcat.category|escape }</a><br /> {/foreach} </div> </div> {/foreach}

This is the section of the code it involves. In skin1/customer/homelist.tpl

Is there anyway you can load the subcategories within a category for a FOREACH array?
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
  #2  
Old 10-07-2009, 04:44 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Re: Declaring a Category for Subcategories

A bump
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
  #3  
Old 10-08-2009, 05:34 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Re: Declaring a Category for Subcategories

I've narrowed down another example of what I could use. This modification that's used on our site takes seven categories and lists their subcategories as well.
I want to modify it so that it can be used to display the subcategories in the new modification.

I've narrowed the code down to this in Include/Categories.php

Code:
$botcat_items = array(); $botcat_subcats = array(); $tmp = func_query('SELECT xcart_topmenu.*, xcart_categories.category FROM xcart_topmenu LEFT JOIN xcart_categories USING(categoryid) WHERE 1 ORDER BY position ASC'); foreach($tmp as $item) { $botcat_items[$item['position']] = array('id' => $item['categoryid'], 'name' => $item['category']); $t = func_query('SELECT categoryid, category FROM xcart_categories WHERE avail = "Y" AND parentid = ' . $item['categoryid'] . ' ORDER BY order_by ASC'); $botcat_subcats[$item['categoryid']] = $t; } $smarty->assign("botcat_items", $botcat_items); $smarty->assign("botcat_subcats", $botcat_subcats);

I'm wondering. Is there a way to use func_query to get all the categories from the SQL database?

Is there any reference on how to use func_query, because I went to Smarty's website and looked at the website and didn't find a way to use the function.

-_- please help?
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
  #4  
Old 10-09-2009, 08:47 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Re: Declaring a Category for Subcategories

Bump
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 07:55 AM.

   

 
X-Cart forums © 2001-2020