Instantly share code, notes, and snippets.

View miva-variant_id-variant-parts-fix.xml
<mvt:foreach iterator="item" array="order:items">
<mvt:do file="g.Module_Library_DB" name="l.success" value="ProductVariant_Load_Attributes( l.settings:item:product:id, l.settings:item:options, l.settings:item:option_count, l.settings:item:productvariant )" />
<mvt:if expr="l.settings:item:productvariant:variant_id NE l.settings:item:variant_id">
<mvt:assign name="l.settings:item:parts" value="''" />
<mvt:do file="g.Module_Library_DB" name="l.success" value="ProductList_Load_Variant( l.settings:item:product:id, l.settings:item:productvariant:variant_id, l.settings:item:parts )" />
<mvt:foreach iterator="part" array="item:parts">
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_ID( l.settings:part:id, l.settings:part )" />
</mvt:foreach>
</mvt:if>
</mvt:foreach>
View miva-xml-provisioning-to-add-a-note-to-customer-business-account-or-order.xml
<!--
<Note_Add />
One of the following attributes is required:
customer: customer login
business: Business Title
order: Order ID
Examples:
-->
View miva-css-and-js-cache-busting-with-modification-time.xml
<mvt:comment>
Style Sheet Cache Busting on Modification Time
</mvt:comment>
<mvt:assign name="l.settings:css_file:path" value="'/mm5/' g.theme_path $ '/css/pages.css'" />
<mvt:assign name="l.settings:css_file:modified_time" value="stime( l.settings:css_file:path )" />
<mvt:assign name="l.settings:css_file:path_with_cache_buster" value="l.settings:css_file:path $ '?v=' $ l.settings:css_file:modified_time" />
<link rel="stylesheet" href="&mvt:css_file:path_with_cache_buster;">
<mvt:comment>
JavaScript Cache Busting on Modification Time
View miva-generate-301-redirects-for-short-link-pattern.xml
View miva-volume-pricing-provisioning.xml
<PriceGroupProduct_Assign group_name="Volume Pricing" product_code="prod-123" />
<Module code="discount_volume" feature="component">
<ProductPricingTable group_name="Volume Pricing" product_code="prod-123">
<Entry quantity="10" type="fixed" amount="9.99" />
<Entry quantity="50" type="percent" amount="10" />
<Entry quantity="100" type="absolute" amount="19.99" />
</ProductPricingTable>
</Module>
View miva-nested-category-uri-301-redirects.xml
<mvt:comment>
## About
Given a store with a category/sub-category structure like this:
- appliances
- kitchen
- refrigerators
View npx-gist-test.js
'Hello World!'.split('').forEach(letter => console.log(letter));
View miva-load-custom-fields-with-mvt-do--examples.xml
<!-- Example #1: Load an order custom field and change the subject -->
<mvt:do file="g.Module_Root $ '/modules/util/customfld.mvc'" name="l.success" value="OrderFieldValue_Load_CodeAndOrder( 'phone_order', l.settings:order:id, l.customfield:field, l.customfield:value )" />
<mvt:if expr="l.customfield:value">
Your &mvt:store:name; Phone Order
<mvt:else>
Your &mvt:store:name; Online Order
</mvt:if>
<!-- Example #2: Load Business Account for different Order Confirmation Email-To -->
View miva-sort-and-update-attribute-option-display-order.xml
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Code( g.Product_Code, l.settings:product )" />
<mvt:do file="g.Module_Library_DB" name="l.success" value="AttributeList_Load_Product( l.settings:product:id, l.settings:product:attributes )" />
<mvt:foreach iterator="attribute" array="product:attributes">
<mvt:do file="g.Module_Library_DB" name="l.success" value="OptionList_Load_Attribute( l.settings:attribute:id, l.settings:attribute:options )" />
<mvt:comment>
Only Sort Length Attributes
</mvt:comment>
<mvt:if expr="l.settings:attribute:code NE 'length'">
View miva-preload-attribute-options-from-variant-part-product-code.xml
<mvt:if expr="g.Variant_Product_Code">
<mvt:comment>
Pass the Variant Part Product Code, and Load the Attributes & Options for it
/store/variant-attributes.html?Variant_Product_Code=shirt_small_red
</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Code( g.Variant_Product_Code, l.settings:variant_product )" />
<mvt:do file="g.Module_Library_DB" name="l.success" value="ProductVariantPartList_Load_Part( l.settings:variant_product:id, l.settings:variant_product:parts )" />
<mvt:foreach iterator="part" array="variant_product:parts">
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_ID( l.settings:part:product_id, l.settings:part:master_product )" />
<mvt:assign name="l.settings:variant_product:adpr_data:product_code" value="l.settings:part:master_product:code" />