You are here:  » Horizontal Filters


Horizontal Filters

Submitted by allanch on Tue, 2016-03-15 10:36 in

Hi David,

I hope you've been well! Can you tell me if its possible to have a horizontal layout for search result filters like you do for the non-Wordpress version of PT. I tried inserting the code for the Search Filters Widget in the Search Results Banner textarea but it came out a bit funny. Is it possible to do it without using a widget?

Also I read a while ago of a possible update to PT for Wordpress, is there any update on this?

Thanks for your help!

Submitted by support on Tue, 2016-03-15 13:59

Hello Allan,

Sure - first of all update the Main / Search Filters Widget template so that the markup is appropriate for a horizontal display. The easiest way of course is using a table, but if your WordPress theme is based around a responsive grid it may be more appropriate to use that. A simple table based version would be as follows:

<form method='GET' action='%ACTION%'>
<input type='hidden' name='pto_q' value='%PTO_Q%' />
<table>
<tr>
%IF_MERCHANTS%
<td>
Merchant:<br />
<select name='pto_merchantFilter'>
  <option value=''>All</option>
  %MERCHANTS%
</select>
</td>
%ENDIF_MERCHANTS%
%IF_CATEGORIES%
<td>
Category:<br />
<select name='pto_categoryFilter'>
  <option value=''>All</option>
  %CATEGORIES%
</select>
</td>
%ENDIF_CATEGORIES%
%IF_BRANDS%
<td>
Brand:<br />
<select name='pto_brandFilter'>
  <option value=''>All</option>
  %BRANDS%
</select>
</td>
%ENDIF_BRANDS%
<td>
Price:<br />
%PTO_CURR%<input type='text' class='pto_search_filters_widget_price' name='pto_minPrice' value='%PTO_MINPRICE%' />
to
%PTO_CURR%<input type='text' class='pto_search_filters_widget_price' name='pto_maxPrice' value='%PTO_MAXPRICE%' />
</td>
<td>
<input type='submit' value='Apply' />
</td>
</tr>
</table>
</form>

Then edit the plugin file pto/pto_search.php and look for the following code at line 504:

  $html .= $pto_html_search_before;

...and REPLACE with:

  $html .= pto_search_filters_html();
  $html .= $pto_html_search_before;

The filters will then display between the banner area and top of the results - no need to add a widget.

I decided to put the update including import functionality on hold pending the current release of WordPress which is quite a significant upgrade so I am now going to baseline the next distribution against that and will re-release into beta shortly.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by allanch on Tue, 2016-03-15 21:23

Thanks David, all works perfectly!

Submitted by allanch on Thu, 2016-03-17 13:33

Hi David,

One thing I just noticed is for related products the price filters show up for this. Can you advise of the best way of removing this if possible? Thanks.

Allan

Submitted by support on Thu, 2016-03-17 13:38

Hi Allam,

Ah yes - no problem, use the following replacement instead;

  global $pto_product;
  if (!$pto_product) $html .= pto_search_filters_html();
  $html .= $pto_html_search_before;

That will suppress the filter HTML if search results code is being used for Related Products.

Cheers,
David.
--
PriceTapestry.com

Submitted by allanch on Thu, 2016-03-17 13:59

Thanks for the quick response! That's all good and working!