Jump to content

[SOLVED] Always showing "Available" in product list with 0 items on stock!


Recommended Posts

Find solution for this.

Prestashop 1.5.4.1

 

Change in themes/yourtheme/product-list.tpl this





{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if}

for this





{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.quantity > 0)}{l s='Available'}</span>{else}<span class="outofstock">{l s='Out of stock'}{/if}</span>{/if}

For convenience i'm created classes called "outofstock" and "availability" after that you can add a different colors for "Out of stock" and "Availability" status, like this.

You should add code to to themes/yourtheme/css/product-list.css







#product_list li span.availability {
   color: #189d1e
}

#product_list li span.outofstock {
   color: #ED3838
}

SOLVED

 

Link to comment
Share on other sites

  • 4 weeks later...

this is extremly helpful!

What if I need a third information about stock availability? I mean if i would like to have "out of stock" "available for orders only" (never in stock) and "in stock" labels?

 

When I looked at the piece of code you posted here and the previous one it seems to me that it could be done just by adding the correct part to the line and it could work...am I right?

Link to comment
Share on other sites

the code from kotkotan works perfectly but doesn't apply to my need mentioned in my previous post.

Basically what I need my customers to see is the information whether it is in stock (for example to say "In Stock") or on order (for example to say "available on order") and the information "out of stock" let still exist for products not available to order

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

i'm using prestashop 1.6.0.9

 

can't find those line on product-list.tpl

From:

<link itemprop="availability" href="http://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='Out of stock'}{/if}{else}{l s='In stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}

 

Change to:

<link itemprop="availability" href="http://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='Out of stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}

 

SOLVED

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...