You are not logged in.
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
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
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
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
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
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
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
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
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