Stock Message

I’m trying to work out how to do the following and am getting a little stuck so any help that anyone can give me would be appriciated.



I’m going to turn inventory tracking on and then I want to show a different message based on if I set the product inventory to 1, 2 or 3. I’ve added 3 new language variables to cover the messages but I’m unsure of the IF statement I’d need to use to carry this out.



It would also be good if I could put it in a hook so that my changes are not overwritten but after reading the info about hooks on here my brain hurts :slight_smile:



Thanks guys.

You need to add if statements testing for the quantity in /skins/YOURSKIN/customer/views/products/components/buy_now.tpl



There is existing code testing for an inventory quantity less than 0:

{if ($product.amount <= 0 || $product.amount < $product.min_qty) && $product.tracking == "B"}
{$lang.text_out_of_stock}
{else}
{$product.amount} {$lang.items}
{/if}




You should be able to mimic this code to add your new tests and display your language variables.



You will be able to make your changes using a hook. You will need to install the Local Configuration add-on and create the hook file - /skins/YOURSKIN/customer/addons/local/hooks/products/options_advanced.override.tpl. There is an example using this very hook in the following post and it also explains how to install the Local Configuration add-on:



[url]http://forum.cs-cart.com/showpost.php?p=55292&postcount=2[/url]



Bob