sm5k Posted January 14, 2014 Share Posted January 14, 2014 Hi friendly Presta Community, i need to put an custom image based on the Stock Status showing up in product list and product detail page. Image 1 should show up if stock status is "avialible for order". Image 2 should show up if stock status is "out of Stock". I use the default theme with several modifikations. Think that could be done really simple but don`t know how Guess it must be done in product.tpl and product-list.tpl I add a screenshot of how it should look like. So thanx a lot in advanced for any information about that. Greetz SM5K Link to comment Share on other sites More sharing options...
vekia Posted January 14, 2014 Share Posted January 14, 2014 i suppose that "avialible for order" and "out of stock" are based on quantity field, that's right? if so, solution will be easy. just let me know. Link to comment Share on other sites More sharing options...
sm5k Posted January 14, 2014 Author Share Posted January 14, 2014 Hi Vekia, thank you for the answer and your time The Out Of Stock should be indicated by Product Quantity == 0 The Availible for order should be indicated by Product Quantity >=1 So i think this is what you mean with "based on Quantity Fields". Thank YOU! Link to comment Share on other sites More sharing options...
vekia Posted January 14, 2014 Share Posted January 14, 2014 image if product is available to order (in stock) {if $product->quantity > 0} <img src="AVAILABLE TO ORDER IMAGE" /> {/if} image when product is out of stock: {if $product->quantity ==0} <img src="OUT OF STOCK IMAGE" /> {/if} 1 Link to comment Share on other sites More sharing options...
sm5k Posted January 14, 2014 Author Share Posted January 14, 2014 (edited) Hi Vekia, your answer is like everytime more than really helpfull. Going to test it later. Thinking about doing a "Vekia" Fanpage on Facebook Greetz and a lot a thanx SM5K Edited January 14, 2014 by sm5k (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 14, 2014 Share Posted January 14, 2014 you're welcome And thank you for your kind words im happy that i could help you one more time i marked whole topic as [solved] with regards, Milos Link to comment Share on other sites More sharing options...
sm5k Posted January 15, 2014 Author Share Posted January 15, 2014 Hey Vekia (Milos) Just for full information to the next that could needs this. <!-- Sold out part --> {if $product.quantity == 0} <img width="129px" height="260px" src="http://yourshopdomain.com/img/p/yourimagename2.png" /> {/if}<!-- Ende Sold out part --><!-- On Stock part --> {if $product.quantity > 0} <img width="129px" height="260px" src="http://yourshopdomain.com/img/p/yourimagename2.png" /> {/if}<!-- End of On Stock part --> So just use $product.quantity instead of $product->quantity Enjoy the day. Greetz SM5K PS: Thank you for marking as solved 1 Link to comment Share on other sites More sharing options...
vekia Posted January 15, 2014 Share Posted January 15, 2014 brilliant :-) Link to comment Share on other sites More sharing options...
Ron morales Posted February 17, 2014 Share Posted February 17, 2014 what its your ps version? Link to comment Share on other sites More sharing options...
vekia Posted February 18, 2014 Share Posted February 18, 2014 as far as i remember author of this thread used latest release of PS, but in fact, problem is solved. you're looking for the same feature? 1 Link to comment Share on other sites More sharing options...
sm5k Posted February 18, 2014 Author Share Posted February 18, 2014 Hi Ron morales, this has been done in Prestashop 1.5.5. If have any further questions on this, you can contact me. Regards, SM5K Link to comment Share on other sites More sharing options...
PrestaShark Posted February 18, 2014 Share Posted February 18, 2014 Good job there Vekia. I wonder if this possible to view stock quantities in bootstrap style like here {if $product->quantity > 40} <div class="progress"> <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="99" aria-valuemin="0" aria-valuemax="99" style="width: 99%"> <span class="sr-only">Stock is full</span> </div> </div> {/if} {if $product->quantity > 30} <div class="progress"> <div class="progress-bar progress-bar-primary" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="75" style="width: 75%"> <span class="sr-only">Stock is quite large</span> </div> </div> {/if} {if $product->quantity > 20} <div class="progress"> <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="50" style="width: 50%"> <span class="sr-only">Stock is on half</span> </div> </div> {/if} {if $product->quantity > 10} <div class="progress"> <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="25" aria-valuemin="0" aria-valuemax="25" style="width: 25%"> <span class="sr-only">Stock is almost empty</span> </div> </div> {/if} {if $product->quantity > } <div class="progress"> <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="1" aria-valuemin="0" aria-valuemax="1" style="width: 1%"> <span class="sr-only">Out of stock!</span> </div> </div> {/if} Unfortunately its not working ;/ Link to comment Share on other sites More sharing options...
ventesites Posted August 21, 2014 Share Posted August 21, 2014 (edited) hi where exactly do you apply this modif? product_list.tpl ? so far the stock management code (version 1.6.9) is : {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))} {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)} <span itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="availability"> {if ($product.allow_oosp || $product.quantity > 0)} <span class="{if $product.quantity <= 0 && !$product.allow_oosp}out-of-stock{else}available-now{/if}"> <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='In 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} </span> {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)} {else} <span class="out-of-stock"> <link itemprop="availability" href="http://schema.org/OutOfStock" />{l s='Out of stock'} </span> {/if} do you replace all the above with the codes provided? thanks pat Edited August 21, 2014 by ventesites (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now