This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define('ROOT', MODX_BASE_PATH); | |
| define('EX', 'jpg,png,gif,jpeg,doc,xls,zip,pdf'); // Через запятую имена расширений (нижний регистр) | |
| $folder=isset($folder) ? $folder : "assets/images/"; // папка назначения стыренного контента | |
| if(!is_dir(MODX_BASE_PATH.$folder)) mkdir(MODX_BASE_PATH.$folder); | |
| // Функция траслита | |
| function rus2translit($string) { | |
| $converter = array( | |
| 'а' => 'a', 'б' => 'b', 'в' => 'v', | |
| 'г' => 'g', 'д' => 'd', 'е' => 'e', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $chunk = 'tpl.msdfcMsg'; | |
| $discounts = array( | |
| '100000' => '10%', | |
| '150000' => '15%', | |
| '200000' => '20%', | |
| ); | |
| krsort($discounts); | |
| reset($discounts); | |
| $actionKey = 'msdfc_action'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Привязывать к событию OnFileManagerUpload. | |
| $currentdoc = $modx->newObject('modResource'); | |
| foreach($files as $file) | |
| { | |
| if($file['error'] == 0) | |
| { | |
| $pathInfo = pathinfo($file['name']); | |
| $oldPath = $directory.$file['name']; | |
| $newPath = date("Y-m-d-h-s-").$currentdoc->cleanAlias($pathInfo['filename']).'.'. $pathInfo['extension']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Решение для магазина miniShop2. Проверялось на версии ms2 2.1.8-pl3, MODX Revo 2.3.1-pl. | |
| Простой способ делать зависимость цены доставки от общей суммы заказа. | |
| 1. Создаем файл (myDeliveryHandler.class.php) в каталоге /core/components/minishop2/custom/delivery/ | |
| 2. Получается файл c путем /core/components/minishop2/custom/delivery/myDeliveryHandler.class.php | |
| 3. Копируем содержимое в файл myDeliveryHandler.class.php | |
| 4. Теперь добавляем в настройки системы новый ключ. Я добавляю в настройки контекста. | |
| 5. Ключ - ms2_delivery_cost_free_1 . Цифра «1» - это ID способа доставки. В значении указываем нужную сумму. | |
| 6. У каждого способа доставки указываем класс-обработчик myDeliveryHandler. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #MODX requred pdoTools, phpthumbon, jevix | |
| <!--<?xml version="1.0" encoding="utf-8"?> | |
| <rss xmlns:yandex="http://news.yandex.ru" | |
| xmlns:media="http://search.yahoo.com/mrss/" | |
| xmlns:turbo="http://turbo.yandex.ru" version="2.0"> --> | |
| <channel> | |
| [[!pdoResources? | |
| &tpl=`turborss.item` | |
| &limit=`100` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Gulp 4 | |
| var gulp = require('gulp'); | |
| var using = require('gulp-using'); | |
| var grep = require('gulp-grep'); | |
| var changed = require('gulp-changed'); | |
| var del = require('del'); | |
| var coffee = require('gulp-coffee'); | |
| var less = require('gulp-less'); | |
| var coffeelint = require('gulp-coffeelint'); | |
| var sourcemaps = require('gulp-sourcemaps'); |