Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

To Show Only Level 1 Categories On Vendor Page. Rate Topic   - - - - -

 
  • madhuri
  • Advanced Member
  • Members
  • Join Date: 27-Aug 14
  • 110 posts

Posted 25 December 2014 - 07:23 AM #1

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.

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19681 posts

Posted 25 December 2014 - 09:24 AM #2

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.


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

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • madhuri
  • Advanced Member
  • Members
  • Join Date: 27-Aug 14
  • 110 posts

Posted 25 December 2014 - 10:00 AM #3

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.

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19681 posts

Posted 25 December 2014 - 11:11 AM #4

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

<a href="{"products.search?search_performed=Y&cid=`$category.category_id`&company_id=`$company_data.company_id`"|fn_url}">{$category.category}</a>

with

<a href="{"products.search?search_performed=Y&cid=`$category.category_id`&subcats=Y&company_id=`$company_data.company_id`"|fn_url}">{$category.category}</a>

Hope this will help.

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • madhuri
  • Advanced Member
  • Members
  • Join Date: 27-Aug 14
  • 110 posts

Posted 25 December 2014 - 11:59 AM #5

This helped me thanks a lot..

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19681 posts

Posted 25 December 2014 - 01:06 PM #6

This helped me thanks a lot..


You are welcome!

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • madhuri
  • Advanced Member
  • Members
  • Join Date: 27-Aug 14
  • 110 posts

Posted 30 December 2014 - 09:13 AM #7

What if i want to only show the subcategories and not the main categories in storefront on vendor page.By default it shows both.

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19681 posts

Posted 30 December 2014 - 09:33 AM #8

What if i want to only show the subcategories and not the main categories in storefront on vendor page.By default it shows both.


Just replace:

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

with

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

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.