Skip to content

Instantly share code, notes, and snippets.

@steveosoule
steveosoule / shadows-breakpoints.md
Last active December 19, 2023 16:07
Shadows Breakpoints
Breakpoint Name Device Min Pixels Max Pixels Min Em Max Em
Extra-Small Mobile (Small) 0 639.98 0 39.999
Small Mobile (Large) 640 767.98 40 47.999
Medium Tablet 768 959 48 59.999
Large Laptop 960 1199.98 60 74.999
Extra-Large Laptop (Large) 1200 1439.98 75 89.999
Wide-Screen Wide Screen 1440 Infinity 90 Infinity
@steveosoule
steveosoule / miva-remove-peek-of-next-product-for-mmx-carousels.md
Last active March 9, 2023 15:39
Miva - Remove Peek of Next Product for MMX Carousels

Miva - Remove Peek of Next Product for MMX Carousels

Method #1 (Preferred) Set Web Component Attribute On-Load

This method is preferred because preserving the original source of the mmx-product-carousel.js will maintain future automatic update eligibility during Miva Software patches of flex components.

To use this method, add the following to some globally executed JavaScript file. For example, in Shadows that would be something like: ui/js/theme.js > themeFunctionality.global()

// Remove peek for just product carousel
@steveosoule
steveosoule / miva-shadows-hide-radio-button-for-radios-with-image.css
Created March 3, 2023 17:54
Miva - Shadows hide radio button for radios with image
.c-form-checkbox--radio:has(img) .c-form-checkbox__caption {
margin-left: 0;
}
.c-form-checkbox--radio:has(img) .c-form-checkbox__caption::before {
display: none;
}
@steveosoule
steveosoule / 00__README.md
Last active February 22, 2023 17:01
Miva - MVT Output Encoding Benchmark

Miva - MVT Output Encoding Benchmark

Outputting a complex string 100,000 times took roughly:

Encoding Duration (sec.)
mvt 0.15
mvte 0.28
mvta 0.40
mvtj 0.39
@steveosoule
steveosoule / 00-miva-invc-fail-safe-read-and-write-basket-order-custom-fields.xml
Last active February 15, 2023 17:11
Miva - INVC Fail Safe Read/Write Basket/Order Custom Fields
<mvt:comment>
Fail-safe Write
</mvt:comment>
<mvt:if expr="l.settings:page:code CIN 'INVC'">
<mvt:item name="customfields" param="Write_Basket( 'order_instructions', g.order_instructions )" />
<mvt:item name="customfields" param="Write_Order( l.settings:order:id, 'order_instructions', g.order_instructions )" />
</mvt:if>
<mvt:comment>
@steveosoule
steveosoule / 00-readme.md
Last active February 13, 2023 18:58
Encoding Test

Miva & JavaScript Encoding Test

Encoding Value
Original https://jsmith:[email protected]:443/path/to some/file.html?q=s&q2=a+b&q3=some thing#hash=value
&mvte https://jsmith:[email protected]:443/path/to some/file.html?q=s&q2=a+b&q3=some thing#hash=value
encodeURI() https://jsmith:[email protected]:443/path/to%20some/file.html?q=s&q2=a+b&q3=some%20thing#hash=value
&mvta https%3A%2F%2Fjsmith%[email protected]%3A443%2Fpath%2Fto+some%2Ffile.html%3Fq%3Ds%26q2%3Da%2Bb%26q3%3Dsome+thing%23hash%3Dvalue
encodeURIComponent() https%3A%2F%2Fjsmith%3Afoo%40www.example.com%3A443%2Fpath%2Fto%20some%2Ffile.html%3Fq%3Ds%26q2%3Da%2Bb%26q3%3Dsome%20thing%23hash%3Dvalue
@steveosoule
steveosoule / 00-add-custom-hero-banner-after-first-slide.js
Last active February 3, 2023 17:23
Miva - MMX Hero Slider Manipulations
// Add a new mmx-hero slide after the first slide
const slider = document.getElementById('mmx-hero-slider__mmx_heroslider');
const firstSlide = slider.querySelector('[slot="hero_slide"]');
const newSlideHTML = /*html*/`
<mmx-hero
slot="hero_slide"
data-href="#foo"
data-heading="This is the heading!"
data-body="this is the body text"
data-content-location="center"
@steveosoule
steveosoule / miva-set-product-s-combination-facet-value.xml
Last active December 20, 2022 18:48
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>
@steveosoule
steveosoule / miva-full-mvt-do-with-load-module-path-check-active-check-installed.xml
Created December 1, 2022 17:24
Miva - Full mvt:do with Load Module Path, Check Active, & Check Installed
<mvt:comment>One-Time Setup</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.module_loaded" value="Module_Load_Code_Cached('tg_transients', l.tg_transients_module)" />
<mvt:do file="g.Module_Library_DB" name="l.storemodule_installed" value="StoreModule_Load_Cached(l.tg_transients_module:id, 'util', l.null)" />
<mvt:if expr="l.tg_transients_module:active AND l.storemodule_installed">
<mvt:assign name="g.Module_TG_Transients" value="g.Module_Root $ l.tg_transients_module:module" />
<mvt:else>
<mvt:assign name="g.Module_TG_Transients" value="''" />
</mvt:if>
<mvt:comment>Each Usage</mvt:comment>
@steveosoule
steveosoule / step_01--miva-template.xml
Last active July 6, 2022 16:33
Miva - mvt:call to PHP-middleware to perform HTTP GET with POST Data
<mvt:assign name="l.data_for_api:thing_1" value="'Foobar'" />
<mvt:assign name="l.data_for_api:thing_2" value="'Lorem ipsum...'" />
<mvt:capture variable="l.json_string">
<mvt:do file="g.Module_JSON" name="l.success" value="JSON_Output( l.data_for_api )" />
</mvt:capture>
<mvt:call action="'https://ssoule.mivamerchantdev.com/php/mvt-call-converter.php'" method="'GET'" fields="'json_string'">
<mvt:eval expr="s.callvalue" />
</mvt:call>