Skip to content

Instantly share code, notes, and snippets.

View influxweb's full-sized avatar
Coffee Helps Me Focus...Coffee Helps Me Focus...Coffee Helps Me Focus...

Matt Zimmermann influxweb

Coffee Helps Me Focus...Coffee Helps Me Focus...Coffee Helps Me Focus...
View GitHub Profile
@influxweb
influxweb / prod-product_display_imagemachine.js
Created September 8, 2021 18:17
Shadows v2: Product Image Machine
const productName = '&mvtj:product:name;';
let generate_thumbnail_event = new CustomEvent('ImageMachine_Generate_Thumbnail');
let images = [];
let thumbnailIndex = 0;
let zoomImageLink = document.querySelector('[data-photograph]');
ImageMachine.prototype.oninitialize = function (data) {
images = [];
thumbnailIndex = 0;
zoomImageLink.href = (data.length > 0) ? data[0].image_data[this.closeup_index] : 'graphics/en-US/admin/blank.gif';
@influxweb
influxweb / ajax-add-to-cart.js
Created September 2, 2021 17:12
Colossus: Add to Cart with GA Universal Enhanced Ecommerce
/**
* When called from a `theme.js` file on a product page, this extension will
* work with the default page code to add a product to the cart utilizing an
* AJAX call to the form processor.
*
* The function contains internal error checking as well as a check to see which
* page was reached and displaying messages accordingly. If the store is also
* utilizing the `mini-basket` extension, said extension will be triggered for
* display upon successfully adding a product to the cart.
*/
@influxweb
influxweb / acad-customer.mvt
Created May 13, 2021 20:37
Shadows 2.00.05: ACAD Billing Primary
<section class="o-layout o-layout--justify-center">
<div class="o-layout__item u-width-12 u-width-9--m">
<mvt:do file="g.Module_Library_DB" name="l.state_datalist_count" value="StateList_Load_All(l.state_datalist)"/>
<mvt:assign name="g.StateDatalist" value="l.state_datalist"/>
<mvt:if expr="l.settings:customer:primaddr EQ 'shipping'">
<mvt:assign name="l.settings:shipping_required" value="'required'" />
<mvt:elseif expr="l.settings:customer:primaddr EQ 'billing'">
<mvt:assign name="l.settings:billing_required" value="'required'" />
</mvt:if>
@influxweb
influxweb / aced-customer.mvt
Created May 13, 2021 19:20
Shadows 2.00.05: ACED Billing Primary
<mvt:do file="g.Module_Library_DB" name="l.state_datalist_count" value="StateList_Load_All(l.state_datalist)"/>
<mvt:assign name="g.StateDatalist" value="l.state_datalist"/>
<mvt:if expr="l.settings:customer:primaddr EQ 'shipping'">
<mvt:assign name="l.settings:shipping_required" value="'required'" />
<mvt:elseif expr="l.settings:customer:primaddr EQ 'billing'">
<mvt:assign name="l.settings:billing_required" value="'required'" />
</mvt:if>
<form method="post" action="&mvte:urls:ACED:secure;" data-validate-address>
@influxweb
influxweb / attributemachine.js
Created April 14, 2021 16:08
PROD: Refresh volume discount table when selected variant is changed
AttributeMachine.prototype.Generate_Discount = function (discount) {
let discount_div;
discount_div = document.createElement('div');
discount_div.innerHTML = discount.descrip + ': ' + discount.formatted_discount;
return discount_div;
};
AttributeMachine.prototype.Generate_Swatch = function (product_code, attribute, option) {
@influxweb
influxweb / ACLN.html
Created January 11, 2021 17:04
Shadows v1: Account XSS
<mvt:item name="html_profile" />
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="&mvt:global:basehref;">
<mvt:if expr="NOT ISNULL l.settings:page:title">
<title>&mvt:page:title;</title>
<mvt:else>
<title>&mvt:store:name;: &mvt:page:name;</title>
</mvt:if>
@influxweb
influxweb / scripts.js
Created November 30, 2020 15:46
Suivant ReadyTheme - Default scripts.js
var cornerstoneUX = {
init: function () {
String.prototype.toCamelCase = function(cap1st) {
return ((cap1st ? '-' : '') + this).replace(/-+([^-])/g, function(a, b) {
return b.toUpperCase();
@influxweb
influxweb / touch.md
Last active October 15, 2020 22:46
How to detect touch device in modern browsers
@influxweb
influxweb / ctgy-adpm.html
Last active September 25, 2020 17:06
Shadows v2: CTGY Multi-Product Add To Cart (ADPM)
<mvt:item name="html_profile" />
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="&mvt:global:basehref;">
<mvt:if expr="NOT ISNULL l.settings:category:page_title">
<title>&mvt:category:page_title;</title>
<mvt:elseif expr="NOT ISNULL l.settings:page:title">
<title>&mvt:page:title;</title>
@influxweb
influxweb / product-json-ld.js
Created September 4, 2020 14:50
PROD: JSON-LD for search engines
<mvt:assign name="l.settings:product:stripped_descrip" value="miva_html_strip(l.settings:product:descrip, '')"/>
{
"@context": "http://schema.org",
"@type": "Product",
"name": "&mvtj:product:name;",
"image": "&mvt:global:socialImage;",
"description": "&mvtj:product:stripped_descrip;",
<mvt:if expr="NOT ISNULL l.settings:product:sku">
"sku": "&mvtj:product:sku;",
"mpn": "&mvtj:product:sku;",