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 | |
/** | |
на событие OnMODXInit | |
*/ | |
$rand = rand(1, 1000); | |
if ($rand === 1) { | |
$gcMaxlifetime = (integer) $modx->getOption('session_gc_maxlifetime', null, @ini_get('session.gc_maxlifetime'), true); | |
$access = time() - $gcMaxlifetime; | |
$modx->exec(" | |
DELETE FROM {$modx->getTableName('modSession')} WHERE `access` < {$access}; |
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 | |
/** | |
Класс оплаты в кредит или рассрочку для Тинькофф | |
*/ | |
require_once MODX_CORE_PATH . 'components/minishop2/model/minishop2/mspaymenthandler.class.php'; | |
class Tinkoff extends msPaymentHandler implements msPaymentInterface{ | |
public $demo; |
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
//плагин на событие msOnBeforeAddToCart. | |
$cartArray = $cart->get(); // Массив корзины | |
$cartStatus = $cart->status(); // Состояние корзины | |
$totalCount = $cartStatus['total_count']; // Общее количество товаров в корзине | |
foreach ($cartArray as &$cartProduct) { // Обрабатываем все товары корзины | |
if ($product = $modx->getObject('msProduct', $cartProduct['id'])) { // Получаем объект товара по его ID в корзине | |
$quanity = $product->get('count_prod)'; | |
$cartQuantity = $cartProduct["count"]; | |
if($cartQuantity > $quanity){ | |
$cartProduct['count'] = $quanity; |
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 | |
$allFormFields = $hook->getValues(); | |
if(is_array($allFormFields)){ | |
foreach($allFormFields as $k => $v){ | |
if (filter_var($v, FILTER_VALIDATE_EMAIL)) { | |
$mail = trim($v); | |
} | |
} | |
if($mail){ |
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 | |
$id = $modx->resource->id; | |
$tpls = explode(',', $modx->getOption('ms2_template_product_default')); | |
if (!isset($limit)) {$limit = 10;} | |
if (!isset($tpl)) {$tpl = 'tpl.msProducts.row';} | |
// Вносим ID просмотренных товаров | |
if (in_array($modx->resource->template, $tpls)) { | |
if (!isset($_SESSION['viewed'])) { |
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 | |
class taggerCustomFilter extends mse2FiltersHandler { | |
/** | |
* Retrieves values from Tagger table | |
* | |
* @param array $fields | |
* @param array $ids | |
* | |
* @return array |
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 | |
switch ($modx->event->name) { | |
case 'OnWebPagePrerender': | |
$output = &$modx->resource->_output; // перехватываем содержимое страницы | |
$output = str_replace(' type="text/javascript"',"",$output); | |
break; | |
} |
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 | |
$eventName = $modx->event->name; | |
switch($eventName) { | |
// case 'OnWebPageInit': | |
// if ($modx->context->get('key') == 'mgr') {return;} | |
// $modx->lexicon->load($modx->cultureKey . ':minishop2:default'); | |
// break; | |
case 'OnParseDocument': | |
if ($modx->context->get('key') == 'mgr') {return;} |
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 | |
//СОЗДАНИЕ ИЛИ ОБНОВЛЕНИЕ ГРУПП | |
$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) |
NewerOlder