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

Simple dropdown loop to show subcategories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-23-2009, 03:09 PM
 
Sunbreaks Sunbreaks is offline
 

Newbie
  
Join Date: Jun 2008
Posts: 5
 

Question Simple dropdown loop to show subcategories

Hi there,

I'd like to have some very simple dropdown menus, but I'm stuck. So far the dropdowns are being created correctly, but I can't get them to list the subcategories as the options. Here's my code:

Code:
{capture name=menu} <form name="side_searchform" action="saunders_search.php?cat={$catid}" method="post"> <table cellpadding="4" cellspacing="1"> {foreach from=$subcategories item=c key=catid} {if $c.category} {assign var="tmp" value="1"} {/if} <tr><td> <select name="{$c.category}"> {if $subcategories} {foreach from=$subcategories item=subcat} {if $tmp and $first_subcat ne "Y"} {assign var="first_subcat" value="Y"} {/if} <option value="{ $subcat.category|escape }">{ $subcat.category|escape } {/foreach} {/if} </select> <input type=submit value="GO"> </td></tr> {/foreach} </table> </form> {/capture} { include file="saunders_menu.tpl" menu_content=$smarty.capture.menu}

And here's what it looks like:
http://forum.x-cart.com/attachment.php?attachmentid=1598&stc=1&d=124839039 5
As you can see, the dropdown options are exactly the same as the main categories, rather than listing the subcategories.

Can someone please tell me how to get the option values to get down into my subcategories?

Thanks very much!
Sunbreaks
Attached Thumbnails
Click image for larger version

Name:	Picture 4.png
Views:	230
Size:	18.2 KB
ID:	1598  
__________________
4.1.10
Reply With Quote
  #2  
Old 07-27-2009, 12:15 PM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Simple dropdown loop to show subcategories

Do you want to dispay subcategories of the current category or All the categories of your store?
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #3  
Old 07-28-2009, 08:37 PM
 
Sunbreaks Sunbreaks is offline
 

Newbie
  
Join Date: Jun 2008
Posts: 5
 

Default Re: Simple dropdown loop to show subcategories

It is correctly showing the main categories as the select, but then I need it to show the subcategories of each in the option area of the drop down menu. Does that make sense?
__________________
4.1.10
Reply With Quote
  #4  
Old 08-01-2009, 02:19 PM
 
Sunbreaks Sunbreaks is offline
 

Newbie
  
Join Date: Jun 2008
Posts: 5
 

Default Re: Simple dropdown loop to show subcategories

Hi there - still waiting to hear if anyone has a suggestion on this. Anyone?

Thanks,
Sunbreaks
__________________
4.1.10
Reply With Quote
  #5  
Old 08-04-2009, 06:34 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Simple dropdown loop to show subcategories

$subcategories is actually the subcategories of the current category, try $all_categories instead
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #6  
Old 08-07-2009, 05:34 PM
 
Sunbreaks Sunbreaks is offline
 

Newbie
  
Join Date: Jun 2008
Posts: 5
 

Default Re: Simple dropdown loop to show subcategories

Thank you so much for the reply! I tried substituting $all_categories but I don't know exactly how to insert it in my code. Right now when I try using it nothing shows up. Of course this is harder because I want all categories and their subcategories to show on all pages, including the search results page. Can you offer any more advice?

Thanks again,
Sunbreaks
__________________
4.1.10
Reply With Quote
  #7  
Old 08-08-2009, 04:44 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Simple dropdown loop to show subcategories

I think you will need to add some code to the php in order to get this accomplished.
__________________
xcart 5.1.2
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:19 PM.

   

 
X-Cart forums © 2001-2020