This file contains 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 | |
//СОЗДАНИЕ ИЛИ ОБНОВЛЕНИЕ ГРУПП | |
$groups = array( | |
array('id' => 1,'sortorder' => 1,'label' => 'Общие'), | |
array('id' => 2,'sortorder' => 2,'label' => 'Почта'), | |
array('id' => 3,'sortorder' => 3,'label' => 'Политика и куки'), | |
array('id' => 4,'sortorder' => 4,'label' => 'Социальные сети'), | |
); | |
foreach ($groups as $group) |
This file contains 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
$('button#cart_add').click(function(e){ // не забудьте изменить селектор | |
// Добавляем товары в корзину | |
var products = []; | |
$('input[name="price"]:checked').each(function () { | |
var product = {}; | |
product['id'] = $(this).data('dop'); | |
product['count'] = $(this).parents('.tm-dop').find('input.number-input').val(); | |
products.push(product); | |
}); | |
// Добавляем услуги в корзину |
This file contains 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
/* Плагин с событием на OnBeforeCommentSave | |
https://modx.pro/help/4370 | |
https://bezumkin.ru/sections/522/1540/ */ | |
if ($modx->event->name == 'OnBeforeCommentSave') { | |
if(!empty($_POST['my_property_prop'])){ | |
$properties = array( | |
'my_property' => $modx->stripTags($_POST['my_property_prop']) | |
); | |
} else { |
This file contains 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 | |
$context = $modx->context->get('key'); | |
if ($context == 'mgr' || empty($_POST['quick_order']) || empty($_POST['id']) || empty($_POST['customer'])) { | |
return; | |
} | |
/** | |
* @var miniShop2 $miniShop2 | |
*/ | |
$miniShop2 = $modx->getService('minishop2'); | |
$miniShop2->initialize($context, array( |
This file contains 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 | |
class taggerCustomFilter extends mse2FiltersHandler { | |
/** | |
* Retrieves values from Tagger table | |
* | |
* @param array $fields | |
* @param array $ids | |
* | |
* @return array |
This file contains 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
01-autoResizeOnUpload.php - Plugin to automatically resize images uploaded via MODX that are larger than the dimensions specified | |
in the config within the plugin code. This should be considered experimental but has been tested | |
successfully on MODX Revolution 2.3.2-pl (traditional) running on Windows Server 2008. | |
02-set-expires-headers.php - Sets expires headers to value defined in plugin |
This file contains 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
#!/bin/bash | |
echo Please specify MODX version: | |
read version | |
echo Downloading MODX $version... | |
wget https://modx.com/download/direct?id=modx-$version-pl.zip | |
unzip direct\?id\=modx-$version-pl.zip && rm direct\?id\=modx-$version-pl.zip |
This file contains 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 | |
// Переопределяем метод и добавляем стоимость доставки. | |
class CustomOrder extends msOrderHandler{ | |
public function getCost($with_cart = true, $only_cost = false) { | |
$response = $this->ms2->invokeEvent('msOnBeforeGetOrderCost', array( | |
'order' => $this, |
This file contains 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
<script> | |
miniShop2.Order.deliveryCost = '#ms2_delivery_cost'; | |
miniShop2.Callbacks.Order.getcost.response.success = function(response) { | |
var rdc = response.data['delivery_cost']; | |
if(rdc) $(miniShop2.Order.deliveryCost, miniShop2.Order.order).text(miniShop2.Utils.formatPrice(rdc)); | |
else $(miniShop2.Order.deliveryCost, miniShop2.Order.order).text('0'); | |
} |
This file contains 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 | |
/* | |
参考自: | |
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function | |
http://snipplr.com/view/68099/ | |
*/ | |
function HTTPStatus($num) { | |
$http = array( |
NewerOlder