html 获取产品属性+变体的价格范围

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 获取产品属性+变体的价格范围相关的知识,希望对你有一定的参考价值。

          <mvt:comment>
            ====Load Product Attributes====
          </mvt:comment>
          <mvt:do file="g.Module_Library_DB" name="l.success" value="AttributeList_Load_Product(l.settings:product:id, l.settings:loaded_attributes)" />

          <mvt:if expr="l.settings:loaded_attributes[1]:attemp_id GT 0">
              <mvt:do file="g.Module_Feature_ATT_DB" name="l.success" value="AttributeTemplateAttrList_Load_Template(l.settings:loaded_attributes[1]:attemp_id, l.settings:loaded_attributes)" />
          </mvt:if>

          <mvt:comment>
            ====Load Product Attribute Options + Add Option Prices to Array====
          </mvt:comment>
          <mvt:assign name="l.settings:option_prices" value="''" />
          <mvt:foreach iterator="attribute" array="loaded_attributes">
            <mvt:do file="g.Module_Library_DB" name="l.success" value="OptionList_Load_Attribute(l.settings:attribute:id, l.settings:loaded_options)" />
            <mvt:foreach iterator="option" array="loaded_options">
              <mvt:if expr="l.settings:option:price NE 0">
                <mvt:assign name="l.addToArray" value="miva_array_insert( l.settings:option_prices, l.settings:option:price, -1 )" />
              </mvt:if>

              <mvt:comment>
                ====Check if Product has Variants + Load the Variant Part====
              </mvt:comment>
              <mvt:do file="g.Module_Library_DB" name="l.success" value="ProductVariantList_Load_Product_Option( l.settings:product:id, l.settings:attribute:id, l.settings:option:id, l.settings:variantPart )" />

              <mvt:if expr="l.settings:variantPart[1]">
                <mvt:comment>
                  ====Load the Variant Information====
                </mvt:comment>
                <mvt:foreach iterator="part" array="variantPart">
                  <mvt:do file="g.Module_Library_DB" name="l.success" value="ProductList_Load_Variant( l.settings:product:id, l.settings:part:variant_id, l.settings:variant )" />
                </mvt:foreach>

                <mvt:comment>
                  ====Add Variant Prices to Array====
                </mvt:comment>
                <mvt:foreach iterator="var" array="variant">
                  <mvt:if expr="l.settings:var:price NE 0">
                    <mvt:assign name="l.addToArray" value="miva_array_insert( l.settings:option_prices, l.settings:var:price, -1 )" />
                  </mvt:if>
                </mvt:foreach>
              </mvt:if>

            </mvt:foreach>
          </mvt:foreach>

          <mvt:comment>
            ====Sort Prices Array + Push First and Last Numbers into Variables====
          </mvt:comment>
          <mvt:do file="g.Module_Library_Utilities" name="l.null" value="QuickSortArray( l.settings:option_prices, NULL, 1 )" />

          <mvt:do name="g.priceLow" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, l.settings:option_prices[1] )" />
          <mvt:do name="g.priceHigh" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, l.settings:option_prices[miva_array_elements(l.settings:option_prices)] )" />

          <p><strong class="black">&mvt:global:priceLow; - &mvt:global:priceHigh;</strong></p>

以上是关于html 获取产品属性+变体的价格范围的主要内容,如果未能解决你的问题,请参考以下文章

html 为具有属性的产品加载高/低价格范围(在属性级别定价)

html 为具有属性的产品加载高/低价格范围(在属性级别定价)

如何在Liquid中获取HTML元素值

获取产品及其变体

更新变体产品价格 - 在产品页面中不可见 - Woocommerce

Magento 试图在产品展示和类别页面上根据“尺寸属性”显示产品价格范围?