ProContent /
Rotating Category Products
Rotating Category Products
It couldn't be easier. Simply tell it which category you want to rotate products from. It will then load up data for you in &mvt;ProContent:code:product where code is your store category
code that will be used for product rotation. Inactive products are skipped automatically.
For the following discussion, I'm going to use a make believe store category called modules in all the examples. The category can be any category in your store.
The example below will load rotating product data from the category.
<mvt:item name="ProContent" param=":rotate products modules repeat3" />
The repeat3 command at the end means it will repeat three times, load three times, before moving on to the next product.
Note: this feature will not display the product data, you will need to do that. If you wanted to display the name and code of the product you loaded from a category with the code of "modules", you would display it as such:
&mvt:ProContent:modules:products:name;
&mvt:ProContent:modules:products:code;
The associated category data is also loaded and is accessed: &mvt:Procontent:modules:products:category (remember, modules is the content code for this example, it could be anything.)
For example, here's how you would display the name and code from the category data:
&mvt:ProContent:modules:products:category:name;
&mvt:ProContent:modules:products:category:code;
Loading Product Arrays
You can load a range of products into an array as well. This is useful for creating slideshows or a product tile display. To do this, add the loadnum command into the parameter. In the example below, I'm going to load three products into the array.
<mvt:item name="ProContent" param=":rotate products modules load3" />
Set your foreach loop like the following. I've also included example code on using the data.
<mvt:foreach iterator="product" array="ProContent:modules:rotation:products">
&mvt:product:name; (&mvt:product:code;)
<br>
<mvt:if expr="l.settings:product:code EQ 'specials'">
<h1>Special Today!</h1>
</mvt:if>
</mvt:foreach>
If you've loaded a product array, the data is also available in l.settings:ProContent:products. You can bypass using the longer array name and use array="ProContent:products". This is especially useful when loading a product array from multiple categories (see bottom of entry.) If you use this method, you can also access the product category information as a member of the products array (ProContent:products:category:name for example.)
You can include the repeat command to set the weight of the rotation, just add it to the end after the load command.
You can also access the product parent category information via l.settings:ProContent:modules:rotation:category.
Loading Product Arrays From Multiple Categories
Sometimes you want to load products from several categories. Simply link the categories together in the parameter using the | symbol. In the following example I'll link the categories modules, scripts, and templates together to get products from all of those categories.
<mvt:item name="ProContent" param=":rotate products modules|scripts|templates load3" />
This loads products from three categories into the ProContent:products array, and it loads separate product arrays for each category that are accessed the same way as the Loading Product Arrays section above.
Why are the variable names so long? There is a lot of data floating around in a Miva Merchant environment and this way ProContent data isn't getting mixed up in any of it, or other modules, data.
updated May 14, 2013