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)
-   -   Need help pulling subcategory descriptions into loop (https://forum.x-cart.com/showthread.php?t=44139)

Bobarra_Webmaster 12-09-2008 09:18 AM

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=3848), 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

balinor 12-09-2008 09:43 AM

Re: Need help pulling subcategory descriptions into loop
 
Moving to Template Editing as the Completed Custom Mods forum is for posting Completed Code Only.

Bobarra_Webmaster 12-09-2008 09:45 AM

Re: Need help pulling subcategory descriptions into loop
 
Thanks. Sorry about the miscategorization.

proboscidian 05-27-2009 02:34 PM

Re: Need help pulling subcategory descriptions into loop
 
Did you ever get anywhere with this?

mida68 08-08-2009 05:24 PM

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??

amy2203 08-09-2009 04:47 AM

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


All times are GMT -8. The time now is 02:18 AM.

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