kotkotan Posted October 4, 2013 Share Posted October 4, 2013 Hello! When i'll type quantity for product "0" it is whatever has status "Available" in product list. In product page it's ok. There are status "out of stock"... Who knows how i can fix it? Link to comment Share on other sites More sharing options...
kotkotan Posted October 4, 2013 Author Share Posted October 4, 2013 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 More sharing options...
vekia Posted October 4, 2013 Share Posted October 4, 2013 hello thank you for your solution, im convinced that it will be helpful for other merchants here im going to mark this thread as [solved] with regards, Milos Link to comment Share on other sites More sharing options...
Randaal Posted October 29, 2013 Share Posted October 29, 2013 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 More sharing options...
vekia Posted October 29, 2013 Share Posted October 29, 2013 if you use default stock features, it should work after pasting code from kotkotan's solution Link to comment Share on other sites More sharing options...
Randaal Posted October 29, 2013 Share Posted October 29, 2013 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 More sharing options...
aficionado Posted November 7, 2013 Share Posted November 7, 2013 Hello,Thank you for this great code!How to operate with the colour attributes? (I put attributes in product list.)If I'm out of stock in red colour, and black colour in stock, the message is the same "out of stock" for all ... Many thanks in advance! Link to comment Share on other sites More sharing options...
boodeey Posted November 14, 2014 Share Posted November 14, 2014 (edited) i'm using prestashop 1.6.0.9 can't find those line on product-list.tpl Edited November 14, 2014 by boodeey (see edit history) Link to comment Share on other sites More sharing options...
boodeey Posted November 14, 2014 Share Posted November 14, 2014 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 1 Link to comment Share on other sites More sharing options...
Recommended Posts