MivaLearn

Public Snippets 191

Get Last Four From pay_data

<mvt:comment> Set delimiter variables </mvt:comment>
<mvt:assign name="g.colon" value="':'" />
<mvt:assign name="g.comma" value="','" />
<mvt:assign name="g.equal" value="'='" />
<mvt:comment> First seperate string by the colon and add to an array </mvt:comment>
<mvt:do file="g.Module_Library_Utilities" name="l.null" value="SplitString( l.settings:order:pay_data, g.colon, l.settings:pay_data_array )" />
<mvt:comment> Loop through the array </mvt:comment>
<mvt:foreach iterator="data" array

Force page to download CSV

    <mvt:assign name="l.header" value="miva_output_header( 'Content-Disposition', 'attachment; filename='ADD_FILE_NAME.xls' )" />

Levels Framework Product and Category Search

<mvt:if expr="g.get EQ 'autocomplete' AND g.Search">

	<mvt:comment><!-- Autocomplete Category & Product Search --></mvt:comment>

	<mvt:comment><!-- Search for Categories --></mvt:comment>

		<mvt:assign name="g.Fields" value="'code,name'" />
		<mvt:assign name="g.Offset" value="0" />
		<mvt:assign name="g.Max" value="5" />
		<mvt:do file="g.Module_Library_DB" name="l.return" value="CategoryList_Load_Offset(g.Offset, g.Search, g.Fields, g.Max, g.NextOffset, l.settings:categories)" />

ProductList_Load_Offset_AvailabilityGroup_Assigned

<mvt:assign name="g.offset" value="0" />
<mvt:assign name="g.search" value="''" />
<mvt:assign name="g.searchable_fields" value="''" />
<mvt:assign name="g.max" value="0" />

<mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailabilityGroupList_Load_All(l.settings:availabilitygroups)" />

<mvt:foreach iterator="group" array="availabilitygroups">
    <mvt:do file="g.Module_Library_DB" name="l.success" value="ProductList_Load_Offset_AvailabilityGroup_Assigned(l.settings:grou

ProductVariant_Update

{
	"Store_Code": "STORE_CODE",
	"Function": "ProductVariant_Update",
	"Product_Code": "PRODUCT_CODE",
	"Variant_ID": "VARIANT_ID",
	"Attributes":[
		{
			"attr_code":"ATRIBUTE_CODE",
			"option_code": "OPTION_CODE"
		},
		{
			"attr_code":"ATRIBUTE_CODE",
			"option_code": "OPTION_CODE"
		}
	],
	"Parts":[
		{
			"part_code":"PART_PRODCUCT_CODE",
			"quantity": 1
		},
		{
			"part_code":"PART_PRODCUCT_CODE",
			"quantity": 1
		}
	]
}	

ProductVariantPricing_Update

{
	"Store_Code": "STORE_CODE",
	"Function": "ProductVariantPricing_Update",
	"Product_ID": 1,
	"Variant_ID": 1,
	"Method": 2,
	"Price": 99.99,
	"Cost": 99.99,
	"Weight": 99.99
}

Flex Component Text Example

{
	"code": "heading_text",
	"prompt": "Heading Text",
	"type": "text",
	"textsettings": {
		"fields": [
			{
				"code": "size",
				"options": [
					{
						"text": "Small",
						"value": "16px"
					},
					{
						"text": "Medium",
						"value": "20px"
					},
					{
						"text": "Large",
						"value": "24px"
					}
				],
				"prompt": "Font Size",
				"pseudoclasses": [
					"normal",
					"hover",
					"focus",
					"active"
				],
				"size": "half",
			

ProductPaymentRules_Update

<ProductPaymentRules_Update product_code="prod">
	<LimitPaymentMethods>No</LimitPaymentMethods>
	<PaymentMethods>
		<!-- (multiple allowed) -->
		<PaymentMethod module_code="authnet" method_code="VISA" />
	</PaymentMethods>
</ProductPaymentRules_Update>

Product Data Field Master Product Inventory Count

<mvt:comment>
	------------------------------------------------
	Variant Inventory Count
	Code: PRODUCTDATAFIELD_VINC
	Main Template
 
	Instructions:
		1. Install Product Data Fields and Feed module.
		2. Add Field
			- Name: Variant Inventory Count
			- Code: VINC
			- On Inventory Change: Queue Modified Products and Variants Masters
			- Trigger: VINC
			- Public: True (checked)
		3. Navigate to the `PRODUCTDATAFIELD_VINC` page template code in the Admin
		4. Clear out the "Main

Variant Inventory Count

<mvt:comment>
	------------------------------------------------
	Variant Inventory Count
	Code: PRODUCTDATAFIELD_VINC
	Main Template

	Instructions:
		1. Install Product Data Fields and Feed module.
		2. Add Field
			- Name: Variant Inventory Count
			- Code: VINC
			- On Inventory Change: Queue Modified Products and Variants Masters
			- Trigger: VINC
			- Public: True (checked)
		3. Navigate to the `PRODUCTDATAFIELD_VINC` page template code in the Admin
		4. Clear out the "Mian 

Customer Assigned Price Groups

<mvt:comment>
	Looping through all price groups after confirming the customer is logged in
</mvt:comment>
<mvt:if expr="g.basket:cust_id">
	<mvt:comment> 
		Get all price groups assigned to a customer
	</mvt:comment>
	<mvt:do name="g.pgroupcount" file="g.Module_Feature_PGR_DB" value="PriceGroupAndModuleList_Load_Customer( g.basket:cust_id, l.settings:customer_pricegroups )" />
	<mvt:comment> 
		Loop through customer assigned price groups
	</mvt:comment>
	<mvt:foreach iterator="custome

Toolkit productincategory Replacement

<mvt:comment> Load Product Information </mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Code(g.productcode, l.settings:product)" />
<mvt:comment> Load `first` Category Information </mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="Category_Load_Code('first', l.settings:first_category)" />
<mvt:comment> Check if product is in first category  </mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="CategoryXProduct_

Sorts Shipping Methods Low to High

<mvt:comment> Sorts Shipping Methods Low to Hi </mvt:comment>	
<mvt:do file="g.module_library_utilities" name="l.null" value="QuickSortArray(l.settings:shippingmethods, ':price', 1)" />			

Miva - Load Price Table Based Shipping

<mvt:comment>Load Module</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.ptbship:module_loaded" value="Module_Load_Code_Cached( 'ptbship', l.ptbship:module)" />
<mvt:if expr="l.ptbship:module_loaded">
	<mvt:do file="g.Module_Library_DB" name="l.ptbship:store_module_loaded" value="StoreModule_Load_Cached( l.ptbship:module:id, 'shipping',  l.ptbship:store_module )" />
	<mvt:if expr="l.ptbship:store_module_loaded">
		<mvt:assign name="l.ptbship:module_path" value="g.Module_Root $ l.pt

Get Last PO Description From pay_data

<mvt:comment> Set delimiter variables </mvt:comment>
<mvt:assign name="g.colon" value="':'" />
<mvt:assign name="g.comma" value="','" />
<mvt:assign name="g.equal" value="'='" />
<mvt:comment> First seperate string by the colon and add to an array </mvt:comment>
<mvt:do file="g.Module_Library_Utilities" name="l.null" value="SplitString( l.settings:order:pay_data, g.colon, l.settings:pay_data_array )" />
<mvt:comment> Loop through the array </mvt:comment>
<mvt:foreach iterator="data" array

ProductPaymentRules_Update

<ProductPaymentRules_Update product_code="prod">
	<LimitPaymentMethods>No</LimitPaymentMethods>
	<PaymentMethods>
		<PaymentMethod module_code="authnet" method_code="VISA" />    (multiple allowed)
	</PaymentMethods>
</ProductPaymentRules_Update>