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

Need help pulling subcategory descriptions into loop

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-09-2008, 09:18 AM
 
Bobarra_Webmaster Bobarra_Webmaster is offline
 

Newbie
  
Join Date: Nov 2008
Posts: 9
 

Default Need help pulling subcategory descriptions into loop

Hi everyone, I am a newbie to these forums. Hope I follow etiquette correctly.

My issue:

When I'm pulling in data from the database, the data for "Description" doesn't show up. Here is my code:

Code:
{capture name=dialog} {assign var="tmp" value="0"} {foreach from=$subcategories item=c key=catid} {if $c.category}{assign var="tmp" value="1"}{/if} {/foreach} {if $subcategories} <ul id="subcategories"> {foreach from=$subcategories item=subcat} <li> {*{if $tmp and $first_subcat ne "Y"} <td valign="top" rowspan="{count value=$subcategories print="Y"}"><img src="{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}" alt="" /></td> {assign var="first_subcat" value="Y"} {/if}*} <a href="home.php?cat={ $subcat.categoryid }"><img src="{$xcart_web_dir}/image.php?id={$subcat.categoryid}&amp;type=C" alt="" class="p_img" /></a> <p class="subcategory_p_title"><a href="home.php?cat={ $subcat.categoryid }">{ $subcat.category|escape }</a></p> <p class="subcategory_p_desc">{$subcat.description|escape}</p> </li> {/foreach} </ul> {/if}

The "{$subcat.description|escape}" isn't working, though the database is populated in that field. Is there a special way to pull in that data that isn't obvious? The other ones ({$subcat.categoryid}, etc) pull data fine.

I also tried a mod found here (http://forum.x-cart.com/showthread.php?t=384, changing it a bit to make it a <ul>, not changing the data structure though. It doesn't pull any data at all. Here's the code to that mod:

Code:
{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} <ul id="subcategories"> {section name=cat_num loop=$subcategories} <li> <a href="home.php?cat={$subcategories[cat_num].categoryid}"><img src="{$xcart_web_dir}/image.php?id={$subcategories[cat_num].categoryid}&amp;type=C" alt="" class="p_img" /></a> <p class="subcategory_p_title"><a href="home.php?cat={$subcategories[cat_num].categoryid}">{$subcategories[cat_num].category|escape}</a></p> <p class="subcategory_p_desc">{$categories[cat_num].description|escape}</p> </li> {/section} </ul>

Any ideas would be, of course, appreciated.

Thanks
__________________
Version 4.1.10
Reply With Quote
  #2  
Old 12-09-2008, 09:43 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Need help pulling subcategory descriptions into loop

Moving to Template Editing as the Completed Custom Mods forum is for posting Completed Code Only.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 12-09-2008, 09:45 AM
 
Bobarra_Webmaster Bobarra_Webmaster is offline
 

Newbie
  
Join Date: Nov 2008
Posts: 9
 

Default Re: Need help pulling subcategory descriptions into loop

Thanks. Sorry about the miscategorization.
__________________
Version 4.1.10
Reply With Quote
  #4  
Old 05-27-2009, 02:34 PM
  proboscidian's Avatar 
proboscidian proboscidian is offline
 

Senior Member
  
Join Date: May 2005
Location: Clearwater, FL
Posts: 146
 

Default Re: Need help pulling subcategory descriptions into loop

Did you ever get anywhere with this?
__________________
Industrial Webworks
Various xcart versions from 4.1.19 gold - 4.7 gold
http://www.industrialwebworks.net
Reply With Quote
  #5  
Old 08-08-2009, 05:24 PM
  mida68's Avatar 
mida68 mida68 is offline
 

Senior Member
  
Join Date: May 2004
Location: Temecula, CA
Posts: 104
 

Default Re: Need help pulling subcategory descriptions into loop

Just realized we need this as well - why is there a description for the sub categories if they don't show up??
__________________
X-Cart 4.2, 4.3
Web Editors: http://www.webeditors.com
Reply With Quote
  #6  
Old 08-09-2009, 04:47 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: Need help pulling subcategory descriptions into loop

you probably have to add the description field to the query in the corresponding php file.

the data might be in the database, but if it's not selected it won't be in the array sent to the template.

check the php file that calls this template, and look at the query that selects the subcategories,

hth
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
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 03:27 PM.

   

 
X-Cart forums © 2001-2020