Reduce category listing to product categories only

  • Posts: 634
  • Thank you received: 16
  • Hikashop Business
7 years 3 months ago #257674

-- HikaShop version -- : 2.6.4
-- HikaMarket version -- : 1.7.2
-- Joomla version -- : 3.6.4

I managed to restrict the otree for category listing to only show product categories, this is, avoiding to display vendor and brand categories with this code tweak recommended by you long ago:

<?php echo $this->shopCategoryType->displayTree('hikam_categories', $this->rootCategory, [b]array('product','')[/b], true, true); ?>

Anyhow, in the "category list area", when at root, all categorires are shown.

How can i make to only display "product" categories?

Attachments:

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
7 years 3 months ago #257710

Hi,

Who do you want to restrict ; the "main vendor" or a vendor ?

Hiding the element is possible (with a view override) but it won't really block the user to access to it.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 634
  • Thank you received: 16
  • Hikashop Business
7 years 3 months ago #258103

All vendors, including main.

I just need to avoid this to be seen in the listing, is not a problem if they can access through URL, I will give access to it in other parts of the site, is just to get a simpler interface for certain users

Last edit: 7 years 3 months ago by PeterChain.

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
7 years 3 months ago #258132

Hi,

In the view that you have already modified (to change the category listing tree), you will find the code

	$nbCatagories = count($this->elements);
	foreach($this->elements as $category) {
		$publishedid = 'category_published-'.$category->category_id;
By adding a little check, you can simply skip the categories you don't want.
So such kind of code should do the trick :
	$nbCatagories = count($this->elements);
	foreach($this->elements as $category) {
		$publishedid = 'category_published-'.$category->category_id;
		if(in_array($category->category_type, array('vendor', 'manufacturer'))
			continue;

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: PeterChain

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

Moderators: Obsidev
Time to create page: 0.068 seconds
Powered by Kunena Forum