Skip to content

Display Predicted Discount Price#


Description#

Display Predicted Discount Price

Snippet#

<mvt:comment> Load a few sample products from category backpacks </mvt:comment>
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( 'backpacks', l.settings:current_category )" />
<mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:current_category:id, g.Offset, 100, g.NextOffset, l.settings:products )" />
<mvt:comment> Pass array of products into function. price and formatted_price get replaced in products structure with the predicted discounted price. </mvt:comment>
<mvt:comment> This will only work on product level discounts. </mvt:comment>
<mvt:assign name="g.product_count" value="miva_array_elements( l.settings:products )" />
<mvt:do name="l.success" file="g.module_feature_tui_ut" value="CommonComponentFields_Initialize_Product_Discounts_Runtime( l.settings:products, g.product_count )" />
<mvt:foreach iterator="product" array="products">
    Product Code: &mvt:product:code;<br>
    Discount Count: &mvt:product:discount_count;<br>
    Formatted Price: &mvt:product:formatted_price;<br>
    <mvt:foreach iterator="discount" array="product:discounts">
                    Description:&mvt:discount:descrip;<br>
                    Discount: &mvt:discount:discount;<br>
                    Formatted Discount: &mvt:discount:formatted_discount;<br>
    </mvt:foreach>
    <br>
</mvt:foreach>