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 do I get a category name from the categoryid? (https://forum.x-cart.com/showthread.php?t=11518)

amy2203 01-17-2005 12:47 PM

How do I get a category name from the categoryid?
 
I'm trying to create a page where I can see all of a products categories, and change and modify as necessary. I have a copy of the search.php and made the necessary changes so it calls new templates that are solely in the admin area. It is pulling the category ids from the products table, and displaying them at the top of a drop down box with all of the categories in, but when it displays, it is just the category number, as this is what is held in the products table. This is the code I have:

Code:

<td height="10">
<select name="category1">
<option value="{$products[cat_num].categoryid1}">{$products[cat_num].categoryid1}</option>
{section name=cat_options_2 loop=$allcategories}
<option value={$allcategories[cat_options_2].categoryid}>{$allcategories[cat_options_2].category}</option>
{/section}
</select>
</td>


I tried assigning a variable called catid with the value $products[cat_num].categoryid1 and then using
Code:


<option value="{$products[cat_num].categoryid1}">{$categories[catid].category}</option>


but that just displayed nothing, Can anyone tell me how I can display the category name.

Thanks

Amy

amy2203 01-18-2005 01:36 AM

I did it:

Code:

<option value="{$products[cat_num].categoryid}">{$products[cat_num].category}</option>

Why do you always work it out just AFTER you post!!! (Maybe the nights sleep helped though!)

amy2203 01-19-2005 02:47 AM

however it only works with the main category, not cats 1-3,

still working on this


All times are GMT -8. The time now is 09:21 AM.

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