Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#316 2015-06-29 20:16:45
Re: smd_tags: unlimited article, image, file and link taxonomy
mmelon wrote #292294:
I will crack on with my filter search page project.
Cool. When you get it going (or during the process), please would you mind sharing how you did it? I’ve only partially tried it, with a view towards adding some tags to the plugin to make it easier to wrangle the URLs. So if you end up with any licks of PHP or a suite of plugins to achieve the goal of adding and removing tags, I’d love to see if I can help smooth the process with a bit of code.
Being able to combine tags for filtering is arguably one of the unique selling points of the plugin so anything I can do to pimp that side of things, I’ll consider. Even if it’s just writing your experience up as an example in the documentation, it’ll be a massive boon. Thanks.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#317 2015-07-02 14:28:21
- mmelon
- Member
- Registered: 2006-03-02
- Posts: 95
Re: smd_tags: unlimited article, image, file and link taxonomy
Hi,
For those that might be interested. I’ve spent a few days on this now but whilst I am close, I haven’t been able to get the behaviour I want. What I was hoping for was like this:
https://www.workwearexpress.com/polo-shirts/
(in terms of user experience with the mouse. Not in url structure or behaviour)
- Every product has different filter criteria depending on what it is tagged with.
- You can make one selection from each filter section. So one colour from colours, one size from size etc.
- The results narrow as you choose. Every filter results in a matching product. If a filter selection would result in zero results, when added to the current search criteria, then that filter item or section is removed.
I set up my tags like this
product category - root
filter section name - level 1
filter item - level 2
..giving something like
polo-shirts
—brand
——fruit-of-the-loom
——jerzees
——kustom-kit
—colour
——red
——blue
——green
—size
——xs
——s
——m
——l
——xl
——xxl
etc..
I setup a section called ‘catalogue’ to use a new page template. In the smd_tags prefs, I setup ‘filter’ as a trigger word.
I tagged a few test articles/products in the catalogue section.
I setup a page template with the code below.
If you do this, hopefuly visiting:
/catalogue/filter/article/[anytag]
(i get an error if i don’t supply a starting tag)
you see it working. It returns matching articles at the top, gives you a list of removable selected criteria underneath, and finally the remaining tags to filter on at the bottom.
I think it works and I may still develop and use it. The biggest frustration is with the line <!— if this tag is used on any articles/products. Need to finesse this. —>. The problem is it allows you to choose filter criteria that will result in zero matches. I am using smd_if to test if that tag appears in any articles. What I really want is to say: only output the link as a filter criteria if calling smd_related_tags on this new url context, will result in one or more matching articles.
I think one way to achieve this might be to supply a url context to one of the containers. perhaps
/ = AND combinator
<txp:smd_tag_list urlcontext="cat1/cat4/cat2">
<txp:smd_related_tags/>
I suppose the only purpose overriding the actual current url context serves, is to allow a test to see if an additional tag will produce related articles.
Anyway, I might continue and use this or I might rethink. Thanks for reading.
template code:
<txp:smd_if_tag>
<!-- get the articles from the current section that match the tags in the current url -->
<txp:smd_related_tags match="tag_name" wraptag="ul" break="li" />
selected tags:
<txp:smd_tag_list type="article" flavour="list" > <!-- loop through all of the tags in the url -->
<txp:variable name="toRemove">/<txp:smd_tag_name title="0" /></txp:variable> <!-- store in $toRemove the text for each piece of the url e.g '/cat1' -->
<!-- remove the above from the current url. this gives us the url that returns the results after the current cat is removed -->
<txp:variable name="withLinkRemoved">
<txp:php>
global $variable;
$currentUrl = $_SERVER['REDIRECT_URL'];
$newUrl = str_replace($variable['toRemove'], "", $currentUrl);
echo $newUrl;
</txp:php>
</txp:variable>
<txp:smd_tag_name title="0" /> <a href='<txp:variable name="withLinkRemoved"/>'>[x]</a> <!-- output each url title with a little a tag to remove it -->
</txp:smd_tag_list>
<!-- make a comma seperated list of the parent categories of each category in the url. The idea here is when you select a category/filter from the filter menu, all other options at the same sublevel are removed. You drill down through the results by making one choice from each criteria. -->
<txp:variable name="exclude"><txp:smd_tag_list wraptag="" type="article" showall="0" flavour="list" break=","><txp:smd_tag_info item="parent"/></txp:smd_tag_list></txp:variable>
<!-- Generate a list of all relevant categories to filter on -->
filter on:<br/>
<txp:smd_tag_list parent="0" flavour="list" wraptag="div" type="article" showall="1" break=""> <!-- I seem to have to use showall to get the full tag hierarchy -->
<txp:smd_if field='<txp:smd_tag_info item="parent"/>' operator="notin" value='txpvar:exclude' list_delim=","> <!-- if the parent of this tag is not in the exclude list above, we can use it as this criteria has not been used yet -->
<txp:smd_if field='<txp:smd_tag_info item="level"/>' operator="eq" value="1"> <!-- my level 1 tags are used as descriptions. We don't output a link -->
<div class="description"><txp:smd_tag_name title="0" /> </div>
<txp:else />
<txp:smd_if field='<txp:smd_tag_count wrapcount="" />' operator="gt" value="0"> <!-- if this tag is used on any articles/products. Need to finesse this. -->
<!-- this is the url that adds this filter to the current url chain -->
<txp:variable name="newUrl">
<txp:php>echo $_SERVER['REDIRECT_URL'];</txp:php>/<txp:smd_tag_name title="0" />
</txp:variable>
<div><a href='<txp:variable name="newUrl"/>'><txp:smd_tag_name title="1" /></a></div> <!-- output the next available filter -->
</txp:smd_if>
</txp:smd_if>
</txp:smd_if>
</txp:smd_tag_list>
</txp:smd_if_tag>
Kind regards,
Mike
Last edited by mmelon (2015-07-02 14:30:10)
Offline
#318 2015-07-06 15:27:08
- saccade
- Plugin Author

- From: Neubeuern, Germany
- Registered: 2004-11-05
- Posts: 521
Re: smd_tags: unlimited article, image, file and link taxonomy
Hi,
I’ve got some weird problem with smd_related_tags.
I want to sort the list by “Title asc”, but if I try the results will be empty.
The tag works fine without any sort-Attribute, as well as with sort=“Posted desc” and sort=“Posted asc”
but it refuses sort=“Title asc”. (“title asc” the same)
Offline
#319 2015-07-08 05:39:26
- mmelon
- Member
- Registered: 2006-03-02
- Posts: 95
Re: smd_tags: unlimited article, image, file and link taxonomy
Hi Stef,
Thinking more about using smd_tags as a filter search, a previous employer used to offer one as an upgrade on their ecommerce platform. Essentially it would need to look at the related tag items (the results) and produce a structured list of all unique tags on the results not yet selected. It’s this unique criteria list that you use to drill through only criteria combinations with results.
Undoubtably massive work. I’m currently thinking I might be able to do something with ajax. Like output them hidden then test for results and switch back on those that have them.
Kind regards,
Mike
Offline
#320 2015-07-13 13:12:15
Re: smd_tags: unlimited article, image, file and link taxonomy
Hi.
there is a way to print a tag name getting by url?
becose <txp:smd_tag_name title="1" /> into a page width this url index.php?s=articoli&smd_tag=lindo&smd_tagtype=article print nothing.
thankyou
Offline
#321 2015-07-14 06:20:26
- mmelon
- Member
- Registered: 2006-03-02
- Posts: 95
Re: smd_tags: unlimited article, image, file and link taxonomy
Hi, can I just confirm that by whatever method (extra plugins etc), it is possible to page the results from related tags?
Thank,
Mike
Offline
#322 2015-08-29 12:44:18
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: smd_tags: unlimited article, image, file and link taxonomy
Hello Stef,
impossible to install the smd_tag tables with the actual 4.6 dev TXP …
mysqli_… ?
Offline
#323 2016-04-11 01:33:59
Re: smd_tags: unlimited article, image, file and link taxonomy
I have a list of article tags:
- Tag 1
- Title: Woodline
- Name: woodline-basin
- Linked cat: Basins
- Tag 2
- Title: Woodline
- Name: woodline-bath
- Linked cat: Baths
- Tag 3
- Title: Woodline
- Name: woodline-accessory
- Linked cat: Accessories
and some articles:
- Article 1
- Tag: woodline-basin
- Article 2
- Tag: woodline-bath
- Article 3
- Tag: woodline-accessory
In an article form, I have:
<txp:smd_related_tags match="tag_title" /> // simplified for brevity
When viewing (say) Article 1, I expect to see Article 2 and Article 3 listed in my output as they share the same Title of Woodline, but smd_tags returns nothing.
Am I missing something, or misinterpreting how to use match="tag_title" in smd_related_tags?
Thanks.
Offline
#324 2016-04-18 00:08:14
- lazlo
- Member
- Registered: 2004-02-24
- Posts: 110
Re: smd_tags: unlimited article, image, file and link taxonomy
When I install I do not see these mentioned buttons:
Remove prefs †
Remove tables †
Rebuild tags †
and when I try import from rss_unlimited_categories nothing happens.
Do I have a java script problem? And how can I track that down?
Thanks
Offline
#325 2016-04-21 16:23:07
Re: smd_tags: unlimited article, image, file and link taxonomy
Just tried to install and got an error on my 4.6-dev version on PHP7:
Fatal error: Uncaught Error: Call to undefined function mysql_get_server_info() in /home/redacted/textpattern/lib/txplib_misc.php(1369) : eval()'d code:703 Stack trace: #0 /home/redacted/textpattern/lib/txplib_misc.php(1369) : eval()'d code(179): smd_tags_table_install(0) #1 /home/redacted/textpattern/lib/txplib_misc.php(1896): smd_tags_welcome('plugin_lifecycl...', 'installed') #2 /home/redacted/textpattern/include/txp_plugin.php(538): callback_event('plugin_lifecycl...', 'installed') #3 /home/redacted/textpattern/include/txp_plugin.php(50): plugin_install() #4 /home/redacted/textpattern/index.php(211): include('/home/redacted/...') #5 {main} thrown in /home/redacted/textpattern/lib/txplib_misc.php(1369) : eval()'d code on line 703
Offline
#326 2016-04-22 08:39:56
Re: smd_tags: unlimited article, image, file and link taxonomy
lazlo wrote #298648:
When I install I do not see these mentioned buttons <snip> and when I try import from rss_unlimited_categories nothing happens.
If you’ve done a hard page refresh then I guess the plugin’s bust. Do you have any luck by replacing it with the version on github? I’ll investigate anyway as the plugin is in dire need of some visual love to bring it up-to-date with 4.5 and 4.6.
michaelkpate wrote #298763:
Call to undefined function mysql_get_server_info()
Yeah, the plugin’s no good on PHP7 because they’ve removed the mysql_* calls. Will patch.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#327 2016-04-22 19:54:53
Re: smd_tags: unlimited article, image, file and link taxonomy
giz wrote #298575:
Am I missing something, or misinterpreting how to use
match="tag_title"in smd_related_tags?Thanks.
Bump!
Offline
#328 2016-04-24 19:49:17
Re: smd_tags: unlimited article, image, file and link taxonomy
giz wrote #298575:
Am I missing something, or misinterpreting how to use
match="tag_title"in smd_related_tags?
I tried to replicate your setup but ran into some plugin snags along the way (tsk, I really need to work out how to use my own plugins properly!)
Anyway, when I resolved my configuration issues I started to put a test case together and got waylaid, sorry. I’ll try and run the tests as soon as I can today or tomorrow at the latest and report back.
Are you on 4.5.7 with the latest version of the plugin?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#329 2016-04-24 20:52:51
Re: smd_tags: unlimited article, image, file and link taxonomy
Bloke wrote #298797:
Are you on 4.5.7 with the latest version of the plugin?
Thanks, Stef. I’m running TXP 4.5.7 & smd_tags v0.50.
- smd_tags enabled in
- Articles, Images
- Link tags to categories
- Yes
- Permit parent tag selection
- Yes
- Master parent tag
- COLOUR
Offline
#330 2016-04-26 23:45:56
Re: smd_tags: unlimited article, image, file and link taxonomy
giz wrote #298575:
<txp:smd_related_tags match="tag_title" />
Looks like a confirmed bug, thanks for finding it.
The plugin is creating a wrong query, still matching on tag_name instead of matching on what you asked. I’ll need to dig into the code deeper to find out why and fix it. During the bug tracking process I’ve found some additional aggregation errors in the smd_related_tags query, thanks to another strict setting in my new database version, so I’ll need to fix those too.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline