Sébastien L Posted March 28, 2014 Share Posted March 28, 2014 (edited) Hello, I want to display "Last Quantities in stock" on my product list. (prestashop 1.5.6.) To this end, I found this code to add quantiy informations to product-list.tpl. {*Added quantity in stock*} <!-- 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> <!-- number of item in stock --> {*if ($display_qties == 1 && !$PS_CATALOG_MODE && $product.available_for_order) *} <p id="pQuantityAvailable"{if $product.quantity <= 0} style="display: none;"{/if}> <span id="quantityAvailable">{$product.quantity|intval}</span> <span {if $product.quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}</span> <span {if $product.quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}</span> </p> {*/if*} <!-- Out of stock hook --> <p id="oosHook"{if $product.quantity > 0} style="display: none;"{/if}> {$HOOK_PRODUCT_OOS} </p> <p class="warning_inline" id="last_quantities"{if ($product.quantity > $last_qties OR $product.quantity <= 0) OR $allow_oosp OR !$product.available_for_order OR $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}</p> {*End Added quantity in stock*} Problem : the last part of this code "Warning: Last items in stock!" don't work. Any idea to solve it ? Thank you in advance Edited March 28, 2014 by slett (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted March 29, 2014 Share Posted March 29, 2014 This line should NOT show (because of style="display: none" ) when: 1) if ($product.quantity > $last_qties $last_qties is defined in Presferences->Products: This line should NOT show when: 2) OR $product.quantity <= 0) Of course, if no more products, this line shouldn't be shown... This line should NOT show when: 3) OR $allow_oosp When you can order out of stock products it shouldn't show. This line should NOT show when: 4) OR !$product.available_for_order When the product cannot be ordered (In Product->Edit, General Tab), it shouldn't show. This line should NOT show when: 5) OR $PS_CATALOG_MODE} When in catalog mode (no orders possible) it shouldn't show {l s='Warning: Last items in stock!'}</p> So pleae check: Does any product which: has stock less than the amount given in Preferences->Products, which has stock more than 0, (normally Product->Edit, quantities tab) that cannot be ordered when out of stock, (Preferences->Products, almost at end of page) which IS available for order, (Product ->Edit) and you didn't turn or catalog mode, (Preference->Products) not show the line? pascal 2 Link to comment Share on other sites More sharing options...
Sébastien L Posted March 29, 2014 Author Share Posted March 29, 2014 (edited) So pleae check: Does any product which: has stock less than the amount given in Preferences->Products, OK which has stock more than 0, (normally Product->Edit, quantities tab) OK that cannot be ordered when out of stock, (Preferences->Products, almost at end of page) OK which IS available for order, (Product ->Edit) OK and you didn't turn or catalog mode, (Preference->Products) OK not show the line? pascal Hello Pascal, Thanks for your answer. For this 5 cases, it's ok. The {l s='Warning: Last items in stock!'} is showing in product page (product.tpl), but it don't work in product-list page, and I don't know why. Any idea ? Edited March 29, 2014 by slett (see edit history) Link to comment Share on other sites More sharing options...
Sébastien L Posted April 25, 2014 Author Share Posted April 25, 2014 Hello, I found the explanation, the variable $last_qties is not called from the product-list.tpl page. An idea to call this variable for this page? Thank you Link to comment Share on other sites More sharing options...
Sébastien L Posted July 29, 2014 Author Share Posted July 29, 2014 Hello, Any idea ? Thank you 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