Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Last active December 20, 2022 18:48
Show Gist options
  • Select an option

  • Save steveosoule/5a097de664598ce1608abe45e6defe0a to your computer and use it in GitHub Desktop.

Select an option

Save steveosoule/5a097de664598ce1608abe45e6defe0a to your computer and use it in GitHub Desktop.
Miva - Set Product's Combination Facet Value
<mvt:comment>
Parameters
</mvt:comment>
<mvt:assign name="l.combofacet_field_code" value="'ymm'" />
<mvt:assign name="l.combofacet_product_value" value="'1967>Ford>Mustang|1967>Chevy>Camaro'" />
<mvt:assign name="l.product_code" value="'fitment-test'" />
<mvt:comment>
Loading the Data and Module Settings
</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.loaded_product" value="Product_Load_Code_Cached( l.product_code, l.product )" />
<mvt:do file="g.Module_Library_DB" name="l.loaded_module" value="Module_Load_Code_Cached( 'combofacets', l.combofacets_module )" />
<mvt:do file="g.Module_Library_DB" name="l.storemodule_installed" value="StoreModule_Load_Cached(l.combofacets_module:id, 'util', l.null)" />
<mvt:if expr="l.combofacets_module:active AND l.storemodule_installed">
<mvt:assign name="g.Module_Combo_Facets" value="g.Module_Root $ l.combofacets_module:module" />
<mvt:else>
<mvt:assign name="g.Module_Combo_Facets" value="''" />
</mvt:if>
<mvt:comment>
Setting the Field
</mvt:comment>
<mvt:if expr="NOT ISNULL g.Module_Combo_Facets">
<mvt:do file="g.Module_Combo_Facets" name="l.field_set" value="Module_Product_Set_Field(l.combofacets_module, l.product:id, l.combofacet_field_code, l.combofacet_product_value)" />
</mvt:if>
<mvt:comment>
Debugging / Output
</mvt:comment>
<mvt:assign name="l.debug:combofacet_field_code" value="l.combofacet_field_code" />
<mvt:assign name="l.debug:combofacet_product_value" value="l.combofacet_product_value" />
<mvt:assign name="l.debug:field_set" value="l.field_set" />
<mvt:assign name="l.debug:loaded_module" value="l.loaded_module" />
<mvt:assign name="l.debug:loaded_product" value="l.loaded_product" />
<mvt:assign name="l.debug:product_code" value="l.product_code" />
<mvt:assign name="l.debug:product" value="l.product" />
<mvt:assign name="g.mvt_debug" value="glosub( miva_array_serialize( l.debug ), ',', asciichar( 10 ) )" />
<!--
@@l.debug
&mvt:global:mvt_debug;
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment