Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#31 2012-08-01 21:21:54
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: etc_query: all things Textpattern
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
Re: etc_query: all things Textpattern
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?
Offline
#33 2012-08-01 21:37:41
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: etc_query: all things Textpattern
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: 668
Re: etc_query: all things Textpattern
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
Offline
#36 2012-08-01 21:43:32
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: etc_query: all things Textpattern
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
Re: etc_query: all things Textpattern
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>
Offline
#38 2012-08-01 21:51:00
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: etc_query: all things Textpattern
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
Re: etc_query: all things Textpattern
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)
Offline
#40 2012-08-01 21:57:20
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: etc_query: all things Textpattern
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
Re: etc_query: all things Textpattern
You are welcome, but it’s midnight in Paris, I’m falling offline :)
Offline
Re: etc_query: all things Textpattern
Hi, with txp 4.5 beta I am getting an error message now with the code used here (Actually my code is a bit different but the essentials are the same.)
Tag error: <txp:etc_query data='<txp:variable name="imgnav" />' query="a[@data-id='{?pic}']"> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given while parsing form “None” on page “pic”
Error both on v.0.9 and 0.98
Dozy P My attempt at music
Offline
Re: etc_query: all things Textpattern
Hi Peter, are you sure to have the minimal required php version (5.3.8 – 5.3.10)?
Offline
Re: etc_query: all things Textpattern
I have 5.3.5 on my local host. MAMP version.
Dozy P My attempt at music
Offline
Re: etc_query: all things Textpattern
I have no MAMP to test at hand, sorry. You need at least 5.3.8 (5.3.10 on WAMP), is it possible to upgrade? etc_query uses very little of txp functions, it works on 4.5 for me.
Offline