Jump to content

Prestashop 1.7.4 - Show stock quantities in product list


gunril

Recommended Posts

Hello,

Using prestashop 1.7.4.2

Does anyone now how to get the stock quantities like shown into the product details into the product list ? Not the into cart button but the real quantities that are available like 5 items in stock, 20 items in stock .....

I managed to do this from the product details into the product additional info but i can't get it into the product list.

I already use the product availability field in the product list but does use it to show the delivery time.

I thought by putting the beneed code into the theme/templates/catalog/_partials/miniatures.product.tpl but it doesn't work.

{block name='product_quantities'}
    {if $product.show_quantities}
      <div class="product-quantities" style="margin:10px 0 10px 0;">
        <label class="label">{l s='In stock' d='Shop.Theme.Catalog'}</label>
        <span data-stock="{$product.quantity}" data-allow-oosp="{$product.allow_oosp}">{$product.quantity} {$product.quantity_label}</span>
      </div>
    {/if}
  {/block}

https://tassenverkoop.be

Hope that anyone knows this.

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
On 2/25/2019 at 12:59 AM, snaiaja said:

Hello,
what you are trying to achieve is very simple just insert the following code where  you want:

Currently in stock: {$product->quantity}

P.s. where "Currently in stock", use any text you want. Also add classes if needed.

Hi Snaiaja,

I'm trying to display the product quantity for every product (regardless I have 1 piece or 100 pcs in stock)! 

I want to follow your suggestion, inserting Currently in stock: {$product->quantity}, but I don't know how to add it exactly in the product.tpl file.  (/themes/classic/templates/catalog/_partials/miniatures/).

May can you help me?

https://www.dailyshopbay.com

Thanks in advance

 

Link to comment
Share on other sites

  • 4 months later...
  • 2 weeks later...
  • 4 months later...
  • 2 months later...
  • 7 months later...
On 1/29/2020 at 4:28 PM, Atlasan said:

Finally, time later, I had to set up the debug tool and step by step find the way to do what I was trying to archive: getting the stock available for the combination and preventing the unavailable products to be displayed!!

How did you manage to get the stock quantity to show based on the combination???

Link to comment
Share on other sites

That won't solve my issue i'm afraid.

{$product->quantity} 
This shows the quantity of a product. I got it working in the product.tpl file

But it doesn't update when I select another combination of my product.
It does update on the product details block which has been coded by PrestaShop itself.

But I can't figure out the logic. How they got it to update there whenever another combination is selected.

Link to comment
Share on other sites

  • 1 year later...

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...