k2 Recently viewed items

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

#
Hi there,

Do you have any ways or query to select few categories by ids instead of listing items from all categories?

Thanks.

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

#
Hello, Kunjan.

This module designed just to show an items which user checked before.

If you also want to restrict it by some category, you can modify this template file - modules\mod_k2_recent\tmpl\default.php

Find this part of code:
		foreach ($ids as $k=>$id) { 
			$query = "SELECT * FROM #__k2_items WHERE id = {$id}";
			$db->setQuery($query);
			$item = $db->loadObject();

Then, replace it with the following:
		$catids = array(1, 2, 3); //categories id for restriction
		foreach ($ids as $k=>$id) { 
			$query = "SELECT * FROM #__k2_items WHERE id = {$id}";
			$db->setQuery($query);
			$item = $db->loadObject();
			if(!in_array($item->catid, $catids)) {
				continue; //skip item 
			}

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

#
Hi,
This really worked. Superb.
Thanks a ton.

Kunjan