ghost4life Posted May 31, 2013 Share Posted May 31, 2013 Hi, Instead of displaying the numpber of product available I would like to display some lights of coulour for informing the custommer availibility. In fact I think it is better to display "In stock", than 3 products left. So I started to edit the .tpl, but I really do not know what need to be chnaged in order to works. So here is the part interesting : <!-- availability --> <p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> <span id="availability_label">{l s='Availability:'}</span> <span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}</span> </p> <p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}> <span id="availability_date_label">{l s='Availability date:'}</span> <span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span> </p> <!-- number of item in stock --> I would like to add, this picture if quantity equal zero or less, <img src=\'images/red.gif\' title=\'Produit hors stock\'> this one if between 0 and 5 <img src=\'images/orange.gif\' title=\'Attention, dernières pièces disponibles\'> and this one if upper than 5 <img src=\'images/green.gif\' title=\'Produit en stock\'> Anykind of help will be much appreciated. Kind regards Link to comment Share on other sites More sharing options...
ghost4life Posted May 31, 2013 Author Share Posted May 31, 2013 Bonjour, j'ai fais cela : {if $product->quantity == 0}<span id="quantityAvailableTxt"><img src='images/red.gif' title='Produit en rupture de stock'> Produit en rupture de stock</span>{/if} {if $product->quantity >= 1 AND $product->quantity <=5}<span id="quantityAvailableTxt"><img src='images/orange.gif' title='Attention : Dernières quantités disponible'> Attention : Dernières quantités disponible</span>{/if} {if $product->quantity > 5}<span id="quantityAvailableTxt"><img src='images/green.gif' title='Produit en Stock'> Produit en stock</span>{/if} I've done this code but it does not work when we have some declination of products. Link to comment Share on other sites More sharing options...
ghost4life Posted June 4, 2013 Author Share Posted June 4, 2013 anyone ? Link to comment Share on other sites More sharing options...
vekia Posted June 4, 2013 Share Posted June 4, 2013 you can use something like: {if $product->quantity > 5} IMAGE HERE {/if} the same for other quantities Link to comment Share on other sites More sharing options...
ghost4life Posted June 4, 2013 Author Share Posted June 4, 2013 Thanks for your reply, I've done that {if $product->quantity == 0}<span id="quantityAvailableTxt"><img src='images/red.gif' title='Produit en rupture de stock'> Produit en rupture de stock</span>{/if} {if $product->quantity >= 1 AND $product->quantity <=5}<span id="quantityAvailableTxt"><img src='images/orange.gif' title='Attention : Dernières quantités disponible'> Attention : Dernières quantités disponible</span>{/if} {if $product->quantity > 5}<span id="quantityAvailableTxt"><img src='images/green.gif' title='Produit en Stock'> Produit en stock</span>{/if} the trouble is that it does not take in count the declination Link to comment Share on other sites More sharing options...
ghost4life Posted June 4, 2013 Author Share Posted June 4, 2013 I've also tried this but it does not work, the reuslt is the same for each declination {if $product->checkQty($this->id) == 0}<span><img src='images/red.gif' title='Produit en rupture de stock'> Produit en rupture de stock</span>{/if} {if $product->checkQty($this->id) >= 1 AND $product->checkQty($this->id) <=5}<span><img src='images/orange.gif' title='Attention : Dernières quantités disponible'> Attention : Dernières quantités disponible</span>{/if} {if $product->checkQty($this->id) > 5}<span><img src='images/green.gif' title='Produit en Stock'> Produit en stock</span>{/if} Link to comment Share on other sites More sharing options...
ghost4life Posted June 5, 2013 Author Share Posted June 5, 2013 nobody is able to help me ? Link to comment Share on other sites More sharing options...
vekia Posted June 5, 2013 Share Posted June 5, 2013 what you've got in the $product->quantity output? can you use somewhere {$product->quantity} or {$product|print_r} to display all available variables? Does the quantity variable exist? Link to comment Share on other sites More sharing options...
ghost4life Posted June 5, 2013 Author Share Posted June 5, 2013 I don't know what it is but it display that http://omega-nutrition.fr/100-whey-premium-muscletech-proteines-48.html Link to comment Share on other sites More sharing options...
vekia Posted June 5, 2013 Share Posted June 5, 2013 thanks! it's really helpful! you've got there quantity field: [quantity] => 6 so the method: {if $product->quantity > 5}<span id="quantityAvailableTxt"><img src='images/green.gif' title='Produit en Stock'> Produit en stock</span>{/if} should work well :/ when you use this code, what you've got? nothing? Link to comment Share on other sites More sharing options...
ghost4life Posted June 5, 2013 Author Share Posted June 5, 2013 in fact I've done that code [/size] {if $product->quantity == 0}<span><img src='images/red.gif' title='Produit en rupture de stock'> Produit en rupture de stock</span>{/if} {if $product->quantity >= 1 AND $product->quantity <=5}<span><img src='images/orange.gif' title='Attention : Dernières quantités disponible'> Attention : Dernières quantités disponible</span>{/if} {if $product->quantity > 5}<span><img src='images/green.gif' title='Produit en Stock'> Produit en stock</span>{/if} but when I choose a declination which has 0 productsq in stock it still display in stock. Link to comment Share on other sites More sharing options...
vekia Posted June 5, 2013 Share Posted June 5, 2013 so, when quantity = 0 you've got two messages? {if $product->quantity == 0}<span><img src='images/red.gif' title='Produit en rupture de stock'> Produit en rupture de stock</span>{/if} {if $product->quantity >= 1 AND $product->quantity <=5}<span><img src='images/orange.gif' title='Attention : Dernières quantités disponible'> Attention : Dernières quantités disponible</span>{/if} am i right? Link to comment Share on other sites More sharing options...
ghost4life Posted June 5, 2013 Author Share Posted June 5, 2013 if equal to zero I have no products if quantity between 0 and 5 warning : last products in stock when it is upper to 5 product available in stock the trouble is when, please have a look there http://omega-nutrition.fr/100-whey-premium-muscletech-proteines-48.html when you choose chocolate the button add to cart is not display cause no stock, and the message is still the same as if the product was in stock when you choose vanilla in declination product in stock and button for add to cart is there. I mean, the button should change for each declination, but not. it is not displayed correctly Link to comment Share on other sites More sharing options...
ghost4life Posted June 7, 2013 Author Share Posted June 7, 2013 no one ? Link to comment Share on other sites More sharing options...
vekia Posted June 7, 2013 Share Posted June 7, 2013 hello this is related to the ajax queries and isn't as simple as it seems :/ Link to comment Share on other sites More sharing options...
ghost4life Posted June 7, 2013 Author Share Posted June 7, 2013 I bought a module but I've been screwed. In fact it does not manage the stock. This module is called rsi stock I bought it for almost 50€ I asked for reimbursment but they did not reply. Please have a look : http://omega-nutrition.fr/nitrotech-peformance-series-muscletech-proteines-isolat-49.html#/nitrotech_performance_series_18kg-chocolat it is down below near the battery stock. Link to comment Share on other sites More sharing options...
vekia Posted June 7, 2013 Share Posted June 7, 2013 it's because when you change attribute - AJAX sends query to the database, and retrieve informations about stock. It's hard to achieve this for external modules... i will try to debug it (with defalt product.tpl file and scripts) Link to comment Share on other sites More sharing options...
ghost4life Posted June 7, 2013 Author Share Posted June 7, 2013 but in the default product.tpl when you change declination it dispplay the good quantity. 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