Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2011-07-09 08:27:46
- xylpho
- Member
- From: Brest, France
- Registered: 2005-10-24
- Posts: 28
thumbnails filtered by a custom field
Hello,
On this page http://saperlotte.fr/bijoux/bague-blanche (under construction) i have a product display.
Price, reference, dimensions, motif etc are output from custom fields.
Now what I want :
In the red box on the right, i would have object’s thumbnails based on current “Motif” (see “Motif : fleurs noires” line)
I don’t know how to filter this mini gallery image based on custom field
Can anyone help me ?
(btw, i have another problem on this page i will fix later with some help :))
don’t eat yellow snow
Offline
Re: thumbnails filtered by a custom field
xylpho wrote:
I don’t know how to filter this mini gallery image based on custom field
Can you perhaps do something like this, using tags-in-tags:
<txp:images category='<txp:custom_field name="motif" />'>
<txp:thubnail />
</txp:images>
EDIT: You may have to wrap it in if_custom_field tags to be safe, in case the custom field is empty.
Last edited by Bloke (2011-07-09 09:31:28)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2011-07-09 09:46:53
- xylpho
- Member
- From: Brest, France
- Registered: 2005-10-24
- Posts: 28
Re: thumbnails filtered by a custom field
I thought about a solution like this
<txp:images category='<txp:custom_field name="Motif" />'>
<txp:permlink><txp:smd_thumbnail type="aside" /></txp:permlink>
</txp:images>
don’t work because i guess <txp:custom_field name="Motif" />
is not a category. I got no txp tag trace :(
don’t eat yellow snow
Offline
#4 2011-07-09 10:56:10
- xylpho
- Member
- From: Brest, France
- Registered: 2005-10-24
- Posts: 28
Re: thumbnails filtered by a custom field
Some progress :
Defined somewhere in my module <txp:variable name="my_motif" value='<txp:custom_field name="Motif" />' />
Used it to display the “motif” in the product description with <dd>Motif : <txp:variable name="my_motif" /></dd>
And use of :
<aside> <txp:if_variable name="my_motif"> <txp:images break=""><txp:permlink><txp:smd_thumbnail type="aside" /></txp:permlink></txp:images> </txp:if_variable> </aside>
in the red box. A problem persists, i know i have two products with this motif but i get only one (the current displayed)
Any help ?
don’t eat yellow snow
Offline
#5 2011-07-09 11:13:06
- xylpho
- Member
- From: Brest, France
- Registered: 2005-10-24
- Posts: 28
Re: thumbnails filtered by a custom field
tried
<txp:article_custom customfieldname='<txp:variable name="my_motif" />'> <txp:images break="" auto_detect=""><txp:permlink><txp:smd_thumbnail type="aside" /></txp:permlink</txp:images> </txp:article_custom>
But no luck. Throw an error
<txp:article_custom customfieldname=’<txp:variable name=“my_motif” />’> -> Textpattern Notice: Attribut de balise inconnu : customfieldname on line 758
don’t eat yellow snow
Offline
Re: thumbnails filtered by a custom field
You have to replace “customfieldname” with the name of your custom field.
Offline
#7 2011-07-09 11:56:42
- xylpho
- Member
- From: Brest, France
- Registered: 2005-10-24
- Posts: 28
Re: thumbnails filtered by a custom field
lazyadmin wrote:
You have to replace “customfieldname” with the name of your custom field.
You’re so *right*… I read documentation too fast
<txp:article_custom Motif='<txp:variable name="my_motif" />'> <txp:images break=""><txp:permlink><txp:smd_thumbnail type="aside" /></txp:permlink></txp:images> </txp:article_custom>
Works perfectly. Today I learned txp:variable and reading slower. Thanks lazyadmin
don’t eat yellow snow
Offline
Pages: 1