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

How do I get a category name from the categoryid?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-17-2005, 12:47 PM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

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

Default 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
__________________
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
  #2  
Old 01-18-2005, 01:36 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

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

Default

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!)
__________________
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
  #3  
Old 01-19-2005, 02:47 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

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

Default

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

still working on this
__________________
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 12:19 AM.

   

 
X-Cart forums © 2001-2020