Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Showing all categories, subcategories and sub-subcategories

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 05-07-2020, 10:51 PM
 
siddharth.puri@wheelandba siddharth.puri@wheelandba is offline
 

Advanced Member
  
Join Date: Nov 2019
Posts: 66
 

Default Showing all categories, subcategories and sub-subcategories

Hi I am trying to show all categories, subcategories and sub-subcategories on a single page.

How can I achieve this?

Thanks and Regards,
Sid
__________________
Version 5.3.6.6
Reply With Quote
  #2  
Old 07-04-2020, 11:32 PM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Showing all categories, subcategories and sub-subcategories

Code:
$categories = \XLite\Core\Database::getRepo('XLite\Model\Category')->findAll();
should do the job. (Categories, subcategories, sub-subcategories are all stored as entries of
xc_categories table).
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote

The following user thanks Ed B. for this useful post:
  #3  
Old 07-07-2020, 06:34 PM
 
siddharth.puri@wheelandba siddharth.puri@wheelandba is offline
 

Advanced Member
  
Join Date: Nov 2019
Posts: 66
 

Default Re: Showing all categories, subcategories and sub-subcategories

Hi Ed,

Thanks for your reply.

I am trying to show display them to the customer area.

Where do I add this code?

I created a new page following this - https://devs.x-cart.com/basics/creating_new_page.html#creating-page-in-customer-area

Now, how do I display all Categories, subcategories, sub-subcategories here?

Kind Regards,
Sid
__________________
Version 5.3.6.6
Reply With Quote
  #4  
Old 07-07-2020, 11:14 PM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Showing all categories, subcategories and sub-subcategories

Inside body.twig.


Basically you define categories in the view class so that they are accessible from twig and you loop over them in the twig.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:06 PM.

   

 
X-Cart forums © 2001-2020