Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#73 2012-08-02 19:44:05

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: etc_query: all things Textpattern

Yay! just wait few minutes.

Offline

#74 2012-08-02 19:57:40

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: etc_query: all things Textpattern

Very cool. Looking forward to seeing it.

Offline

#75 2012-08-02 20:01:19

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: etc_query: all things Textpattern

Let’s try this:

  1. re-download the latest etc_query
  2. change your inputs like this (note the brackets after Features):
<INPUT NAME="Features[]" TYPE="CHECKBOX" <txp:if_variable name="Features" value="XMRadio">selected</txp:if_variable>value="XMRadio">XMRadio<BR>
<INPUT NAME="Features[]" TYPE="CHECKBOX" <txp:if_variable name="Features" value="Moon Roof">selected</txp:if_variable>value="Moon Roof">Moon Roof<BR>

Don’t pass Features through adi_gps, but (without linebreaks)

<txp:variable name="Features"><txp:etc_query globals="_GET" data="{?Features||doarray($,htmlspecialchars).implode(|,$)}" markup="raw" argsep="," /></txp:variable>

Then do as before

<txp:etc_query globals="variable" data="{?Model}{?Color}{?Price}{?Features}">
  <txp:article_custom
    {$?({?Model}|Model='<txp:variable name="Model" />'|)}
    {$?({?Color}|Color='<txp:variable name="Color" />'|)}
    {$?({?Price}|Price='<txp:variable name="Price" />'|)}
    {$?({?Features}|Features='<txp:variable name="Features" />'|)}
  />
<txp:else />
  <txp:article />
</txp:etc_query>

Offline

#76 2012-08-02 20:26:07

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: etc_query: all things Textpattern

Ok. Definitely moving in the right direction :)

Now what happens — if I select XMRadio and Moon Roof it returns the articles that have both of them selected in the features field but ONLY those two items can be selected. If another item is also checked, it will not return that article even though it has those two also checked.

FYI, it does appear to be working with a combination of both pull downs and check boxes but for the above issue.

Offline

#77 2012-08-02 20:33:10

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: etc_query: all things Textpattern

Ok, replace

<txp:variable name="Features"><txp:etc_query globals="_GET" data="{?Features||doarray($,htmlspecialchars).implode(|,$)}" markup="raw" argsep="," /></txp:variable>

by

<txp:variable name="Features"><txp:etc_query globals="_GET" data="%{?Features||doarray($,htmlspecialchars).implode(%,$)}%" markup="raw" argsep="," /></txp:variable>

Offline

#78 2012-08-02 20:46:25

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: etc_query: all things Textpattern

SUCCESS!

Everything appears to be functioning as expected. Thank you for all of your assistance. I truly appreciate your time and efforts. If you do not mind, so that hopefully what has been done can be used by others — I had planned on creating a “How To” thread so that others will have a road map shhould they also need the ability to filter articles using drop downs and multi-selects —- and also know your skills …

Let me know if you have any type of Amazon Wish List to send something your way —-

progre55

Offline

#79 2012-08-02 21:13:46

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: etc_query: all things Textpattern

Fine! You have helped me in debugging etc_query, so I am rewarded, thank you. Feel free to share, that’s the txp essence.

You may have problems with apostrophized Features like rock'n'roll, then remove doarray($,htmlspecialchars)., it should be safe.

Offline

#80 2012-08-02 21:25:11

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: etc_query: all things Textpattern

progre55 wrote:

I had planned on creating a “How To” thread so that others will have a road map shhould they also need the ability to filter articles using drop downs and multi-selects

Yes, please do so. I could follow along to a certain point, hoping that I could trace back what was left out from the beginning once I’d have to build such a monster, but had to throw in the towel pretty soon.

It’ll certainly become a topic that’ll be visited regularly. Try googling this forum for “real estate” ;)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#81 2012-08-02 21:26:34

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: etc_query: all things Textpattern

Uli:

I will do one either tonight or tommorrow so that we can get it up and everyone will be very pleased with its simplicity and results.

progre55

Offline

#82 2012-08-02 21:36:40

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: etc_query: all things Textpattern

Cool, thanks!

(I’ll now shovel a heap of posts over to the etc_query topic where they belong to make it easier for the adi_gps readers and to promote etc_query a tad ;)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#83 2012-08-03 12:50:17

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: etc_query: all things Textpattern

TXP Tip for this please….!

Offline

#84 2012-08-03 21:22:18

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: etc_query: all things Textpattern

For anyone interested, the tip – Front End Search: Filter Articles With Drop-Down and Multi-Select Menu was posted this morning.

Offline

Board footer

Powered by FluxBB