steveosoule
4/10/2014 - 12:01 AM

Miva - PROD Schema Markup / Structured Data / Micro Data

Miva - PROD Schema Markup / Structured Data / Micro Data

<mvt:comment>
	<!--
	|
	| Google Rich Snippets
	|
	-->
</mvt:comment>

<mvt:item name="toolkit" param="variantarray|l.all_settings:product:variant_count|l.all_settings:product:code" />

<mvt:comment><!-- Sort variants by quantity highest to lowest, effort to get google to not mark out of stock when first in list is out. --></mvt:comment>
<mvt:do file="g.module_library_utilities" name="l.null" value="QuickSortArray(l.settings:variants, ':count_onhand', -1)" />

<mvt:if expr="l.settings:product:variant_count">
	<mvt:foreach iterator="variant" array="variants">
		<div itemscope itemtype="http://schema.org/Product">
			<meta itemprop="productID" content="&mvt:variant:variant_code;" />
			<meta itemprop="name" content="&mvte:variant:variant_name;" />
			<mvt:if expr="l.settings:product:customfield_values:customfields:brand">
				<meta itemprop="brand" content="&mvt:product:customfield_values:customfields:brand;" />
			</mvt:if>
			<mvt:item name="toolkit" param="customimagec|l.all_settings:variant:image|l.all_settings:variant:variant_code|main" />
			<mvt:if expr="l.settings:variant:image">
				<mvt:assign name="l.settings:variant:image" value="'http://' $ g.domain:name $ '/mm5/' $ l.settings:variant:image" />
				<meta itemprop="image" content="&mvte:variant:image;" />
			</mvt:if>
			<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
				<mvt:if expr="ISNULL l.settings:variant:price">
					<mvt:assign name="l.settings:variant:price" value="l.settings:product:price" />
				</mvt:if>
				<meta itemprop="price" content="&mvt:variant:price;" />
				<meta itemprop="priceCurrency" content="USD" />
				<mvt:if expr="l.settings:variant:count_onhand GT 0">
					<meta itemprop="availability" content="http://schema.org/InStock" />
					<meta itemprop="inventoryLevel" content="&mvte:variant:count_onhand;" />
				<mvt:else>
					<meta itemprop="availability" content="http://schema.org/OutOfStock" />
					<meta itemprop="inventoryLevel" content="0" />
				</mvt:if>
			</div>
		</div>
	</mvt:foreach>
<mvt:else>
	<div itemscope itemtype="http://schema.org/Product">
		<meta itemprop="productID" content="&mvte:product:code;" />
		<mvt:if expr="l.settings:product:sku">
			<meta itemprop="sku" content="&mvte:product:sku;" />
		</mvt:if>
		<meta itemprop="name" content="&mvte:product:name;" />
		<mvt:if expr="l.settings:product:customfield_values:productimagecustomfields:main">
			<meta itemprop="image" content="http://&mvt:global:domain:name;/mm5/&mvt:product:customfield_values:productimagecustomfields:main;" />
		</mvt:if>
		<mvt:if expr="l.settings:category:id">
			<meta itemprop="category" content="&mvte:category:name;" />
		</mvt:if>
		<mvt:if expr="l.settings:product:customfield_values:customfields:brand">
			<meta itemprop="brand" content="&mvt:product:customfield_values:customfields:brand;" />
		</mvt:if>
		<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
			<meta itemprop="price" content="&mvt:product:price;" />
			<meta itemprop="priceCurrency" content="USD" />
			<mvt:if expr="l.settings:product:inv_active">
				<mvt:if expr="l.settings:product:inv_level EQ 'in'">
					<meta itemprop="availability" content="http://schema.org/InStock" />
				<mvt:elseif expr="l.settings:product:inv_level EQ 'low'">
					<meta itemprop="availability" content="http://schema.org/LimitedAvailability" />
				<mvt:elseif expr="l.settings:product:inv_level EQ 'out'">
					<meta itemprop="availability" content="http://schema.org/OutOfStock" />
				</mvt:if>
				<meta itemprop="inventoryLevel" content="&mvt:product:inv_available;" />
			</mvt:if>
		</div>
	</div>
</mvt:if>