Keyword

Link to category item & tags

  • JM Bonnerot
  • JM Bonnerot's Avatar Topic Author
  • Offline
  • New Member
More
2 weeks 6 days ago #177373 by JM Bonnerot
Link to category item & tags was created by JM Bonnerot
Hello !

I'm having a small issue to get the answer for this question, so i'll have too ask here.

I'm sure it's not much, but i can't figure out how to pull this out properly.

i found some plugin but they can only get content for one specific tag, or, one or another one, but not two at the same time.

I'm trying to get a link to the category-item views for items having two different and specific tags at the same time.
I'm not really familiar with php.

I guess the way would be to create an overide of the category item file and pulling out a condition in php like this :
<?php foreach ($items as $key=>$item):
$flag = false;
foreach ($item->extra_fields as $key=>$extraField)
if($extraField->name == "Type" && $extraField->value == "Generic") $flag1=true;
if($extraField->name == "Usage" && $extraField->value == "Natural") $flag2=true;

if($flag2 == true && $flag2 == true) :
?>



Layout




<?php
endif;
endforeach; ?
>

Is the only way is adding variable to the link url on my menu and getting these back with a _GET on the overide ?
It looks a bit messy to me :/

Or maybe do you maybe know a plugin that would fit my need ?

Thanks a lot for your time anyway ! :)

Please Log in or Create an account to join the conversation.

  • JM Bonnerot
  • JM Bonnerot's Avatar Topic Author
  • Offline
  • New Member
More
2 weeks 3 days ago #177382 by JM Bonnerot
Replied by JM Bonnerot on topic Link to category item & tags
I found out a way to handle this :

stackoverflow.com/questions/29432161/filter-articles-by-tag-inside-a-category-joomla-and-k2

So i'm sending tag by url and items get filtered on the category.php override.

Oh and the tag have to be in lowercase with no special caracters with no space. Or esle you can use a php function to replace special caracters & space and to put in in lowercase.
You can find a lot of theses functions by a simple search on google, but i'm not good enought to tell which one is the best.


Hope this helps if anyone get the same problem one day.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 2 days ago #177392 by Fotis
Replied by Fotis on topic Link to category item & tags
This is not really a well suited solution. When a category or tag layout (both part of the "itemlist" view) is shown, K2 pulls certain items from the database for each page shown. So if your tag page has no item with the category you want filtered or if your category page has not items with the tag or tags you want, they will simply show nothing when you have that code proposed on S/O.

What you ask requires editing K2 itemlist model, which is really beyond the scope of the support provided here as it's an edge case.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • JM Bonnerot
  • JM Bonnerot's Avatar Topic Author
  • Offline
  • New Member
More
2 weeks 2 days ago #177397 by JM Bonnerot
Replied by JM Bonnerot on topic Link to category item & tags
Well i made a condition showing a big huge "this tag shows not result in this category", it works for now.

Anyway i understand it's beyond the scope, but just knowing the file i have to edit is a huge step for me, i'm not bad at learning. I'll try to rethink my solution.

Thanks a lot Fotis. Keep up the good work

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 1 day ago #177407 by Fotis
Replied by Fotis on topic Link to category item & tags
You're welcome.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum