Jump to content

"There are no products" in category - Presta 1.7.8.6


markovo

Recommended Posts

Hello,

When there is an empty category in Prestashop, there is a warning message that says "There are no products." The warning message is within a div with class="alert alert-warning" and it looks like this:

 

screenshot.thumb.png.5ed174f254707953d91a6678a3ab4944.png

 

My Presta is 1.7.8.6 and I can't find where this alert comes from. I want to replace the alert with a shortcode that will call a contact form.

So basicly I want to display a contact form when there are no products in the category. How this can be done?

 

Link to comment
Share on other sites

This is the code in the file mentioned above:

{extends file='catalog/listing/product-list.tpl'}

{block name='product_list_header'}
    {include file='catalog/_partials/category-header.tpl' listing=$listing category=$category}
{/block}

There is nothing related to the "alert-warning" div in these two files: "category-header.tpl" and "product-list.tpl"

This is the code in category-header.tpl:

<div id="js-product-list-header">
    {if $listing.pagination.items_shown_from == 1}
        <div class="block-category card card-block">
            <h1 class="h1">{$category.name}</h1>
            <div class="block-category-inner">
                {if $category.description}
                    <div id="category-description" class="text-muted">{$category.description nofilter}</div>
                {/if}
                {if !empty($category.image.large.url)}
                    <div class="category-cover">
                        <img src="{$category.image.large.url}" alt="{if !empty($category.image.legend)}{$category.image.legend}{else}{$category.name}{/if}" loading="lazy" width="141" height="180">
                    </div>
                {/if}
            </div>
        </div>
    {/if}
</div>

This is the code in product-list.tpl:

{extends file=$layout}

{block name='head_microdata_special'}
  {include file='_partials/microdata/product-list-jsonld.tpl' listing=$listing}
{/block}

{block name='content'}
  <section id="main">

    {block name='product_list_header'}
      <h1 id="js-product-list-header" class="h2">{$listing.label}</h1>
    {/block}

    {block name='subcategory_list'}
      {if isset($subcategories) && $subcategories|@count > 0}
        {include file='catalog/_partials/subcategories.tpl' subcategories=$subcategories}
      {/if}
    {/block}
    
    {hook h="displayHeaderCategory"}

    <section id="products">
      {if $listing.products|count}

        {block name='product_list_top'}
          {include file='catalog/_partials/products-top.tpl' listing=$listing}
        {/block}

        {block name='product_list_active_filters'}
          <div class="hidden-sm-down">
            {$listing.rendered_active_filters nofilter}
          </div>
        {/block}

        {block name='product_list'}
          {include file='catalog/_partials/products.tpl' listing=$listing productClass="col-xs-6 col-xl-4"}
        {/block}

        {block name='product_list_bottom'}
          {include file='catalog/_partials/products-bottom.tpl' listing=$listing}
        {/block}

      {else}
        <div id="js-product-list-top"></div>

        <div id="js-product-list">
          {capture assign="errorContent"}
            <h4>{l s='No products available yet' d='Shop.Theme.Catalog'}</h4>
            <p>{l s='Stay tuned! More products will be shown here as they are added.' d='Shop.Theme.Catalog'}</p>
          {/capture}

          {include file='errors/not-found.tpl' errorContent=$errorContent}
        </div>

        <div id="js-product-list-bottom"></div>
      {/if}
    </section>

    {hook h="displayFooterCategory"}

  </section>
{/block}

I already searched every included TPL it these files and there is nothing written about this "alert-warning" message.

Link to comment
Share on other sites

On 9/1/2022 at 12:12 PM, markovo said:
        <div id="js-product-list">
          {capture assign="errorContent"}
            <h4>{l s='No products available yet' d='Shop.Theme.Catalog'}</h4>
            <p>{l s='Stay tuned! More products will be shown here as they are added.' d='Shop.Theme.Catalog'}</p>
          {/capture}

          {include file='errors/not-found.tpl' errorContent=$errorContent}
        </div>

I think its right here while $errorContent is filled with the alert div in the backend. Remove the include and place your contact form there

  • Thanks 1
Link to comment
Share on other sites

I just fount another product-list.tpl file located here: /themes/warehouse/templates/catalog/listing

And there it was:

{block name='product_list_not_found'}
<div class="alert alert-warning" role="alert">
<strong>{l s='There are no products.' d='Shop.Theme.Catalog'}</strong>
</div>
{/block}

Thank you for the answers, problem is resolved!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...