How to let X-cart redirect to product page directly?

At ,  several categories only have one product. The default category will only display one product, that make the category looks very ugly, I think if a category only has one product, we can hide the category, when a visitor click the category, the category url will redirect the detailed product page directly. How to then?

Try to insert this to the /light_responsive/customer/home.tpl right after the opening <body> tag.

{if $main eq 'catalog' and $cat_products|@count eq 1}
  <script type="text/javascript">
    window.location.href = "{$cat_products[0].page_url}";