Jump to content

Displaying category images on homepage and category pages


afalls
 Share

Recommended Posts

I need to accomplish two things in regards to category images.

1.  Is it possible to display the category images on the homepage? It's for about 9-12 categories. I've been searching in the forums and found a link to a mod from years ago (https://forums.cubecart.com/topic/51416-need-to-show-category-images-on-home-page/) but looks like it's no longer available to buy

2. When I used foundation skin, it displayed an image for each sub category on the categories page but now using Basix it's just a text link. It's it possible to change the format to show sub categories images (3 to a row)?

Link to example: https://mplastics.com.au/plastic-products.html

cubecart v 6.4.7

Skin: Basix

Link to comment
Share on other sites

Regarding #2, I would think that the content.category.php template has been edited such that the list of sub-cats do not collapse into a toggled slide-open from the category title.

Regardless, in the template file content.category.php, find:

{if isset($SUBCATS) && $SUBCATS}
	<div class="collapse" id="collapseSubCats">

Just ABOVE that, add:

{if isset($SUBCATS) && $SUBCATS}
  <div class="panel panel-basix">
    <div class="panel-body">
      <div class="row">
        {foreach from=$SUBCATS item=subcat}
          <div class="product-box">
            <div class="inner">
            <div class="product-wrap">
              <div class="photo-wrap">
                <a class="th" href="{$subcat.url}" title="{$subcat.cat_name}">
                  <img class="thmb" src="{$subcat.cat_image}" alt="{$subcat.cat_name}">
                </a>
              </div>
              <div class="product-name"><a href="{$subcat.url}" title="{$subcat.cat_name}">{$subcat.cat_name}</a></div>
            </div>
            </div>
          </div>
        {/foreach}
      </div>
    </div>
  </div>
{/if}

Then, near the bottom, find:

  {else}

    <div class="alert alert-danger text-center">{$LANG.category.no_products}</div>

Just below that:

Delete:

    {if isset($SUBCATS) && $SUBCATS}
      <div class="clear">
        <div class="list-group">
          {foreach from=$SUBCATS item=subcat}
            <a href="{$subcat.url}" class="list-group-item" title="{$subcat.cat_name}">{$subcat.cat_name}</a>
          {/foreach}
        </div>
      </div>
    {/if}

The panels are wide enough to get four panels per row. (Same as the array of panels on the Homepage.) The image, however, may be too small.

If not happy with the size of the sub-cat images, then in the skin's config.xml file:

Find:
<image reference="subcategory" maximum="105" quality="80" default="noimage.png" />

Change to:
<image reference="subcategory" maximum="150" quality="80" default="noimage.png" />

Then have CubeCart clear its internal cache.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...