View Single Post
  #5  
Old 02-14-2015, 06:54 AM
 
ScrapOrchard ScrapOrchard is offline
 

eXpert
  
Join Date: Mar 2008
Posts: 243
 

Question Re: Find current subcategories siblings?

I have made a little progress on this. But I am still not getting the data I need

I am not just familiar with how xCart works and how to store/access data.

Any help would be greatly appreciated.

And a very special thank you to cherie, for getting me this far. I did not want to keep bothering cherie, which is why I am posting in this thread.

To recap, I need to build an array, something like this where parentid:

PHP Code:
$subCats = array ( 
                  
"parentid"  => array (  
                                       
"subid" => "Category Name",  
                                       
"subid" => "Category Name",  
                                       
"subid" => "Category Name" 
                                       
), 
                  
"parentid"  => array (  
                                       
"subid" => "Category Name",  
                                       
"subid" => "Category Name",  
                                       
"subid" => "Category Name" 
                                       
), 
                  
"parentid"  => array (  
                                       
"subid" => "Category Name",  
                                       
"subid" => "Category Name",  
                                       
"subid" => "Category Name" 
                                       
), 
                  
"parentid"  => array (  
                                       
"subid" => "Category Name",  
                                       
"subid" => "Category Name",  
                                       
"subid" => "Category Name" 
                                       

                  ); 

The I need to retrieve and loop the array data based on $current_category.parentid.


What I current have, returns all the category names of all the subcategories but I can't figure out how to build the array correctly.


include/common.php
PHP Code:
$catResults "SELECT categoryid,category,parentid FROM $sql_tbl[categories] WHERE parentid!='0' AND avail='Y'";
$subCats func_query_hash($catResults,'parentid',false,true); 
$smarty->assign('subCats',$subCats); 

skin/<theme>/customer/main/subcategories.tpl
Code:
{foreach from=$subCats key=pid item=i} {$pid}: {$i.category} {/foreach}
__________________
www.scraporchard.com
X-Cart Pro Version 4.5.5

Altered Cart: One Page Checkout, OnSale, Buy Together, Download Expander, Smart Search, Shop by Filters
Gahela: Gahela Support System
The xCart Store: xBanners, xAccess, xMenus
Reply With Quote