Skip to content

Instantly share code, notes, and snippets.

@andrew-serrano
Created August 14, 2019 21:41
Show Gist options
  • Save andrew-serrano/8d18f59cadc2f17dd2b8f84a0a6b8c70 to your computer and use it in GitHub Desktop.
Save andrew-serrano/8d18f59cadc2f17dd2b8f84a0a6b8c70 to your computer and use it in GitHub Desktop.
Return Variant ID when you have the product, attribute, option information
<mvt:comment>
Load Product
</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Code('PRODUCT_CODE', l.product)" />
<mvt:comment>
Must be a valid attribute/option combination
Schema:
g.Product_Attributes[1]:code = tone
g.Product_Attributes[1]:value = medium
g.Product_Attributes[2]:code = aed_trainer
g.Product_Attributes[2]:value = essentials
</mvt:comment>
<mvt:assign name="l.temp_structure[1]:code" value="'ATTRIBUTE_CODE'" />
<mvt:assign name="l.temp_structure[1]:value" value="'OPTION_CODE'" />
<mvt:assign name="l.temp_structure[2]:code" value="'ATTRIBUTE_CODE'" />
<mvt:assign name="l.temp_structure[2]:value" value="'OPTION_CODE'" />
<mvt:comment>
Provide product information and the attribute/option structure. This will
return the variant id that is associated with the attribute/option combination
</mvt:comment>
<mvt:do file="g.Module_Library_Utilities" name="l.success" value="Validate_Attributes_DetermineVariant(l.product, 0, l.temp_structure, miva_array_collapse(l.temp_structure), l.null, l.null_count, l.variant_id)" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment