Skip to content

Instantly share code, notes, and snippets.

@steveosoule
steveosoule / miva-variant-changed-callback.js
Created June 11, 2014 20:38
Miva Merchant - Variant Changes Callback
MivaEvents.SubscribeToEvent('variant_changed', function (product_data) {
console.log( product_data );
});
@steveosoule
steveosoule / miva-customer-registration-on-load.html
Created June 12, 2014 17:39
Miva Customer Registration On Load
<mvt:if expr="g.CustomerCreate">
<iframe name="processCreate" id="js-process-create" class="hidden"></iframe>
<form action="&mvt:global:secure_sessionurl;" method="post" target="processCreate" id="js-create-account" class="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;" />
@steveosoule
steveosoule / miva-lookup-pagefinders-category-pagename.html
Created June 12, 2014 18:22
Miva Merchant - Look up PageFinder's Category Pagename
<mvt:assign name="g.select_sql" value="'SELECT name FROM s01_PageFinderCats WHERE cat_id=' $ l.settings:category:id $ ' LIMIT 1'" />
<mvt:item name="ry_toolbelt" param="query|g.select_sql|pagename" />
<mvt:if expr="l.settings:pagename">
<mvt:assign name="l.settings:category:pagelink" value="'http://' $ g.domain:name $ '/' $ l.settings:pagename $ '.html'" />
<mvt:else>
<mvt:assign name="l.settings:category:pagelink" value="'http://' $ g.domain:name $ '/category/' $ l.settings:category:code $ '.html'" />
</mvt:if>
@steveosoule
steveosoule / miva-lookup-pagefinders-product-pagename.html
Created June 12, 2014 18:28
Miva Merchant - Look up PageFinder's Product Pagename
<mvt:assign name="g.select_sql" value="'SELECT name FROM s01_PageFinderProducts WHERE product_id=' $ l.settings:product:id $ ' LIMIT 1'" />
<mvt:item name="ry_toolbelt" param="query|g.select_sql|pagename" />
<mvt:if expr="l.settings:pagename">
<mvt:assign name="l.settings:product:pagelink" value="'http://' $ g.domain:name $ '/' $ l.settings:pagename $ '.html'" />
<mvt:else>
<mvt:assign name="l.settings:product:pagelink" value="'http://' $ g.domain:name $ '/product/' $ l.settings:product:code $ '.html'" />
</mvt:if>
@steveosoule
steveosoule / miva-merchant-static-page-rss-feed.xml
Created June 13, 2014 18:37
Miva Merchant - Static Pages RSS Feed
<mvt:miva output="on" compresswhitespace="on" />
<mvt:assign name="g.line_break" value="asciichar(10)" />
<mvt:assign name="g.sql_query" value="'SELECT * FROM s01_Pages'" />
<mvt:item name="ry_toolbelt" param="query|g.sql_query|Pages" />
<mvt:assign name="g.excludes" value="'rss'" />
<Pages>
<mvt:foreach iterator="page" array="Pages">
<mvt:assign name="g.is_lower" value="islower(l.settings:page:code)" />
<mvt:if expr="g.is_lower AND NOT (l.settings:page:code CIN g.excludes)">
<mvt:assign name="g.url" value="'http://' $ g.domain:name $ '/mm5/merchant.mvc?Store_Code=' $ g.Store_Code $ '&Screen=' $ l.settings:page:code" />
@steveosoule
steveosoule / dynamic-number-of-ajax-calls-when-done.js
Created June 25, 2014 21:09
Dynamic Number of AJAX Calls $when().done()
// FROM: http://stackoverflow.com/questions/14352139/multiple-ajax-calls-from-array-and-handle-callback-when-completed
// FROM: http://jsfiddle.net/MBZEu/4/
var list = ['obj1', 'obj2', 'obj3', 'obj4', 'obj5'];
var callback = function() {
console.log("done");
};
var requests = [];
for(i = 0; i < list.length; i++) {
requests.push($.ajax({
@steveosoule
steveosoule / dynamic-image-stack-and-resize.php
Created July 16, 2014 23:56
PHP - Dynamic Image Stack & Resize
<?php
/*
# Dynamic Image Stack
RewriteCond %{REQUEST_URI} /mm5/stack/(\d+)x(\d+)/top/(.*)/bottom/(.*)
RewriteRule ^(.*)$ http://www.example.com/mvthumb/stack.php?width=%1&height=%2&top=%3&bottom=%4 [L]
*/
// Example Usage: http://www.example.com/mm5/stack/300x350/top/graphics/00000001/sample-top-image.jpg/bottom/graphics/00000001/sample-bottom-image.jpg
// TODO: Add support for gif & png files
@steveosoule
steveosoule / object-oriented-javascript.js
Created July 23, 2014 16:59
Object Oriented Javascript
// FROM: http://snippetrepo.com/snippets/object-oriented-javascript
// Here I define global variables, which I update in this file
var windowWidth;
// Create a class
var App = function() {
// app variable will reference the App class (like using $this-> in php)
var app = this;
var debug = true; // Allows me to disable things in production, like app.log()
@steveosoule
steveosoule / heading-with-background-line.css
Created August 29, 2014 18:35
Heading with Background Line
/* ---- Heading with background line ---- */
/*
EXAMPLE
----------------------
<h5 class="heading-hr cyan uppercase">
<span>Customers Also Purchased</span>
</h5>
*/
.heading-hr{
display: block;
@steveosoule
steveosoule / supplant_simple-templates-with-vanilla-js.js
Last active August 29, 2015 14:06
Supplant: Simple templates with Vanilla JS
// FROM: http://www.qwiple.com/posts/14106/simple-templates-with-vanilla-js
if (!String.prototype.supplant) {
String.prototype.supplant = function(o) {
return this.replace(/{([^{}]*)}/g, function(a, b) {
var r = o[b];
return typeof r === 'string' ? r : a;
});
};
}