Skip to content

Instantly share code, notes, and snippets.

View andrew-serrano's full-sized avatar

Andrew Serrano andrew-serrano

View GitHub Profile
@andrew-serrano
andrew-serrano / blog-image-readable-stream.js
Created November 19, 2019 06:58
Request an image, read image data, and create blog url for an image.
(async function() {
// Request
let response = await fetch('https://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Google_Images_2015_logo.svg/1200px-Google_Images_2015_logo.svg.png');
// Reader
let reader = response.body.getReader();
// Final Image Data
let imageData = [];
@andrew-serrano
andrew-serrano / miva_customer_abandonment_email.xml
Last active October 30, 2019 21:25
Manually trigger the abandonment basket email from order fulfillment
<mvt:comment>
Overrides if needed
</mvt:comment>
<mvt:assign name="l.run:override_from" value="''" />
<mvt:assign name="l.run:override_reply_to" value="''" />
<mvt:assign name="l.run:override_to" value="''" />
<mvt:assign name="l.run:override_cc" value="''" />
<mvt:assign name="l.run:override_bcc" value="''" />
<mvt:assign name="l.run:override_subject" value="''" />
@andrew-serrano
andrew-serrano / miva_product_types.md
Last active August 28, 2019 18:44
General Miva Product Types

Miva Product Types

Type Variant Count Part Count
Product 0 0
Master Product 1...Infinity 1
Inventory Kit 1...Infinity 1...Infinity
@andrew-serrano
andrew-serrano / error_codes.md
Last active August 15, 2019 18:11
Miva Error Codes and Details

Error Codes & Reasons

Code: no_shipping_methods

Page: OCST

Message: "Shipping could not be calculated for your basket. This may be due to a network or configuration error, or the contents of your basket may not be able to be shipped in a single shipment."

Reasons:

  • There was no shipping methods returned
  • Customer's shipping address is a PO box
@andrew-serrano
andrew-serrano / variant_id.xml
Created August 14, 2019 21:41
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
@andrew-serrano
andrew-serrano / snake_case_to_title_case.xml
Created August 12, 2019 21:51
Convert snake case value to title case
<mvt:comment>
Null the current status value
</mvt:comment>
<mvt:assign name="l.final_outputted_value" value="''" />
<mvt:comment>
Substring placeholder
</mvt:comment>
<mvt:assign name="l.substring" value="'placeholder'" />
@andrew-serrano
andrew-serrano / load_item_with_template.xml
Created August 5, 2019 21:18
Load a module item with template
<mvt:comment>
Load item
</mvt:comment>
<mvt:do file="g.Module_Feature_TUI_DB" name="l.success" value="Item_Load_Code('PaypalExButton', l.item)" />
<mvt:comment>
Load module that the item references
</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.success" value="Module_Load_ID(l.item:module_id, l.item:module)" />
<mvt:comment>
@andrew-serrano
andrew-serrano / mvt_customer_password_validation.xml
Last active July 11, 2019 17:34
HTML5/Miva Store Settings Customer Password Validation
<mvt:comment>
Using these english punctuation characters as reference
https://7esl.com/punctuation-marks/
Miva Settings:
l.settings:page:customer_settings:pw_complex = 0 No Complexity Requirements
l.settings:page:customer_settings:pw_complex = 1 At Least one Letter and one Number or Punctuation Character
l.settings:page:customer_settings:pw_complex = 2 Mixed Case Letters and at Least one Number or Punctuation Character
</mvt:comment>
<mvt:do file="g.Module_Feature_CUS_DB" name="l.CustomerSettings_Load" value="CustomerSettings_Load(l.settings:page:customer_settings)" />
@andrew-serrano
andrew-serrano / miva_order_template_email.xml
Last active April 28, 2020 17:44
Manually trigger a preexisting email
<mvt:comment>
Overrides if needed
</mvt:comment>
<mvt:assign name="l.run:override_from" value="''" />
<mvt:assign name="l.run:override_reply_to" value="''" />
<mvt:assign name="l.run:override_to" value="''" />
<mvt:assign name="l.run:override_cc" value="''" />
<mvt:assign name="l.run:override_bcc" value="''" />
<mvt:assign name="l.run:override_subject" value="''" />
@andrew-serrano
andrew-serrano / customfield_group.xml
Created June 4, 2019 18:24
Load customfield group and all of the associated customfields
<mvt:comment>
Load Customfield Group
</mvt:comment>
<mvt:do file="g.Module_Root $ '/modules/util/customfld.mvc'" name="l.success" value="Group_Load_Code('build_a_kit_facets', l.build_a_kit_facets_group)" />
<mvt:comment>
Load all the fields associated with that group
</mvt:comment>
<mvt:do file="g.Module_Root $ '/modules/util/customfld.mvc'" name="l.success" value="ProductFieldList_Load_Group(l.build_a_kit_facets_group:id, l.settings:bak_facets)" />