Scot's Scripts FAQs and Module Support

If you don't find the answers here contact us.
Documentation and support for our Miva modules is found here. If you can't find the answer you're looking for contact us and we'll add the information.

ProContent / Load Explicit Categories and Products

Load Explicit Categories and Products

You can load 1 or more products into an array that you can loop through using the :load_products command. The products also load as individual data items. Examples of both are below.

Product Array

Let's say you have four products (example codes P1, P2, P3, and P4) that you want to display on your front page. Instead of manually creating content for each product, load them up in an array and display them like any other array of products.

This example will load the four products into an array then loop through the array displaying the products.

<mvt:item name="ProContent" param=":load_products P1 P2 P3 P4" />
 
<mvt:foreach iterator="product" array="ProContent:products">
  <h2>&mvt:product:name; (&mvt:product:code;)</h2>
</mvt:foreach>

To use the data when checking for conditions within the loop, the array data is l.settings:product:name (or whatever product variables you decide to use.)

Product Data

If you wanted to load those four products but display them when and where you wanted without using a loop, individual product data is available. In the example below we will display the data for product P2 (from above)

<mvt:item name="ProContent" param=":load_products P1 P2 P3 P4" />
  <h2>&mvt:ProContent:P4:name; (&mvt:ProContent:P4:code;)</h2>

To use the data when checking for conditions, the individual product data is checked with l.settings:ProContent:P3:name (or whatever product code/variables you want to access.)

Category Array

This is just like the product array above except we'll use the :load_categories command instead.

<mvt:item name="ProContent" param=":load_categories CAT1 CAT2 CAT3 CAT4" />
 
<mvt:foreach iterator="category" array="ProContent:categories">
  <h2>&mvt:category:name; (&mvt:category:code;)</h2>
</mvt:foreach>

All the associated sub-categories are also loaded. if you want to roll through the sub-categories, expand the code above with another loop.

<mvt:item name="ProContent" param=":load_categories CAT1 CAT2 CAT3 CAT4" />
 
<mvt:foreach iterator="category" array="ProContent:categories">
  <h2>&mvt:category:name; (&mvt:category:code;)</h2>
  <mvt:foreach iterator="subcat" array="category:subcats">
    &nbsp; &nbsp; <i>&mvt:subcat:name; (&mvt:subcat:code;)</i>
    <br>
  </mvt:foreach>
</mvt:foreach>

To use the data when checking for conditions within the loop above, the array data is l.settings:category:name (or whatever product variables you decide to use.)

Category Data

This also uses the same idea as product data.

<mvt:item name="ProContent" param=":load_categories CAT1 CAT2 CAT3 CAT4" />
  <h2>&mvt:ProContent:CAT4:name; (&mvt:ProContent:CAT4:code;)</h2>

To use the data when checking for conditions, the individual product data is checked with l.settings:ProContent:CAT4:name (or whatever category code/variables you want to access.)

Category Links

Here is how to create links out of your categories and sub-categories.

/Store_Code=&mvt:global:store_code&Screen=CTGY&Category_Code=&mvt:ProContent:CAT1:code;

Here's the sub-category example with links.

<mvt:item name="ProContent" param=":load_categories CAT1 CAT2 CAT3 CAT4" />
 
<mvt:foreach iterator="category" array="ProContent:categories">
  <h2><a href="merchant.mvc?Store_Code=&mvt:global:store_code&Screen=CTGY&Category_Code=&mvt:category:code;">&mvt:category:name; (&mvt:category:code;)</a></h2>
  <mvt:foreach iterator="subcat" array="category:subcats">
    &nbsp; &nbsp; <a href="merchant.mvc?Store_Code=&mvt:global:store_code&Screen=CTGY&Category_Code=&mvt:subcat:code;"><i>&mvt:subcat:name; (&mvt:subcat:code;)</a></i>
    <br>
  </mvt:foreach>
</mvt:foreach>
updated May 14, 2013