Display all categories with images in start page

LiteCart Fan
Da Thailand
Membro dal ago 2017

Hello,
how can I visualize all the categories with related images as in the category page, in the home page?
For example, under the slide see all the categories with images.

Thank you

Curtain Guru
Da Netherlands
Membro dal dic 2016

Hi, in includes/templates/default.catalog/pages/index.inc.php

below line 10 wich is:
<?php include vmod::check(FS_DIR_APP . 'includes/boxes/box_slides.inc.php'); ?>

add
<?php include vmod::check(FS_DIR_APP . 'includes/boxes/box_categories.inc.php'); ?>

tim
Founder
Da Sweden
Membro dal mag 2013
tim

I edited tonnys post to use the right file.

Curtain Guru
Da Netherlands
Membro dal dic 2016

Where did I go wrong Tim?

LiteCart Fan
Da Thailand
Membro dal ago 2017

Before the file to add was manufacturer instead of box_categories.
I will try it this afternoon.
Thank you all

tim
Founder
Da Sweden
Membro dal mag 2013
tim

@tonny you had box_manufacturer_logotypes in the instructions.

LiteCart Fan
Da Thailand
Membro dal ago 2017

hello,
got this error:
Warning: Use of undefined constant FS_DIR_APP - assumed 'FS_DIR_APP' (this will throw an Error in a future version of PHP) in ~/includes/templates/default.catalog/pages/index.inc.php (Line 9)
Warning: include(FS_DIR_APPincludes/boxes/box_categories.inc.php): failed to open stream: No such file or directory in ~/includes/templates/default.catalog/pages/index.inc.php (Line 9)
Warning: include(FS_DIR_APPincludes/boxes/box_categories.inc.php): failed to open stream: No such file or directory in ~/includes/templates/default.catalog/pages/index.inc.php (Line 9)
Warning: include(): Failed opening 'FS_DIR_APPincludes/boxes/box_categories.inc.php' for inclusion (include_path='.:/opt/alt/php72/usr/share/pear') in ~/includes/templates/default.catalog/pages/index.inc.php (Line 9)

tim
Founder
Da Sweden
Membro dal mag 2013
tim

That means you are not on 2.2. For older versions it's include vmod::check(FS_DIR_HTTP_ROOT . WS_DIR_BOXES . 'box_categories.inc.php');

LiteCart Fan
Da Thailand
Membro dal ago 2017

