Please note: The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please post in our forum, but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance.
This snippet is really more a proof of concept than anything else, but it'll probably turn into much more as additional requests come in.
This comes in two pieces. One piece is a simple snippet that returns one chunk (like a “buy now” link) if the inventory TV is >0, another chunk if the inventory TV =0. The other piece is a snippet that will process the XML Data Feed that FoxyCart sends your way.
Current versions are in the MODx Resource Repository:
Using the Inventory TV you can make a quick and easy Ditto call to filter your products based on stock level:
&hideFolders=`1` &filter=`inventory,5,4` &tpl=`iteminfo`
Adding the above line to a ditto call of your products catalog will show products that have less than 5 stock remaining. Broken up, each bit means:
<div class="stockItem"> [+title+]<br /> Code:[+code+] <br /> Current stock level:[+inventory+] </div>
This is a very basic example, but its a good start in expanding on the foxycart inventory control a little.