To Show Only Level 1 Categories On Vendor Page

In storefront on vendor page i just want to show level 1 categories i.e. the main categories and on click of that link all the products related to the main categories.I dont want to show the subcategories under the main categories.So please can anybody help me out with this.







Thanks in advance.

[quote name='madhuri' timestamp='1419492216' post='200882']

In storefront on vendor page i just want to show level 1 categories i.e. the main categories and on click of that link all the products related to the main categories.I dont want to show the subcategories under the main categories.So please can anybody help me out with this.

[/quote]



Please open the app/functions/fn.catalog.php file, find the fn_get_product_counts_by_category function and add:



$condition .= db_quote(" AND ?:categories.parent_id = ?i ", 0);




after this line:



$condition .= db_quote(" AND ?:category_descriptions.lang_code = ?s ", $lang_code);




Note that the Show products from subcategories of the selected category setting should be enabled on the Settings → General page in the admin panel

This is working fine and displaying all main categories on vendor page but when i click on paticular main category all the products related to its subcategories are not displayed.It is displaying only 1 product it is not showing all the products.

Please also edit the design\themes\THEME\templates\views\companies\view.tpl file and replace:



{$category.category}




with



{$category.category}




Hope this will help.

This helped me thanks a lot…

[quote name='madhuri' timestamp='1419508741' post='200920']

This helped me thanks a lot…

[/quote]



You are welcome!

What if i want to only show the subcategories and not the main categories in[color=#282828][font=arial, verdana, tahoma, sans-serif] storefront on vendor page.By default it shows both.[/font][/color]

[quote name='madhuri' timestamp='1419930833' post='201288']

What if i want to only show the subcategories and not the main categories in[color=#282828][font=arial, verdana, tahoma, sans-serif] storefront on vendor page.By default it shows both.[/font][/color]

[/quote]



Just replace:



$condition .= db_quote(" AND ?:categories.parent_id = ?i ", 0);




with



$condition .= db_quote(" AND ?:categories.parent_id != ?i ", 0);