entrancey Posted September 25, 2013 Share Posted September 25, 2013 Hi guys, Need help to display warning in product page if only as below: 3 and above quantities of stock doesn't display any warning 2 quantities of stock left warning display "“Last 2 items in stock!”" 1 quantity of stock left warning display "“Last items in stock!”" how can i add the code in product.tpl I believe below code call that warning to be displayed. <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> *in BO>PREFERENCES>PRODUCT> I've set Display remaining quantities when the qty is lower than 1 I'm using prestashop v1.5.4.1 Thanks in advance Link to comment Share on other sites More sharing options...
vekia Posted September 25, 2013 Share Posted September 25, 2013 use this simple code: {if $product->quantity ==2}{l s='Last 2 items in stock!'}{/if} {if $product->quantity ==1}{l s='Last item in stock!'}{/if} nothing more Link to comment Share on other sites More sharing options...
entrancey Posted September 26, 2013 Author Share Posted September 26, 2013 Hi Vekia, it doesnt work if i add those 2 lines of code and remove code below: <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> it also doesn't work if add those 2 lines of code with out removing code below: -> only show default warning "“Last items in stock!”" when product left 1 unit. <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> Thanks and have a nice day Link to comment Share on other sites More sharing options...
marcis Posted December 20, 2013 Share Posted December 20, 2013 Does it apply to the product or its combinations? (I mean, the available number of units) Thanks! Link to comment Share on other sites More sharing options...
Jan Jansen Posted February 27, 2014 Share Posted February 27, 2014 use this simple code: {if $product->quantity ==2}{l s='Last 2 items in stock!'}{/if} {if $product->quantity ==1}{l s='Last item in stock!'}{/if} nothing more Thanks but this doesnt work with attributes. The option in the back office-> products also doesnt work. Is there a solution for this with attributes?? Any input is welcome ! 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