Created
November 15, 2016 23:12
-
-
Save bheyde/94386c80d1ac456796a940c5b49ff5c4 to your computer and use it in GitHub Desktop.
Load High / Low Price Range for a Product with Attributes (pricing at attribute level)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mvt:comment> | |
Load all possible variants using toolkit | |
</mvt:comment> | |
<mvt:item name="toolkit" param="variantarray|vcount|g.product_code" /> | |
<mvt:comment> | |
Loop though variants, load product information for each variant, insert into new array | |
</mvt:comment> | |
<mvt:foreach iterator="variant" array="variants"> | |
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Code(l.settings:variant:variant_code, l.settings:product_variant_load)" /> | |
<mvt:assign name="l.array_count" value="miva_array_insert( l.settings:products, l.settings:product_variant_load, -1 )" /> | |
</mvt:foreach> | |
<mvt:comment> | |
Load predicted discounts for each variant (if exists) | |
</mvt:comment> | |
<mvt:do name="l.success" file="g.module_feature_tui_ut" value="CommonComponentFields_Initialize_Product_Discounts_Runtime( l.settings:products, 1 )" /> | |
<mvt:comment> | |
Determine High / Low Prices | |
</mvt:comment> | |
<mvt:foreach iterator="variant" array="products"> | |
<mvt:if expr="pos1 EQ 1"> | |
<mvt:assign name="g.low_price" value="l.settings:variant:price" /> | |
<mvt:assign name="g.high_price" value="l.settings:variant:price" /> | |
</mvt:if> | |
<mvt:if expr="l.settings:variant:price GT g.high_price"> | |
<mvt:assign name="g.high_price" value="l.settings:variant:price" /> | |
</mvt:if> | |
<mvt:if expr="l.settings:variant:price LT g.low_price"> | |
<mvt:assign name="g.low_price" value="l.settings:variant:price" /> | |
<mvt:assign name="g.low_price_formatted" value="l.settings:variant:formatted_price" /> | |
</mvt:if> | |
</mvt:foreach> | |
<mvt:comment> | |
Format Currency | |
</mvt:comment> | |
<mvt:do name="g.low_price_formatted" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, g.low_price )" /> | |
<mvt:do name="g.high_price_formatted" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, g.high_price )" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment