• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Marek
  • Private: No
  • Open Date: 13.12.17, 15:14
  • Opened by: Nathalia
  • Closed by: Marek
  • Closed on: 29.12.17, 13:19
  • Reason: Closed
  • Comment: Glad to help!

Ticket #11270 - Out of stock text

Hi, i realized that my store isn’t showing the “not available” text when some product is out of stock.
As you can see on the image, that product has 0 units, but the store show “Avaliabity: In stock (0 Item)”.

I did delete this line in css:
/*.add .product-availability {display: none}*/

but nothing changes. That tag didnt exist on the code.

Comments

Marek 14 Dec 2017, 13:34

The issue has been fixed. Please check it out

Nathalia 14 Dec 2017, 21:37

Thanx!

Is There a way to hide the price in case the product is not available?

And is there a way to put the text “not available” on the product list?

Marek 15 Dec 2017, 12:04

The price is hidden now. As for “not available” text, I didn’t find such option for category page

Nathalia 20 Dec 2017, 14:31

Hi, i did some changes on the code, and i got.

First I created a new file, calls outofstock.tpl
Here is the code:

{if $product.show_price}

<div>
  {block name='product_price'}
        <span class="sem-estoque">out of stock</span>
  {/block}

</div>
{/if}

The, in the file themes/alysum/templates/catalog/_partials/miniatures/product.tpl
I put an if to do not show the price, like this:

{if $product.quantity > 0}

      {if (isset($smarty.cookies.pm_price) && ($smarty.cookies.pm_price == true)) || (isset($pkts.pm_price) && $pkts.pm_price == true)}
      {block name='product_price_and_shipping'}
        {if $product.show_price}
          <div class="product-price-and-shipping">
            {if $product.has_discount}
              {hook h='displayProductPriceBlock' product=$product type="old_price"}
              <span class="regular-price">{$product.regular_price}</span>
              {if $product.discount_type === 'percentage'}
                <span class="discount-percentage">{$product.discount_percentage}</span>
              {/if}
            {/if}
            {hook h='displayProductPriceBlock' product=$product type="before_price"}
            <span itemprop="price" class="price">{$product.price}</span>
            {hook h='displayProductPriceBlock' product=$product type='unit_price'}
            {hook h='displayProductPriceBlock' product=$product type='weight'}
          </div>
        {/if}
      {/block}
      {/if}
      {/if}

In the end, i called the file that I created:

{if $product.quantity < 1}

        {block name='product_add_to_cart'}
          {include file='catalog/_partials/product-outofstock.tpl'}
        {/block}
      {/if}
  </div>
</div>
Marek 21 Dec 2017, 12:15

Great. have I to do something?

Nathalia 21 Dec 2017, 12:16

No, i’m just sharing

Marek 21 Dec 2017, 12:17

Thank you very much for sharing