Is there a "helper" function which I can MvDO with my script to retrieve and update Inventory data?
(2004/09/09)Yes. The module contains a function which can be MvDOne for this:
InventoryManager_process(task, product_id, attr_string, quantity)
Where:
'product_id' is the product's id which you are retrieving data for
'attr_string" is the tracked item's "attribute string" (which identifies the tracked attributes), if any. It has to be in the format:
[attribute id]=option id,[attribute id2]=option id, etc.
'quantity' is the inventory count to which you want to update the prdouct (if the "task" is "change_level" then the quantity is the level to which the item's assigned level is to be changed to)
'task' can be multiple different things depending on the action you want to take (note that not all fields of the function call are used by all tasks; eg. the value passed in "quantity" matters only when the task is 'adjust_count'):
count returns the current inventory count for product_id
long_message returns the product's current level's long message
short_message returns the product's current level's short message
permit_display reutrns 1 if the product's current level permits display, 0 otherwise
permit_sale returns 1 if the product's current level permits sale, 0 otherwise
level_name returns the current inventory level (name)
level returns the current inventory level (id). If the current level is "none", returns 0
tracking returns 1 if the items inventory is being tracked, 0 otherwise
update_level_all updates ALL product's current level to match their inventory.
update_level update the product's current level to match it's current inventory (used for updating the level if your import does not import the current level).
adjust_count changes the product's current inventory count to the value passed in 'quantity'. The current level is automatically updated accordingly. If the item is in "simple mode" it will be switched out of that mode into regular tracking.
change_level changes the items level to whatever value is passed in the quantity field. If the item is not currently in "simple" mode it will be changed to "simple". This can be used to change the inventory level when using simple tracking.
structure returns a structure for product_id (with most fields corresponding to the tasks described above):
varname:product_id
varname:attr_string
varname:error
varname:count
varname:level
varname:level_name
varname:permit_sale
varname:permit_display
varname:tracking
Eg. the code:
would populate the variable l.structure as a Miva structure with the members listed above.
If the function encounters an error it returns that error as text (of the form 'ERROR: description') or passes it in the structure member error (eg. l.varname:error).
Last update: 2005-01-12 09:11
Author: Support
Revision: 1.0
You cannot comment on this entry
Most Recent FAQ Entries: 
- I have the module configured to add the key ... (2008-08-13 14:50)
- What is the format for the htaccess file if ... (2008-08-12 14:50)
- Is there any way to look up a customer's ... (2008-08-06 18:04)
- I am looking for a module that will allow ... (2008-08-06 18:00)
- Is it possible to display a link in Phone ... (2008-08-06 12:05)
Top 10 
- 2754 views:
Adding Tokens to Evaluate Expressions - 2698 views:
Is there a way to "Limit" the number of ... - 2654 views:
Why won't you call me for technical support? I ... - 2549 views:
Are license keys valid for more than one store? ... - 2447 views:
I'm trying to enter a license key and get ... - 2425 views:
How do I install a module? - 2286 views:
How do I check for a module upgrade? - 2255 views:
How can display and change the parameters of an ... - 2097 views:
The total on my checkout pages are not correct. ... - 1932 views:
I have select and radio type attributes in my ...
















