Skip to content

Instantly share code, notes, and snippets.

@webinmd
webinmd / Native.js
Created September 6, 2019 15:14 — forked from alexreardon/Native.js
Some vanilla JS methods and patterns
// Native selectors.
(function(window, document) {
'use strict';
var noop = function() {
};
// DOCUMENT LOAD EVENTS
// not needed at the bottom of the page
document.addEventListener('DOMContentLoaded', noop);
@webinmd
webinmd / changePriceAddToCart.php
Created January 24, 2025 12:45 — forked from andronex/changePriceAddToCart.php
Изменение цены в зависимости от выбранных опций товара (miniShop2 + MODX Revolution).
<?php
switch ($modx->event->name){
case 'msOnBeforeAddToCart':
if (!is_array($options)) $options = json_decode($options, true);
//$modx->log(modX::LOG_LEVEL_ERROR, print_r($cart->get(), true));
//$modx->log(modX::LOG_LEVEL_ERROR, print_r($product->toArray(), true));
if(isset($options['size-price']) && !empty($options['size-price'])){
$tvr = $modx->getObject('modTemplateVarResource', array(