xml Miva - 模板饲料 - variant_id,促销价和变种价格

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Miva - 模板饲料 - variant_id,促销价和变种价格相关的知识,希望对你有一定的参考价值。

<mvt:if expr="g.variant_id GT 0">
    <mvt:do file="g.Module_Library_DB" name="l.success" value="ProductList_Load_Variant(l.settings:product:id, g.variant_id, l.settings:loaded_variants)" />
    <mvt:if expr="l.settings:loaded_variants[1]:price GT 0">
        <mvt:do name="l.success" file="g.Module_Feature_TUI_UT" value="CommonComponentFields_Initialize_Product_Discounts_Runtime(l.settings:loaded_variants, miva_array_elements(l.settings:loaded_variants))" />
        <meta itemprop="price" content="&mvt:loaded_variants[1]:price;" />
    <mvt:else>
        <meta itemprop="price" content="&mvt:product:price;" />
    </mvt:if>    
<mvt:else>
    <meta itemprop="price" content="&mvt:product:price;" />
</mvt:if>
<mvt:if expr="NOT l.settings:record:variant:variant_id">
    <mvt:do name="l.settings:record:variant:product_part_count" file="g.Module_Library_DB" value="ProductVariantPartList_Load_Part(l.settings:record:variant:id, l.settings:record:variant:productvariantparts)" />
    <mvt:if expr="miva_array_elements( l.settings:record:variant:productvariantparts ) GT 0">
        <mvt:foreach iterator="pvp" array="record:variant:productvariantparts">
            <mvt:if expr="l.settings:pvp:product_id EQ l.settings:record:id">
                <mvt:assign name="l.settings:record:variant:variant_id" value="l.settings:pvp:variant_id" />
                <mvt:foreachstop />
            </mvt:if>
        </mvt:foreach>
    </mvt:if>
</mvt:if>
<mvt:assign name="l.settings:record:variant:canonical_uri" value="l.settings:record:canonical_uri $ '?variant_id=' $ l.settings:record:variant:variant_id" />
<mvt:foreach iterator="attribute" array="attributes">
	<mvt:foreach iterator="option" array="attribute:options">
		<mvt:if expr="l.settings:attribute:attmpat_id GT 0">
			<mvt:do file="g.Module_Library_DB" name="l.null" value="ProductVariantList_Load_AttributeTemplateOption(l.settings:attribute:attmpat_id, l.settings:option:id, l.settings:variantlist)" />
		<mvt:else>
			<mvt:do file="g.Module_Library_DB" name="l.null" value="ProductVariantList_Load_Product_Option(l.settings:product:id, l.settings:attribute:id, l.settings:option:id, l.settings:variantlist)" />
		</mvt:if>

		<mvt:foreach iterator="variant" array="variantlist">
			<mvt:do file="g.Module_Library_DB" name="l.null" value="ProductList_Load_Variant(l.settings:product:id, l.settings:variant:variant_id, l.variant)" />
		</mvt:foreach>

		<mvt:if expr="g.dump">
			<mvt:eval expr="glosub(miva_array_serialize(l.settings:variant), ',', '<br>')" />
			<hr>
		</mvt:if>

		<span class="product-color-swatch-item" data-item-var-id="&mvt:variant:variant_id;"><a href="#&mvte:option:code;" class="product-color-swatch-link" id="color-swatch-&mvte:option:code;" data-select-var-id="&mvt:variant:variant_id;" data-select-val="&mvte:option:code;" data-select-label="&mvte:option:prompt;"><img src="&mvte:option:image;" class="base-img" /></a></span>

	</mvt:foreach>
</mvt:foreach>
<mvt:do name="l.settings:getbaseprice" file="g.Module_Feature_TUI_UT" value="CommonComponentFields_Initialize_Product_Discounts_Runtime(l.settings:search_results:products, miva_array_elements(l.settings:search_results:products))" />
<mvt:do file="g.Module_Library_DB" name="l.success" value="ProductVariantList_Load_Variant( l.settings:product:id, l.settings:variant:variant_id, l.settings:variant:productvariant_options )" />

以上是关于xml Miva - 模板饲料 - variant_id,促销价和变种价格的主要内容,如果未能解决你的问题,请参考以下文章

xml Miva - 用模板语言处理XML配置

xml Miva - 使用Sebenza模板模块进行URI管理

xml Miva - 在URI模板中加载自定义字段

加特林负载测试 - XML 文件作为饲料可能?

xml Miva - 产品批量定价供应XML

xml MIVA合并类别,products.xml