Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#61 2012-08-02 17:38:27

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

Re: etc_query: all things Textpattern

Ok … I can answer that — give me a second —-

Offline

#62 2012-08-02 17:47:29

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

Re: etc_query: all things Textpattern

glz_custom_fields stores it data in a seperate table called custom_field — the multi-select data is stored no differently that I can tell than the drop down data — just invidiual rows with values —-

An example would be:

ID | NAME | VALUE
108 | custom_4_set | XMRadio
109 | custom_4_set | Moon Roof

Last edited by progre55 (2012-08-02 17:50:33)

Offline

#63 2012-08-02 17:53:29

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

Re: etc_query: all things Textpattern

Ah, pity. I hoped it was in textpattern table, something like XMRadio, Moon Roof. Then we need the table structure: what are its fields?

Offline

#64 2012-08-02 17:57:51

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

Re: etc_query: all things Textpattern

Actually — there are only three fields in the table: ID | NAME | VALUE — as you can see from below —- the drop down (Price) custom_3 is no different than the multi-select custom_4

ID | NAME | VALUE
106 | custom_3_set | 25000
107 | custom_3_set | 30000
108 | custom_4_set | XMRadio
109 | custom_4_set | Moon Roof

Last edited by progre55 (2012-08-02 17:58:41)

Offline

#65 2012-08-02 18:08:13

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

Re: etc_query: all things Textpattern

Ok, and can you retrieve articles by multi-select: <txp:article_custom custom_4_set="XMRadio,MoonRoof" /> or something like this?

Offline

#66 2012-08-02 18:32:07

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

Re: etc_query: all things Textpattern

Using this <txp:article_custom custom_4_set="XMRadio,MoonRoof" /> did not work —

So I used this <txp:article_custom Price="25000" /> and it worked — which I know is a drop down field but wanted to make sure I could move the ball forward — so I think using the field name is the way to go —

The I tried this <txp:article_custom Features="XMRadio,MoonRoof" /> and unfortunately it returned nothing —-

Offline

#67 2012-08-02 18:34:58

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

Re: etc_query: all things Textpattern

One thing to note — if I use this <txp:article_custom Features="" /> it does return the articles that are not using that Custom Field

Offline

#68 2012-08-02 18:42:03

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

Re: etc_query: all things Textpattern

Maybe it was Moon Roof (with a space), sorry. Anyway, do ID correspond to articles’ ID?

Offline

#69 2012-08-02 18:49:09

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

Re: etc_query: all things Textpattern

ID appears to be just a unique identifier and does not correspond to Article ID.

Last edited by progre55 (2012-08-02 18:49:20)

Offline

#70 2012-08-02 18:54:57

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

Re: etc_query: all things Textpattern

Also, what I discovered is that this will return a result <txp:article_custom Features="XMRadio" /> if the article does not have any other features selected

Offline

#71 2012-08-02 19:26:47

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

Re: etc_query: all things Textpattern

Well, and what is in custom fields of textpattern table, for example in Features?

Offline

#72 2012-08-02 19:34:38

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

Re: etc_query: all things Textpattern

XMRadio|Moon Roof

Offline

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

etc
Developer
Registered: 2010-11-11
Posts: 5,690
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,690
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

Board footer

Powered by FluxBB