Miva Merchant 5 Module FAQs » Inventory Manager 5.x


{docurl}

Using the module's tokens inside of the "Product Attribute Display" field

Is it possible to display the inventory count for tracked attributes and options by adding the module's component tokens to the "Product Attribute Template" template? Similarly, is it possible to use tokens there to restrict the display of "out of stock" options?

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

The component tokens discussed in the Inventory Manager documeantation should work in the "Product Attribute Template".
Say you want to modify the attribute template so out of stock "select" type options are not displayed in the drop-down boxes displayed on the product page (the PROD screen). To accomplish this you would modify the "Product Attribute Template" of the "Product Display" page template.

In that template you'll find the html/code that displays the "select" type attributes:

<select name="Product_Attributes[&mvt:attribute:index;]:value">
<mvt:foreach iterator="option" array="attribute:options">
<mvt:if expr="( ( g.Product_Attributes[l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR ( g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code )">
<option value="&mvte:option:code;" selected>&mvte:option:prompt;</option>
<mvt:else>
<option value="&mvte:option:code;">&mvte:option:prompt;</option>
</mvt:if>
</mvt:foreach>
</select>


To make the display of the options dependent on their current inventory level you would add the token & conditional above and around the dispaly of the options:

<select name="Product_Attributes[&mvt:attribute:index;]:value">
<mvt:foreach iterator="option" array="attribute:options">
<mvt:item name="BROK_INVENTORY" param="attr_display" />
<mvt:if expr="g.BROK_INVENTORY:attr_display">
<mvt:if expr="( ( g.Product_Attributes[l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR ( g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code )">
<option value="&mvte:option:code;" selected>&mvte:option:prompt;</option>
<mvt:else>
<option value="&mvte:option:code;">&mvte:option:prompt;</option>
</mvt:if>
</mvt:if>
</mvt:foreach>
</select>


If you have any particular questions about the token usage open a ticket in our help desk at http:///www.vikingcoders.com/helpdesk/ and we'll be happy to help.



Last update: 2010-02-08 20:53
Author: Michael Brock
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