This is an old revision of the document!
- type:
- integration
- system:
- MODx
- name:
- Basic Inventory Tracking
- description:
- A basic inventory snippet, which uses MODx TVs and chunks to display "add to cart" or "out of stock" functionality, based on available inventory.
- date:
- 2007-10-11
- version:
- 0.1.0
- developer:
- http://www.themancan.com/
MODx Inventory Snippet
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:
Expanding the Inventory Snippet with MODx
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:
- &hideFolders=`1` = This stops any folders coming up in your results, useful if you have categories and sub-categories etc.
- &filter=`inventory,5,3` = Uses the tv “inventory” and the value “5” and the mode “3”, which means less than, to filter the results. Get more info on this here.
- &tpl=`iteminfo` = The final bit points to a template(chunk) that Ditto uses to style the results, for example:
<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.