Skip to main content

Setting up a better looking filter module

More
13 years 6 months ago #97431 by PeterChain
Having an horizontal "Top content area" filter modules with about 7-10 filters to put I want to get the aligned so to avoid chaotic looking.

How should I invoke trough PHP each filter to put them inside a table cell?

for example, I have a filter named "AlturaElevacion", what would be the code to get it inside a cell?

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #97493 by Xavier
Hi,

The view to edit is "product / filter" in Display < Views. It will change too the filters displayed on top of a product listing.
It require PHP knowledges.

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #97505 by PeterChain
Thanks.

I'm not an advanced PHP coder but I'm used at tweaking view files.

Now the filters get rendered through a foreach loop that picks them one by one. I simply would like to know how to replace this foreach system for a custom made one where I have to name each filter one by one. This way I can put them exactly where I want.

My question is:

How is written the basic piece of code in a view that would render a filter named "AltureElevacion"

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #97567 by nicolas
Hi,

The filters are not displayed with a foreach on that view file.

They are displayed like that:
Code:
while($count<$this->maxFilter+1){ $height=''; if(!empty($filters[$count]->filter_height)){ $height='height:'.$filters[$count]->filter_height.'px;'; }else if(!empty($this->heightConfig)){ $height='height:'.$this->heightConfig.'px;'; } if(!empty($html[$count])){ ?> <div class="hikashop_filter_main hikashop_filter_main_<?php echo $filters[$count]->filter_namekey; ?>" style="<?php echo $height; ?> float:left; width:<?php echo $widthPercent*$filters[$count]->filter_options['column_width']?>%;" > <?php //echo $this->filterClass->displayFilter($this->filters[$count], $this->params->get('main_div_name'), $this); echo '<div class="hikashop_filter_'.$filters[$count]->filter_namekey.'">'.$html[$count].'</div>'; ?> </div> <?php } $count++; }

So all the filters are stored in the $html array.

If you want to display a specific filter only you can do like that:
Code:
foreach($html as $h){ if(strpos($h,'AltureElevacion')) echo $h; }

Please Log in or Create an account to join the conversation.

Time to create page: 0.152 seconds
Powered by Kunena Forum