Skip to content

Instantly share code, notes, and snippets.

@webinmd
webinmd / Вывод количества товаров в категории.php Вывод количества товаров в категории minishop2 Сниппет получает сумму всех товаров в категории, с учетом мультикатегорий MS2. Можно указать нужную категорию параметром $parent.
<?php
if (empty($parent)) {$parent = $modx->resource->id;}
$pids = array_merge(array($parent), $modx->getChildIds($parent));
$ids = array();
$q = $modx->newQuery('msProduct');
$q->where(array('class_key' => 'msProduct','parent:IN' => $pids,'published' => 1,'deleted' => 0));
$q->select('`msProduct`.`id`');
if ($q->prepare() && $q->stmt->execute()) {
$ids = $q->stmt->fetchAll(PDO::FETCH_COLUMN);
<?php
switch ($modx->event->name) {
case 'msopOnModificationSave':
$modification = $modx->getOption('modification', $scriptProperties);
if (!$modification) {
return;
}
/** @var msProduct $product */
@webinmd
webinmd / sticky_footer.html
Last active June 12, 2018 09:19 — forked from droganaida/sticky_footer.html
3 способа, как прижать footer к низу страницы
@webinmd
webinmd / msVendors.php
Last active May 11, 2025 18:59 — forked from maxpoletaev/msVendors.php
Snippet for MiniShop2. Get vendors from category. - Вывод брендов для категории товаров
<?php
$pdo = $modx->getService('pdoTools');
$fieldName = $modx->getOption('fieldName', $scriptProperties, 'vendor');
$fieldClass = $modx->getOption('fieldClass', $scriptProperties, '');
$firstOption = $modx->getOption('firstOption', $scriptProperties, '');
$parent = $modx->getOption('parent', $scriptProperties, $modx->resource->get('id'));
$depth = $modx->getOption('depth', $scriptProperties, 10);
$limit = $modx->getOption('limit', $scriptProperties, 100);
$tplOuter = $modx->getOption('tplOuter', $scriptProperties, '@INLINE <ul class="brands">[[+rows]]</ul>');
@webinmd
webinmd / style.scss
Created April 27, 2018 13:16
Equal Heights for OwlCarousel 2
/* Equal Heights for OwlCarousel 2 */
.owl-carousel {
.owl-stage {
display: flex;
}
.owl-item {
display: flex;
flex: 1 0 auto;
// textarea auto expand
var textarea = document.querySelector('textarea');
textarea.addEventListener('keydown', autosize);
function autosize(){
var el = this;
setTimeout(function(){
el.style.cssText = '';
el.style.cssText = 'height:' + el.scrollHeight + 'px';
},0);
<textarea name="message" data-max="50" ></textarea>
$('.symbol-count').keyup(function () {
var max = $(this).data('max');
var len = $(this).val().length;
$(this).closest('form').find('.symbol-count').find('span').text(len);
});
<div class="quantity">
<span class="bminus"></span>
<input type="number" name="count" value="1" min="1" required >
<span class="bplus"></span>
</div>
<script>
/* quantity count plus/minus
<div class="tabs">
<ul class="tabs__caption">
<li class="active">1-я вкладка</li>
<li>2-я вкладка</li>
</ul>
<div class="tabs__content active">
Содержимое первого блока
</div>
@webinmd
webinmd / ace.min.js
Created August 22, 2018 09:43
Исправление позиции курсора для кириллицы в редакторе ace
.ace_editor, .ace_editor div{ font-family:monospace }