Hello, yes I did try that:
Warning: include(/home/mobus/public_html/includes/templates/default.catalog//views/box_categories.inc.php): failed to open stream: No such file or directory in ~/includes/classes/view.inc.php (Line 63)
Warning: include(/home/mobus/public_html/includes/templates/default.catalog//views/box_categories.inc.php): failed to open stream: No such file or directory in ~/includes/classes/view.inc.php (Line 63)
Warning: include(): Failed opening '/home/mobus/public_html/includes/templates/default.catalog//views/box_categories.inc.php' for inclusion (include_path='.:/opt/alt/php72/usr/share/pear') in ~/includes/classes/view.inc.php (Line 63)

LiteCart Fan
Da Thailand
Membro dal ago 2017

Yes there is no that file there, you right.
But the categories appear in the website, any browser so it is not cache, it is really working fine, so there is something instead of it. Version 2.1.6
There is a file in public_html/includes/boxes named box_categories.inc,
in public_html/includes/templates/default.catalog/views/ there is only box_category_tree.inc.php

LiteCart Fan
Da Thailand
Membro dal ago 2017

I see all the categories

tim
Founder
Da Sweden
Membro dal mag 2013
tim

That makes no sense, because it should be using includes/templates/default.catalog/views/ there is only box_category_tree.inc.php.

LiteCart Fan
Da Thailand
Membro dal ago 2017

Hello,
I also just now downloaded again 2.1.6 and there is no that file there, should I copy it from public_html/includes/boxes and put it back?

tim
Founder
Da Sweden
Membro dal mag 2013
tim

Grab it from the latest version. Should be fine.

LiteCart Fan
Da Thailand
Membro dal ago 2017

Ok I will and I will let you know the result. 
By the way,  how it is posdible that the categories are shown without the file?

tim
Founder
Da Sweden
Membro dal mag 2013
tim

If I remember right they were moved to pages/categories during a few versions then back to box_categories due to this very request by some to add it to other pages.

LiteCart Fan
Da Thailand
Membro dal ago 2017

It works in both way: the new file from the latest version or adding the file presents in public_html/includes/boxes named box_categories.inc
But in both ways it show a vertical list of categories. Like it does not load the correct css.
I will try to work on it.

LiteCart Fan
Da United Kingdom
Membro dal lug 2019

I might be a bit late into this and it is already solved but it looks like you are trying to do something similar to me.

This applies to 2.2.7

I just took the templates/catalog/layouts/index.inc.php and stripped out the vast majority of the code to leave

<div id="content">
  {snippet:notices}
  <?php include vmod::check(FS_DIR_APP . 'includes/boxes/box_categories.inc.php'); ?>
</div>

front page now is just the categories with images on desktop and tablet but just a list on 'phone. Looks clean and neat (in my humble opinion that is!)

Hope that this helps you or anybody else.

LiteCart Fan
Da Thailand
Membro dal ago 2017

Great!
Best solution.
Thank you very much.

LiteCart Fan
Da Australia
Membro dal apr 2023

hello, where would i find the code to remove this "Categories" title? i cannot seem to find it in the normal places? thanks

<h1 class="card-title">Categories</h1>?

LiteCart Fan
Da Australia
Membro dal apr 2023

/includes/boxes/box_categories.inc.php

cannot see any code for the title? is this file calling another?

LiteCart Fan
Da Australia
Membro dal apr 2023

thanks!

would the /views folder also hold the code for the footer "categories" tree?
i find if there are a lot of categories the foot gets very tall and need to figure out a way to reduce the list or drop down

LiteCart Fan
Da Australia
Membro dal apr 2023

can anyone share some ideas on how to stop the cell getting so tall with lots of root categories? 

thanks

LiteCart Fan
Da United Kingdom
Membro dal lug 2019

Zara

Without knowing anything about your circumstances the somewhat trite answer would be have less categories!

That said, is it possible that your category list could be collapsed by reassigning / rethinking the list? As an example from my own field. I could have a category list of China / India / Japan / Africa / Indonesia / Blends. On the other hand these all reside under the one category Teas.
Matter of personal preference really, but I'm sure that there is research that shows the more choice you offering the less likely you are to reach a sale.

The coding approach - and I am not offering assistance on this, just a "what if" - would be to add another footer (duplicate the code for the footer) to the page but this time  strip out the other "cells" and have it filled with just the categories.
With the correct css this would then be a neat box across the screen - tho' this would really only apply to a broad screen.

Just how much scrolling your viewers would have to do on a 'phone is anybodies guess.
Which I suspect leads back to your original issue with the output in your picture .... ?

Unless of course you decide that for a 'phone you do not display the box, in which case you could ask what is the point in having it in the first place,  which in a horribly cyclic way gets back to the number of categories....

I could be wrong but I'm sure that the majority of site views are now on a 'phone - if you start with a 'phone view and "design out" from there approach you may get a different perspective on what you are trying to achieve.

Not trying to be a bummer, and hope this helps.

Dave

LiteCart Fan
Da Australia
Membro dal apr 2023

hello, 
i dont quiet think "having less categories" is a solution to this problem (something that i surely could have resolved myself)

to leave the categories cell there in the footer, it will be to tall.
i could remove it, if it does not misalign the footer and maintain the centring of the other cells.

categories - brands - account - information - contact 

seem to fit best, i am not sure how to correctly change that. thanks

LiteCart Fan
Da United Kingdom
Membro dal lug 2019

Zara
I did say that I [i]was[/i] being trite, and being fair your original question did seem to imply that you needed the category list in the footer.

However if you just need to remove the section from the footer it is a simple task to either comment out the category bit in the footer or just delete it.
That will however leave 4 cells in a box designed for 5 - which will left align. To solve that problem you will then need to go into the css.
But remember that you shouldn't make changes to the core template. You should create your own duplicate and make the changes there which will avoid the possibility of them being overwritten on updates.
You will need to get your hands dirty to some degree editing code tho' to achieve this.

LiteCart Fan
Da Australia
Membro dal apr 2023

Can anyone share some ideas on how to stop the cell getting so tall with lots of root categories?

LiteCart Fan
Da United Kingdom
Membro dal lug 2019

Further to my previous suggestions the only way that you can reduce the height of the list would be to go into the css and set the font size and spacings to be much smaller that the other cells in the footer (I suppose that you could also do the reverse and make the text/spacing in the other cells larger till you achieve height parity). Or perhaps turn the category cell into a scrollable list?
Apart from that there really is no way you can have two asymetric lists side by side with the same typesetting without one looking larger than the other.

LiteCart Fan
Da Australia
Membro dal apr 2023

thanks tim, 

if (++$i < 10) {
        $box_site_footer->snippets['categories'][$category['id']] = [
          'id' => $category['id'],
          'name' => $category['name'],
          'link' => document::ilink('category', ['category_id' => $category['id']]),
        ];

changed to
if (++$i < 4) {

now its shows first 3 cats. then .more...

perfect

Tu
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.