Instantly share code, notes, and snippets.

View miva-variant_id-variant-parts-fix.xml
<mvt:foreach iterator="item" array="order:items">
<mvt:do file="g.Module_Library_DB" name="l.success" value="ProductVariant_Load_Attributes( l.settings:item:product:id, l.settings:item:options, l.settings:item:option_count, l.settings:item:productvariant )" />
<mvt:if expr="l.settings:item:productvariant:variant_id NE l.settings:item:variant_id">
<mvt:assign name="l.settings:item:parts" value="''" />
<mvt:do file="g.Module_Library_DB" name="l.success" value="ProductList_Load_Variant( l.settings:item:product:id, l.settings:item:productvariant:variant_id, l.settings:item:parts )" />
<mvt:foreach iterator="part" array="item:parts">
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_ID( l.settings:part:id, l.settings:part )" />
</mvt:foreach>
</mvt:if>
</mvt:foreach>
View miva-xml-provisioning-to-add-a-note-to-customer-business-account-or-order.xml
<!--
<Note_Add />
One of the following attributes is required:
customer: customer login
business: Business Title
order: Order ID
Examples:
-->
View miva-css-and-js-cache-busting-with-modification-time.xml
<mvt:comment>
Style Sheet Cache Busting on Modification Time
</mvt:comment>
<mvt:assign name="l.settings:css_file:path" value="'/mm5/' g.theme_path $ '/css/pages.css'" />
<mvt:assign name="l.settings:css_file:modified_time" value="stime( l.settings:css_file:path )" />
<mvt:assign name="l.settings:css_file:path_with_cache_buster" value="l.settings:css_file:path $ '?v=' $ l.settings:css_file:modified_time" />
<link rel="stylesheet" href="&mvt:css_file:path_with_cache_buster;">
<mvt:comment>
JavaScript Cache Busting on Modification Time
View css-common-device-media-query-breakpoints.css
/* From http://www.designyourway.net/blog/resources/31-css-code-snippets-to-make-you-a-better-coder/ */
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
View miva-generate-301-redirects-for-short-link-pattern.xml
View check-if-cookies-are-enabled.js
function are_cookies_enabled(){
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled){
document.cookie="testcookie";
cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false;
}
return cookieEnabled;
}
View accept-json-post-data.xml
<h2>s.content_data</h2>
<pre><mvt:eval expr="s.content_data"/></pre>
<h2>miva_json_decode(s.content_data, l.settings:json)</h2>
<mvt:assign name="l.result" value="miva_json_decode(s.content_data, l.settings:json)" />
<p><b>&amp;mvt:json:foobar; =</b> &mvt:json:foobar;</p>
<p><b>&amp;mvt:json:message; =</b> &mvt:json:message;</p>
View README.md

WP-HEADER

Template

<mvt:do file="g.Module_Library_Utilities" name="g.datetime" value="Format_SOAP_DateTime( s.dyn_time_t )" />
<!-- !@! datetime: &mvt:global:datetime; -->

<div id="site-container">
	<div id="global-header"><mvt:item name="hdft" param="global_header" /></div>
View html-canvas-file-upload-local-storage.html
<!-- http://tech.pro/tutorial/1383/javascript-one-language-to-rule-them-all -->
<style>
[for=blue] { color: blue; }
[for=green] { color: green; }
[for=red] { color: red; }
</style>
<input id="uploadImage" type="file" name="photo" />
<input id="caption" type="text" name="caption" placeholder="caption" />
<label for="blue">Blue</label>
View php-ftp-file-upload-function.php
<?
$ftp_server = "ftp.domainname.com";
$ftp_user_name = "ftp_username";
$ftp_user_pass = "ftp_password";
$ftp_directory = 'path/to/folder/'; // leave blank
$ftp_source_file_name = "data.xml";
$ftp_dest_file_name = $ftp_source_file_name;
if( ftp_file( $ftp_server, $ftp_user_name, $ftp_user_pass, $ftp_source_file_name, $ftp_directory, $ftp_dest_file_name) ){
echo "Success: FTP'd data\n";