rb10 Posted July 11 Share Posted July 11 Hi, I'd like to know if there's a way/form to display a message/image based on product availability, for example: 0 = NOT AVAILABLE / RED IMAGE 1 = LAST PIECE / ORANGE IMAGE 2-10 = MEDIUM QUANTITY / GREEN IMAGE 11-20 = GOOD AVAILABILITY / ETC. 21-100 = EXCELLENT AVAILABILITY / ETC. Thank you all Link to comment Share on other sites More sharing options...
El Patron Posted July 13 Share Posted July 13 here is basic guideline on how to achieve you can use, customize to suit youir needs prestaheroes-product-quantity-message.pdf Link to comment Share on other sites More sharing options...
rb10 Posted July 14 Author Share Posted July 14 15 hours ago, El Patron said: here is basic guideline on how to achieve you can use, customize to suit youir needs prestaheroes-product-quantity-message.pdf 2.77 kB · 0 downloads thanks for reply, but download not works Link to comment Share on other sites More sharing options...
El Patron Posted July 14 Share Posted July 14 (edited) 2 hours ago, rb10 said: thanks for reply, but download not works here is a general approach, you will need to customize to meet your needs Step 1: Edit your product template Go to your theme’s template file: For product pages: /themes/your-theme/templates/catalog/product.tpl For category/listing pages: /themes/your-theme/templates/catalog/_partials/miniatures/product.tpl Insert this code where you want the quantity message to appear: {* PrestaHeroes Stock Status Message *} {if $product.quantity == 0} <div class="stock-status out-of-stock">Not Available</div> {elseif $product.quantity == 1} <div class="stock-status low-stock">Last piece!</div> {elseif $product.quantity <= 10} <div class="stock-status medium-stock">Medium availability</div> {elseif $product.quantity <= 20} <div class="stock-status good-stock">Good availability</div> {else} <div class="stock-status in-stock">Excellent availability</div> {/if} Step 2: Add your CSS Add the following to your theme’s CSS file: .stock-status { font-weight: bold; margin: 10px 0; } .out-of-stock { color: #d32f2f; } .low-stock { color: #fbc02d; } .medium-stock { color: #388e3c; } .good-stock { color: #1976d2; } .in-stock { color: #388e3c; } Step 3: Make sure $product.quantity is available On the product page, this variable is usually already available. On category/listing pages, make sure your controller passes the quantity to the template. Edited July 14 by El Patron (see edit history) 1 Link to comment Share on other sites More sharing options...
rb10 Posted July 15 Author Share Posted July 15 Thanks, i ll try and i ll know u Link to comment Share on other sites More sharing options...
rb10 Posted July 15 Author Share Posted July 15 I tried and works very fine!! Thanks, another question, do you if is it possible set- preorder for some product ? 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