Textpattern Forum

You are not logged in. Register | Login | Help

#31 2012-08-01 21:21:54

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

Re: etc_query: all the things

etc:

Thank you for your response and I am all for reducing code duplication. I tested the above code and the probem is if you just select Color or Just Select a Price or do a combination of a Color and Price nothing happens. If I Select a Model — it returns all the articles that have a Model in that field and does not distinguish between them. Also, selecting a Model and either Price or Color or Both resturns the same article list.

progre55

Offline

#32 2012-08-01 21:30:58

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,232
Website

Re: etc_query: all the things

Weird. If you unwrap it from <txp:article_custom />

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

what do you get?


etc_[ query | search | pagination | date | tree | url ]

Offline

#33 2012-08-01 21:37:41

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

Re: etc_query: all the things

etc.

I apologize but your original code actually did the trick. When I altered one of the variables (changed Price to Year) because I had changed it in the site, I missed a place in the code you provided which was jacking everything up. Now, the search form returns all of the expected results. THANK YOU.

With the reduction in replication, this will also make it much easier for me to add additional fields.

progre55

Offline

#34 2012-08-01 21:41:21

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

Re: etc_query: all the things

etc:

I just noticed — the original code works if I do just Model. Model and Color. Model Color and Price. But if I do not select a Model — just using the Color and Price does not return any results.

progre55

Last edited by progre55 (2012-08-01 21:41:37)

Offline

#35 2012-08-01 21:41:44

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,232
Website

Re: etc_query: all the things

Fine then, glad it helps!


etc_[ query | search | pagination | date | tree | url ]

Offline

#36 2012-08-01 21:43:32

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

Re: etc_query: all the things

etc.

I spoke a little to soon. Let me know your thoughts on what may be causing the results as mentioned in my last response.

progre55

Offline

#37 2012-08-01 21:45:38

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,232
Website

Re: etc_query: all the things

Then weird again. It should only generate a list of attributes from adi_gps variables. What if you delete the linebreaks:

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

etc_[ query | search | pagination | date | tree | url ]

Offline

#38 2012-08-01 21:51:00

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

Re: etc_query: all the things

etc.

Here is what I have determined, it is based on the first item in this list: data={?Color,Model,Price} The first variable allows the other two to work — but that is it — I can swap around the order and the functionality still works, but only if you use the first variable. (ie change Model to Color and you will then be forced to select Model to make the other two function.

progre55

Last edited by progre55 (2012-08-01 21:52:47)

Offline

#39 2012-08-01 21:54:33

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,232
Website

Re: etc_query: all the things

Ah yes, I see, that’s because adi_gps assigns it an empty value. Try to replace it with data=”{?Color}{?Model}{?Price}”

Last edited by etc (2012-08-01 21:55:00)


etc_[ query | search | pagination | date | tree | url ]

Offline

#40 2012-08-01 21:57:20

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

Re: etc_query: all the things

etc.

Success! Thank you for all your help. I shall now plow ahead and let you know what if anything else I discover. Thank Yuou again.

progre55

Offline

Board footer

Powered by FluxBB