Jump to content

Categories dropdown menu


Recommended Posts

Hi, i customized blockcategories to show categories in dropdown menu, it shows me but i dont know how to add link to option value from selected categories.. can you help me ?

 

<form action="{$smarty.server.SCRIPT_NAME|escape:'htmlall':'UTF-8'}" method="get">
<select id="kateg">
<p>
<option value="All categories">All categories</option>
{foreach from=$blockCategTree.children item=child name=blockCategTree}
{if $smarty.foreach.blockCategTree.last}
   {include file="$branche_tpl_path" node=$child last='true'}
  {else}
<option value={include file="$branche_tpl_path" node=$child}</option>
  {/if}
 {/foreach}
</p> 
</select>
</form>

 

Thank you

Link to comment
Share on other sites

Hi,

i don't think it's W3C compliant to put something but text/integers as value for the option tag. There is an abvious error in the fifth-last line. Also, even if it was like this

 

 

<option> {include file="$branche_tpl_path" node=$child}</option>

 

Which is the correct way to use option tags, i believe the branch contains html, and you can't do it either on option tags.

 

That cose is all wrong anyway, you can't put p tags inside select boxes :/ Start from scratch, and do something like this:

 

<select id="kateg">
<option value="All categories">All categories</option>
{foreach from=$blockCategTree.children item=child name=blockCategTree}
<option value="{$link->getCategoryLink($child.id_category)}">{$child.name}</option>
{/foreach}
</select>

 

Just a demo, not sure if this will work, or it's referencing the correct variable names. My suggestion is to go back to the html basics, and study tags a bit more in depth :)

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...