How to add main categories on home page in X-cart 4?

Categories on homepage will look like below.

Homepage customization X-cart

 

Now you are thinking about customization effort on homepage ??

X-cart 4 customization on homepage

 

Don’t Worry… Its something that every site owners thinking about and want to do as per their need and to enhance user experience.

We have received various queries from our client for this and there was one question which comes to us numerous time i.e. “Can we show our main categories on homepage in any way ? ”

And the answer is “YES”….

For the same we have provided few code help and you can use that in your X-cart 4 website. Just follow the steps below and get your categories on homepage.

Step 1:

Below mentioned is the code that you need to paste in home.php just above “func_display(‘customer/home.tpl’, $smarty)” …..


$categories = func_get_categories_list(0, false);
if (!empty($categories)) {
$smarty->assign('categories_menu_list', $categories);
}

 

Step 2:

Below mentioned is another piece of code that you need to paste in welcome.tpl of your current activated theme…


<ul>
{foreach from=$categories_menu_list item=category name=front_cats}
<li>
<div class="catimage"><a href="home.php?cat={$category.categoryid}">
<img src="{get_category_image_url category=$category}" alt="{$category.category|escape}"
width="{$category.image_x}" height="{$category.image_y}" />
</a>
</div>
<div class="cattitle">
<h3>
<a href="home.php?cat={$category.categoryid}">{$category.category|amp}</a>
</h3>
</div>
</li>
{/foreach}
</ul>

That’s it.  You r Done……

Hope you are now able to see your main categories on homepage?

Happy X-cart customer

 

Also, if still if you think that above mentioned solution haven’t fixed you problem then just drop us a line help@freelancergurus.com . We can build a custom module as well as per your need.