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

HTML select option box for root and sub caregories problem

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-22-2010, 08:32 AM
 
Jeremy Smith Jeremy Smith is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 167
 

Question HTML select option box for root and sub caregories problem

I am having real problems understanding how to do this.

It make sense in my head but it just is not working, can someone help?

Right here's the code I have used:

Code:
<div id="printerSearchMiddle"> {* $Id: categories.tpl,v 1.26.2.4 2008/07/22 07:58:28 ferz Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {assign var="fc_cellpadding" value="0"} {else} {if $config.General.root_categories eq "Y"} <form name="catForm">Manufacturer: <select onChange="document.catForm.submit()"> {foreach from=$categories item=c} <option value="{$c.categoryid}" {if $current_category eq {$c.categoryid}selected{/if}> {$c.category} </option> {/foreach} </select> Model: <select onChange="document.catForm.submit()"> {foreach from=$subcategories item=c key=catid} <option value="home.php?cat={$catid}">{$c.category}</option> {/foreach} </select> </form> {else} {/if} {/if} {/capture} { include file="menuDropDown.tpl" menu_content=$smarty.capture.menu } </div>

What I basically want it to do, is the user selects say:

category1 (a root category)

All the sub categories for this root category display (of course the root category still being visible)

But then what I want it to do, when the sub category is selected and the customer is able to view all products within that sub category.

The root category is still selected and can view all sub categories within that root if you like.

How can I amend my above code to reflect this need?

Just looks rather confusing to the user at the moment and its really starting to annoy me, should work, probably just something I have missed out or forgotten about.

Any help is wonderfully appreciated,
Jeremy.
__________________
Version 4.1.11 on Linux (Fedora)
X-Cart Gold
Reply With Quote
  #2  
Old 09-23-2010, 03:51 AM
 
Jeremy Smith Jeremy Smith is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 167
 

Default Re: HTML select option box for root and sub caregories problem

Ive finally got it:

Quote:
{* $Id: categories.tpl,v 1.26.2.4 2008/07/22 07:58:28 ferz Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{assign var="fc_cellpadding" value="0"}
{else}
{if $config.General.root_categories eq "Y"}


{* <form name="catForm">Manufacturer:
<select name="rootCat" onChange="window.location=document.catForm.rootCat .options[document.catForm.rootCat.selectedIndex].value">



<option value="">Please select: </option>

{foreach from=$categories item=c}

<option value="home.php?cat={$c.categoryid}">{$c.category} </option>

{/foreach}

</select>

Model:

<select id="subCat" name="subCat">

<option value="#"></option>

{foreach from=$subcategories item=c key=catid}
<option value="home.php?cat={$catid}">{$c.category}</option>
{/foreach}

</select>

<input type="button" name="go" value="Select" onClick="window.location=document.catForm.subCat.o ptions[document.catForm.subCat.selectedIndex].value">

</form> *}



<form method="get" action="home.php">
Manufacturer:
<select name="cat" onchange="this.form.submit()">
<option value="0"{if $cat eq "0"} selected{/if}>Select Manufacturer...</option>
{foreach from=$categories item=c}
<option value="{$c.categoryid}"{if $cat eq $c.categoryid} selected{/if}>{$c.category}</option>
{/foreach}
</select>

Please select:
<select name="subcat" onchange="this.form.submit()">
<option value="0"{if $cat eq "0"} selected{/if}>Printers...</option>
{foreach from=$subcategories item=c key=catid}
<option value="{$catid}"{if $cat eq $catid} selected{/if}>{$c.category}</option>
{/foreach}
</select>
</form>

{else}

{/if}
{/if}
{/capture}
{ include file="menuDropDown.tpl" menu_content=$smarty.capture.menu }
</div>
<div id="printerSearchBottom"></div>

As far as I am concerned this is now closed as an issue.

Thanks,
Jeremy
__________________
Version 4.1.11 on Linux (Fedora)
X-Cart Gold
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:15 AM.

   

 
X-Cart forums © 2001-2020