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
{set $output = '!pdoResources' | snippet: [ | |
'parents' => '35|bb,39|bb' | |
'limit' => 0, | |
'includeTVs' => 'block_image', | |
'tvPrefix' => '', | |
'sortby' => '{ "menuindex":"ASC" }', | |
'where' => '{"parent:IN":[35|bb,39|bb]}', | |
'return' => 'json', | |
'select' => 'id,pagetitle,parent' | |
]} |
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
BreadcrumbList | |
Реализуем с помощью стандартного pdoCrumbs | |
{$_modx->runSnippet('pdoCrumbs',[ | |
'showHome'=> 1, | |
'showCurrent' => 1, | |
'from' => '0' | |
'tplWrapper'=> '@INLINE | |
<script type="application/ld+json"> |
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 | |
/** | |
на событие 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 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 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 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 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
var loadedMetrica = false; | |
window.addEventListener('scroll', loadMetrica); | |
window.addEventListener('click', loadMetrica); | |
window.addEventListener('mousemove', loadMetrica); | |
function loadMetrica() { | |
if (!loadedMetrica) { | |
setTimeout(function() { | |
/* ТУТ ВАШ КОД И СКРИПТЫ, метрика например*/ | |
},500); | |
} |
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 | |
$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 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
<button type="submit" onclick="ga('send', 'zakazat_zvonok', '/'); ym(99999,'reachGoal','ostavit_zayavku'); return true;" class="bt_red" style="display: block;"> | |
$(document).on("af_complete", function (event, response) { | |
var fid = response.form[0].id; | |
switch (fid) { | |
case 'question': | |
case 'online': | |
case 'modal_form': | |
case 'regForm': |