Skip to content

Instantly share code, notes, and snippets.

@steveosoule
steveosoule / april-fools.css
Created April 2, 2013 19:56
april-fools.css
/*
aprilFools.css
Written by Wes Bos
I assume no responsibility for angry co-workers or lost productivity
Put these CSS definitons into your co-workers Custom.css file.
They will be applied to every website they visit as well as their developer tools.
*/
@steveosoule
steveosoule / api.html
Last active August 16, 2023 17:57
Miva - Variant Volume Pricing & Predicted Discounts
<mvt:if expr="g.get EQ 'Variant_Volume_Pricing' AND g.Product_Code AND g.Variant_ID">
<mvt:do file="g.Module_Feature_PGR_UT" name="l.result" value="DiscountState_CreateFromBasket( g.Basket, l.discount_state )" />
<mvt:do file="g.Module_Feature_PGR_UT" name="l.result" value="DiscountState_Load_PriceGroups_Basket( g.Basket, l.discount_state )" />
<mvt:do file="g.Module_Feature_PGR_UT" name="l.result" value="DiscountState_Disable_Unused_Item_PriceGroups( l.discount_state )" />
<mvt:do file="g.Module_Feature_PGR_UT" name="l.result" value="DiscountState_Predict_Baseline_Discounts( l.discount_state )" />
<mvt:do file="g.Module_Library_DB" name="l.settings:product:result_of:product_load" value="Runtime_Product_Load_Code(g.Product_Code, l.settings:product)" />
<mvt:do file="g.Module_Library_DB" name="l.settings:product:result_of:productlist_load_part" value="ProductList_Load_Variant(l.settings:product:id, g.Variant_ID, l.settings:product:parts)" />
@steveosoule
steveosoule / miva-prod-price-debugger.xml
Last active July 26, 2023 20:08
Miva - PROD Price Debugger
<pre>
@@price
product:price=&mvte:product:price;
product:inv_level=&mvte:product:inv_level;
attributemachine:product:price=&mvte:attributemachine:product:price;
attributemachine:product:inv_level=&mvte:attributemachine:product:inv_level;
attributemachine:variant_id=&mvte:attributemachine:variant_id;
<mvt:assign name="g.mvt_debug" value="glosub( miva_array_serialize( l.settings:product ), ',', asciichar( 10 ) )" />
@@l.settings:product
@steveosoule
steveosoule / tokenize-object.js
Created July 25, 2023 16:31
JavaScript Tokenize Object
const tokenizeObject = (obj = {}, tokens = [], replacements = []) => {
if (!Array.isArray(tokens) || !Array.isArray(replacements) || tokens.length !== replacements.length) {
return obj;
}
const replacedJsonObj = tokens.reduce((jsonObj, token, i) => {
return jsonObj.replace(token, replacements[i]);
}, JSON.stringify(obj));
return JSON.parse(replacedJsonObj);
@steveosoule
steveosoule / miva-failed-icsq-redirect-to-http-referer.xml
Last active July 20, 2023 19:45
Miva - Failed ICSQ Redirect to HTTP Referer
<mvt:if expr="g.Session:cache:last_ui_exception EQ 'customer_invalid_addinfo' AND NOT ISNULL s.http_referer">
<mvt:do file="g.Module_Feature_URI_UT" name="l.http_referer_uri" value="URL_To_URI( s.http_referer )" />
<mvt:do file="g.Module_Feature_URI_DB" name="l.uri_found" value="URI_Load_URI( l.http_referer_uri, l.uri )" />
<mvt:if expr="l.uri_found">
<mvt:assign name="l.flags:sep" value="1" />
<mvt:if expr="l.uri:product_id">
<mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_ID_Cached( l.uri:product_id, l.product )" />
<mvt:do file="g.Module_Feature_URI_UT" name="l.referer_url" value="Store_Product_URL( l.product, l.flags )" />
<mvt:elseif expr="l.uri:cat_id">
<mvt:do file="g.Module_Library_DB" name="l.success" value="Category_Load_ID_Cached( l.uri:cat_id, l.category )" />
@steveosoule
steveosoule / .bashrc
Created June 26, 2023 16:20
Helpful Bash Aliases and Functions for MMT
alias mmt-push-commit='mmt push --notes="mmt-push-commit: `git log --pretty=oneline -n 1`"'
alias mpc='mmt-push-commit'
alias mmt-tag-git-branch='mmt tag add $(git rev-parse --abbrev-ref HEAD)'
alias mmt-tag-git-commit='mmt tag add $(git rev-parse --short HEAD)'
function mmt-push() {
mmt tag delete --all
mmt-tag-git-branch
mmt-tag-git-commit
@steveosoule
steveosoule / miva-mivascript-formatted-date-timestamp.xml
Last active April 3, 2023 22:44
Miva - MivaScript Formatted Date Timestamp
<mvt:assign name="g.current_time" value="s.time_t" />
<mvt:assign name="g.timezone_offset" value="'local'" />
<mvt:comment><!-- <mvt:assign name="g.timezone_offset" value="'-4'" /> --></mvt:comment>
<mvt:comment>
| Format Date
| /lib/util_soap.mv
| <MvFUNCTION NAME = "Format_SOAP_DateTime" PARAMETERS = "time_t" STANDARDOUTPUTLEVEL = "">
</mvt:comment>
<mvt:do file="g.Module_Library_Utilities" name="g.Format_SOAP_DateTime" value="Format_SOAP_DateTime( g.current_time )" />
@steveosoule
steveosoule / jquery-validate-birthday-date-format.js
Last active March 29, 2023 11:14
jquery.validate - Birthday Date Format
$.validator.addMethod("birthday_date", function (value) {
// var pattern = /\d{2}\/\d{2}\/\d{4}/;
// var pattern = /1?[0-9]\/[1-3]?[0-9]\/[0-9][0-9][0-9][0-9]/;
var pattern = /^([0-9]|1[0-2])\/([0-9]|1[0-9]|2[2-9]|3[0-1])\/[0-9][0-9][0-9][0-9]$/;
return pattern.test(value);
}, "Please enter your birthday as MM/DD/YYYY.");
@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;
}