- Posts: 137
COMMUNITY FORUM
How to limit related items to a category?
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
6 years 4 weeks ago #169938
by Gorast
How to limit related items to a category? was created by Gorast
Hi,
I need to relate Actor to its Performance. I do this by tags. The problem is that other actors that have same performance show in the related items. How can I limit related items to show related items ONLY from category Performances?
Thanks,
Gorast
I need to relate Actor to its Performance. I do this by tags. The problem is that other actors that have same performance show in the related items. How can I limit related items to show related items ONLY from category Performances?
Thanks,
Gorast
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
6 years 4 weeks ago #169942
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic How to limit related items to a category?
The query does not distinguish categories. We could have it though as an option in upcoming releases (noted).
In the meantime, your best bet is to simply override the itemlist.php model in the frontend (function getRelatedItems()) and simply extend with your rules.
In the meantime, your best bet is to simply override the itemlist.php model in the frontend (function getRelatedItems()) and simply extend with your rules.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 137
6 years 4 weeks ago #169943
by Gorast
Replied by Gorast on topic How to limit related items to a category?
I tried to modify the file ofc :D but always end up with error.
Never learned how really Joomla draw the id for the categories.
Never learned how really Joomla draw the id for the categories.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
6 years 4 weeks ago #169944
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic How to limit related items to a category?
It's not Joomla in this case, it's a function specific to K2 and it's plain SQL. Nothing fancy.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 137
6 years 4 weeks ago #169945
by Gorast
Replied by Gorast on topic How to limit related items to a category?
:D
Easy for you to say. I'll try to find my way around or I'll wait for the upcoming release :D
Thanks.
Easy for you to say. I'll try to find my way around or I'll wait for the upcoming release :D
Thanks.
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
6 years 3 weeks ago #169961
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic How to limit related items to a category?
Try to replace the query line with this one:
If it works with you, I can help to implement this feature in the upcoming release.
$query = "SELECT t.itemID FROM #__k2_tags_xref AS t JOIN #__k2_items AS i ON t.itemID = i.id WHERE t.tagID IN ({$sql}) AND t.itemID != {$itemID} AND i.catid = (SELECT catid FROM #__k2_items WHERE id = {$itemID}) GROUP BY t.itemID";
If it works with you, I can help to implement this feature in the upcoming release.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 137
6 years 3 weeks ago #169969
by Gorast
Replied by Gorast on topic How to limit related items to a category?
Should I run this in phpMyAdmin?
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
6 years 3 weeks ago #169971
by Mohamed Abdelaziz
No, you will modify itemlist.php model in the frontend as Fotis said
You will replace this line:
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic How to limit related items to a category?
Gorast wrote: Should I run this in phpMyAdmin?
No, you will modify itemlist.php model in the frontend as Fotis said
You will replace this line:
$query = "SELECT itemID FROM #__k2_tags_xref WHERE tagID IN ({$sql}) AND itemID!={$itemID} GROUP BY itemID";
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 137
6 years 2 weeks ago - 6 years 2 weeks ago #170159
by Gorast
Replied by Gorast on topic How to limit related items to a category?
It did nothing. Should I manually put the ID of the Category I want the items from?
Tnx,
Gorast
Tnx,
Gorast
Last edit: 6 years 2 weeks ago by Gorast.
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
6 years 2 weeks ago #170162
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic How to limit related items to a category?
Have you modified the models/itemlist.php file?
The query I detects the category id from the item being viewed.
The query I detects the category id from the item being viewed.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.