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 / cloudSettings
Last active April 11, 2022 20:17
vscode settings
{"lastUpload":"2022-03-10T01:06:24.658Z","extensionVersion":"v3.4.3"}
@andrew-serrano
andrew-serrano / schema_product.xml
Last active September 11, 2020 14:58
JSON-LD Product schema base
<!-- Start: Google Rich Snippets -->
<mvt:comment>
| Check if the argument is a structure to transform into an array
</mvt:comment>
<mvt:if expr="tolower(miva_variable_type(l.settings:json_ld:products)) EQ 'structure'">
<mvt:assign name="l.null" value="miva_array_insert( l.settings:json_ld:products, l.settings:json_ld:products, -1 )" />
</mvt:if>
<mvt:comment>
@andrew-serrano
andrew-serrano / remove_page_title_meta_fields.xml
Created September 9, 2020 15:44
Script that removes data from the Page > SEO tab. Which includes Page Title and META Fields
<mvt:comment>
| Load all pages
</mvt:comment>
<mvt:do file="g.Module_Feature_TUI_DB" name="l.success" value="PageList_Load_All( l.settings:pages )" />
<mvt:foreach iterator="page" array="pages">
<mvt:comment>
| Update page title
</mvt:comment>
<mvt:assign name="l.settings:page:title" value="''" />
@andrew-serrano
andrew-serrano / miva_imagemachine_override.xml
Last active June 18, 2020 18:55
ImageMachine Override
<mvt:comment>
AWSIMG
Attribute/Imagemachine must be enabled
and custom images
</mvt:comment>
<mvt:if expr="
l.settings:attributemachine:enabled AND
l.settings:all_products_imagemachine:enabled AND
l.settings:product:customfield_values:customfields:image_01
">
@andrew-serrano
andrew-serrano / miva_render_emails.xml
Last active June 25, 2020 22:30
Load an array of emails (WIP)
<mvt:comment>
Reference:
templateorderemails.mv
</mvt:comment>
<mvt:assign name="l.email_templates" value="miva_splitstring('ORDERCONF_CUSTOMER,GIFTCERTIFICATE_CREATED,SHIPMENT_SHIPPED', ',', l.settings:email_templates, 'trim' )" />
<mvt:foreach iterator="email_template" array="email_templates">
<mvt:comment>
Default
@andrew-serrano
andrew-serrano / master_product_subscription.xml
Created May 15, 2020 00:20
Display product subscription discounts during runtime
<mvt:comment>
Defaults
</mvt:comment>
<mvt:comment>
The subscription id you would like to test to determine
if the product applies to a discount
</mvt:comment>
<mvt:assign name="l.subscription_term_id" value="4" />
@andrew-serrano
andrew-serrano / object_recursively_search.js
Created April 30, 2020 20:35
Recursively search an Object and return all matches
// File is a POF of how to recursively search an object
class User {
constructor() {
this.username = "john_doe";
this.password = "password";
}
/**
* Deep search any object like types and return
* one or more values for the property name
@andrew-serrano
andrew-serrano / miva-remove-html-comments.xml
Last active April 7, 2020 02:00
Miva Remove HTML comments
<mvt:comment>
I/O
</mvt:comment>
<mvt:assign name="l.input_string" value="'Place value here'" />
<mvt:assign name="l.output_string" value="''" />
<mvt:comment>
Tokens
</mvt:comment>
<mvt:assign name="l.start_comment" value="'<!--'" />
@andrew-serrano
andrew-serrano / schema_availability_value_logic.xml
Created February 10, 2020 20:32
Small snippet that will handle a in stock, low stock, and out of stock inventory settings
<mvt:comment>
Schema Value
</mvt:comment>
<mvt:assign name="l.settings:product:schema_inventory_message:value" value="''" />
<mvt:comment>
Schema Availability Values
</mvt:comment>
<mvt:assign name="l.settings:product:schema_inventory_message:discontinued" value="'Discontinued'" />
<mvt:assign name="l.settings:product:schema_inventory_message:in_stock" value="'InStock'" />
@andrew-serrano
andrew-serrano / starting_at_price.xml
Last active November 21, 2019 22:05
Will return the lowest variant part
<mvt:item name="all_products" />
<mvt:comment>
Products
</mvt:comment>
<mvt:foreach iterator="product" array="all_products:products">
<mvt:comment>
NULL
</mvt:comment>
<mvt:assign name="l.product_as_low_as_prices" value="''" />