nightmaar Posted September 28, 2011 Report Share Posted September 28, 2011 Переделываю фильтры из текстовых в выпадающий список.Внешне выглядит как надо, но не работает правильно.При выборе опции переходит перенаправление по адресу вида: http://адрес-сайта.ру/опция-фильтраГде я допустил ошибку?Код:<!-- Фильтр по свойствам /-->{if $properties}<div id="dropdownfilter"><table> {foreach name=properties item=property from=$properties} {assign var=property_id value=$property->property_id} <tr> <td>{$property->name}:</td> <td> <select onchange="document.location.href=this.options[this.selectedIndex].value"> {if $smarty.get.$property_id} <option> <a href='catalog/{$category->url}{$property->clear_url}'>все</a> </option> {else}<option checked>все</option> {/if} {foreach name=options from=$property->options item=option} {if $smarty.get.$property_id == $option->value} <option>{$option->value}</option> {else} <option><a href='catalog/{$category->url}{if $brand}/{$brand->url}{/if}{$option->url}'>{$option->value}</a></option> {/if} {/foreach} </select> </td> </tr> {/foreach} </table></div>{/if}<!-- Фильтр по свойствам #End /--> Quote Link to post Share on other sites
Kosjak76 Posted September 28, 2011 Report Share Posted September 28, 2011 А так не пробовал:{$option->value}У тебя value нигде не указано... Quote Link to post Share on other sites
nightmaar Posted September 29, 2011 Author Report Share Posted September 29, 2011 Kosjak76, спасибо за помощь!Фильтр теперь работает как надо.Конечный вид:<!--Фильтр по свойствам /-->{if $properties}<div id="dropdownfilter"><table> {foreach name=properties item=property from=$properties} {assign var=property_id value=$property->property_id} <tr> <td>{$property->name}:</td> <td> <select onchange="document.location.href=this.options[this.selectedIndex].value"> {if $smarty.get.$property_id} <option value="catalog/{$category->url}{$property->clear_url}"><a href='catalog/{$category->url}{$property->clear_url}'>все</a></option> {else}<option value="catalog/{$category->url}{$property->clear_url}">все</option>{/if} {foreach name=options from=$property->options item=option} {if $smarty.get.$property_id == $option->value} <option selected>{$option->value}</option> {else} <option value="http://{$root_url}/catalog/{$category->url}{if $brand}/{$brand->url}{/if}{$option->url}">{$option->value}</option> {/if} {/foreach} </select> </td> </tr> {/foreach} </table></div>{/if}<!-- Фильтр по свойствам #End /--> Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.