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
{'!msProducts' | snippet : [ | |
'parents'=>$_modx->resource.id, | |
'leftJoin' => '{ "images": { "class":"msProductFile","alias":"images", "on": "images.product_id = msProduct.id AND images.path LIKE \'%/small/\'" }}', | |
'select' => '{ "images":"GROUP_CONCAT(images.url SEPARATOR \';;\') as images"}', | |
'limit'=>0, | |
'sortby'=>'menuindex', | |
'sortdir'=>'ASC', | |
'showLog'=>0, | |
'tpl'=>'@FILE chunks/item/product.tpl' | |
]} |
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> | |
$(document).ready(function() { | |
miniShop2.Callbacks.add('Order.getcost.response.success', 'Order_submit_response_success', function(responce) { | |
var cost = responce.data['cost'], | |
min_price = {'price_config' | config}; | |
if (cost < min_price) { | |
miniShop2.Callbacks.add('Order.submit.before', 'Order_submit_before', function() { | |
miniShop2.Message.error('Недостаточная сумма заказа, заказ отправляется от ' + min_price + ' {'ms2_frontend_currency' | lexicon}!'); | |
$('#error_message').text('Недостаточная сумма заказа, заказ отправляется от ' + min_price + ' {'ms2_frontend_currency' | lexicon}!'); | |
return false; |
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
<div class="mt-textbox"> | |
<p>Showing | |
<strong id="START">{$_modx->getPlaceholder('mse2_start_page')}</strong> – | |
<strong id="END">{$_modx->getPlaceholder('mf_limit')}</strong> of | |
<strong>{$_modx->getPlaceholder('mf_total')}</strong> results</p> | |
</div> | |
<script> | |
$(document).on('mse2_load', function(e, data) { | |
let page = data.data.page; |
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
/* | |
<input type="hidden" name="{$formID}_ip" value="{'!getIP' | snippet}" /> | |
*/ | |
<?php | |
if (!function_exists('getIp')) { | |
function getIp() { | |
$keys = [ | |
'HTTP_CLIENT_IP', | |
'HTTP_X_FORWARDED_FOR', | |
'REMOTE_ADDR' |
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 $key = $table ~ $delimeter ~ $filter} | |
<input type="hidden" name="{$filter}[]" value="" /> | |
<label for="mse2_{$key}_{$idx}" class="checkbox-label {$disabled}"> | |
<input type="checkbox" name="{$filter}[]" id="mse2_{$key}_{$idx}" value="{$value}" {$checked} {$disabled} | |
{('fi.' ~ $filter) | placeholder | FormItIsChecked : $value}> | |
<span class="checkmark"></span> | |
{$title} | |
</label>{*$num*} |
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 $time = '' | date_format : "%s" - (24*60*60)} | |
{$time | date_format : "%b %d, %Y"} | |
или сниппет | |
<?php | |
$yesterday = date('F j, Y', time()-86400); | |
return $yesterday; |
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 $main = $_modx->resource.main | fromJSON} | |
<div data-youtube="{$main[0]['url']}"></div> | |
<script src="/assets/js/youtube-background.js"></script> | |
<script> | |
jQuery(document).ready(function() { | |
jQuery('[data-youtube]').youtube_background(); | |
}); | |
</script> |
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 | |
$resources = $modx->getCollection('modResource', [ | |
'class_key' => 'msProduct' | |
]); | |
foreach ($resources as $res) { | |
$res->save(); | |
} |
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
Список ресурсов сделан списком и выведен через процессор в msFieldsManager для свойств товара | |
'optionFilters' => '{ "collection:!=":"" }', | |
'where' => ['collection.value' => $_modx->resource.pagetitle], |
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 $par = $_modx->resource.parent | url} | |
{set $getTag = $_modx->resource.id | url | replace : $par : ''} | |
{set $parents = $_modx->resource.parent} | |
{*Находим шаблон родителя*} | |
{set $parentTemplate = $parents | resource: 'template'} | |
{*Если это тег, значит поднимаемся выше для получения родителя*} | |
{if $parentTemplate == 27} | |
{set $parents = $parents | resource: 'parent'} |