Miva Merchant 5 Module FAQs » Inventory Manager 5.x


{docurl}

I would like to conditionally display something for a product but only if the current level is '3'. How do I do this?

NOTE: in the latest versions of the module (updating is always a good idea) this is best accomplished using the values set by the module in the l.all_settings and l.settings variable (i.e. it now uses the same approach as Merchant itself). Details can be found in this FAQ on the subject:
Displaying and Controlling the Inventory Data



To get this functionality, use the token/item:

<mvt:item name="BROK_INVENTORY" param="define_variable" />

This will define a global variable consisting of:

g.BROK_INVENTORY:tracking
g.BROK_INVENTORY:product_id
g.BROK_INVENTORY:attr_string
g.BROK_INVENTORY:error
g.BROK_INVENTORY:count
g.BROK_INVENTORY:level
g.BROK_INVENTORY:level_name
g.BROK_INVENTORY:short_message
g.BROK_INVENTORY:long_message
g.BROK_INVENTORY:attr_message
g.BROK_INVENTORY:permit_sale
g.BROK_INVENTORY:permit_display

You can then test the variable's values such as:

<mvt:if expr="g.BROK_INVENTORY:level EQ '3'">
the level is 3
</mvt:if>

or display a value with:

&mvt:global:BROK_INVENTORY:level_name;

which will display the current level's name.

Keep in mind that you'll need to use the item

<mvt:item name="BROK_INVENTORY" param="define_variable" />

at a point in the template where an individual product's information is being displayed.  For example, it won't be properly defined in the global header and footer (at least not consistently) but could be used inside the:

<mvt:foreach iterator="item" array="basket:items">

</mvt:foreach>

in the "Basket Contents" template field of the BASK screen since in that iterator a specific product is being handled.



Last update: 2009-07-17 11:51
Author: Thor
Revision: 1.2

Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry