View add-rules-stylesheets-with-javascript.js
// Add Rules to Stylesheets with JavaScript
// http://davidwalsh.name/add-rules-stylesheets
/* Getting the Stylesheet
Which stylesheet you add the rules to is up to you. If you have a specific stylesheet in mind, you can add an ID to the LINK or STYLE element within your page HTML and get the CSSStyleSheet object by referencing the element's sheet property. The stylesheets can be found in the document.styleSheets object:*/
var sheets = document.styleSheets; // returns an Array-like StyleSheetList
/*
Returns:
View miva-get-variant-info-on-variant-change.js
// Copied from @RubenMarin's implimentation
// Add to existing cornerstoneUX.sharedFunctions object...
cornerstoneUX.sharedFunctions.getVariantInfoOnChangegetVariantInfoOnChange = function(fn) {
if (AttributeMachine instanceof Object) { //we first check if AttributeMachine is available
MivaEvents.SubscribeToEvent('variant_changed', function(product_data) {
let self = this;
setTimeout(function() {
let variantId = product_data.variant_id;
View miva-PROD-Attribute-Machine-generate-discount-savings-percent.html
<script>
AttributeMachine.prototype.Generate_Discount = function( discount )
{
var discount_div;
var msrp = Number(document.getElementById('price-value-additional').innerHTML.replace(/[\$,]/, '')),
savings_percent = Math.round(discount.discount / msrp * 100),
savings_percent_formatted = savings_percent + '%';
// console.log('Generate_Discount', discount, msrp, savings_percent, savings_percent_formatted );
View miva_wordpress_footer--partial.php
View controller.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Sandbox extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function table_form($table, $id)
View miva-ocst-login-ajax.html
<div id="js-ocst-login" class="row mfp-hide forgot-password">
<form method="post" action="&mvte:urls:_self:auto;" autocomplete="off" class="column whole js-ocst-login-form">
<input type="hidden" name="Action" value="LOGN" />
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" />
<h4 class="fields-heading">Account Login:</h4>
<div class="form-row">
<div class="floating-placeholder">
<input type="text" name="Customer_Login" value="&mvte:global:Customer_Login;" id="l-Customer_Login" autocomplete="off" class="input">
<label for="l-Customer_Login">Email Address</label>
</div>
View miva-9-7-productvariantlist_load_product.md

ProductVariantList_Load_Product

<mvt:do file="g.Module_Library_DB" name="l.settings:product:variant_count" value="ProductVariantList_Load_Product(l.settings:product:id, l.settings:product:variants)" />

Sample Data Structure

:active=1
View miva-field-validation.js
/*
/mm5/5.00/lib/util_public.mv
<MvFUNCTION NAME = "Phone_Validate" PARAMETERS = "phone, country" STANDARDOUTPUTLEVEL = "">
*/
function validate_phone(phone, country){
if( country === 'US' || country === 'DE' ){
phone = String(phone).replace(/[\+\/\(\)\-\x\.\s]/g, '');
if ( !/^\d+$/.test(phone) ) {
return false;
View alternative-approach.js
ImageMachine.prototype.oninitialize = function (data) {
gallery.length = 0;
mainImageZoom.attr('data-index', 0);
thumbnailIndex = 0;
this.Initialize(data);
if (data) {
updateThumbs();
$('#js-thumbnails .thumbnail-wrap:not(.slick-cloned)').first().click();
}
}
View miva-osel-create-account-iframe.xml
<mvt:if expr="g.CustomerCreate">
<iframe name="processCreate" id="js-process-create" class="all-hidden"></iframe>
<form action="&mvt:global:secure_sessionurl;" method="post" target="processCreate" id="js-create-account" class="all-hidden">
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" />
<input type="hidden" name="Action" value="ICST" />
<input type="hidden" name="Screen" value="ACED" />
<input type="hidden" name="PrevPage" value="INVC" />
<input type="hidden" name="Customer_LoginEmail" value="&mvte:global:Basket:ship_email;" />
<input type="password" name="Customer_Password" value="&mvte:global:CustomerCreate;" />
<input type="password" name="Customer_VerifyPassword" value="&mvte:global:CustomerCreate;" />