Skip to content

Instantly share code, notes, and snippets.

Avatar

Володя vgrish

View GitHub Profile
View chunk.product.content.tpl
<div class='tm-product'>
<h1>[[*pagetitle]]</h1>
<div id='msProduct' class='row' itemtype='http://schema.org/Product' itemscope>
<meta itemprop='name' content='[[*pagetitle]]'>
<meta itemprop='description' content='[[*description:default=`[[*pagetitle]]`]]'>
<div class='span5 col-md-5 col-sm-6'>
[[!msGallery@bsMsGallery]]
</div>
<div class='span7 col-md-7 col-sm-5' itemtype='http://schema.org/AggregateOffer' itemprop='offers' itemscope>
<meta itemprop='category' content='[[#[[*parent]].pagetitle]]'>
View chunk.product.row.tpl
<div class='row ms2_product col-md-4' itemtype='http://schema.org/Product' itemscope>
<meta itemprop='description' content='[[+description:default=`[[+pagetitle]]`]]'>
<div class='prev'>
<a href='[[+uri]]'>
<img src='[[+thumb:default=`[[++assets_url]]components/minishop2/img/web/ms2_small.png`]]' itemprop='image'
alt='[[+pagetitle]]' title='[[+pagetitle]]'>
</a>
</div>
<h3 class='tm-title' itemprop='name'>[[+pagetitle]]</h3>
@vgrish
vgrish / exp.Pdf.create.php
Last active Jun 17, 2020
exp.Pdf.create - сниппет для формирования pdf
View exp.Pdf.create.php
<?php
/** @var array $scriptProperties */
$pdfTpl = $scriptProperties['pdfTpl'] = trim($modx->getOption('pdfTpl', $scriptProperties, '@INLINE <a href="[[+file]]" target="_blank">download the pdf</a>', true));
$tplEmpty = $scriptProperties['tplEmpty'] = trim($modx->getOption('tplEmpty', $scriptProperties, '', true));
$pageEncoding = $scriptProperties['pageEncoding'] = trim($modx->getOption('pageEncoding', $scriptProperties, 'utf-8', true));
$pageFormat = $scriptProperties['pageFormat'] = trim($modx->getOption('pageFormat', $scriptProperties, 'A4', true));
$pageOrientation = $scriptProperties['pageOrientation'] = trim($modx->getOption('pageOrientation', $scriptProperties, 'L', true));
$pageMargins = $scriptProperties['pageMargins'] = trim($modx->getOption('pageMargins', $scriptProperties, '10,10,10,10', true));
$pageFont = $scriptProperties['pageFont'] = trim($modx->getOption('pageFont', $scriptProperties, 'courier', true));
View mFilter2.tpl
[[!mFilter2?
&parents=`7`
&element=`msProducts`
&tpl=`_tpl.msProducts.row`
&filters=`
parent:categories
,ms|price:number
`
View gist:b6998560c6a64c0f34109a9e632b9b56
[[!msOptionsPrice.initialize?]]
<h1>[[*pagetitle]]</h1>
<div id="msProduct" class="row">
<div class="col-md-6">
[[!msGallery]]
</div>
<div class="col-md-6">
<form class="form-horizontal ms2_form msoptionsprice-product" method="post">
<h3 class="msoptionsprice-name msoptionsprice-[[*id]]">[[*pagetitle]]</h3>
@vgrish
vgrish / _msOptions.php
Created Aug 24, 2015
<option value="[[+value]]" [[+selected]]>[[+value]] - [[+price]] - [[+total_price]] - [[+operation]]</option>
View _msOptions.php
<?php
$msop2 = $modx->getService('msop2', 'msop2', $modx->getOption('msop2_core_path', null, $modx->getOption('core_path') . 'components/msop2/') . 'model/msop2/', $scriptProperties);
if (!($msop2 instanceof msop2)) return '';
$msop2Option = 0;
if(!$msop2Option = $modx->getObject('msop2Option', $name)) {
$msop2Option = $msop2Option->get('id');
}
$miniShop2 = $modx->getService('minishop2');
/* @var array $scriptProperties */
/* @var pdoFetch $pdoFetch */
@vgrish
vgrish / msOptionsPrice.modification.tpl
Last active Dec 14, 2018
tpl.msOptionsPrice.modification processOptions
View msOptionsPrice.modification.tpl
<div class="row ms2_product">
<div class="col-md-8">
<form method="post" class="ms2_form">
<a href="{$rid | url}">{$product_pagetitle}</a>
{if $_pls['small']?}
<img src="{$_pls['small']}" alt="{$product_pagetitle}" title="{$product_pagetitle}"/>
{else}
<img src="{'assets_url' | option}components/minishop2/img/web/ms2_small.png"
srcset="{'assets_url' | option}components/minishop2/img/web/ms2_small@2x.png 2x"
View email.validate.php
<?php
/**
* Email validate
*
* @category validate
* @version 0.2
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @global array $spamDomain массив с доменами спам-почт
* @param string $email проверяемый email
* @param boolean $spam проверять ли домен почты на наличе в спам базе
View ajax1
<script type="text/javascript" language="JavaScript">
jQuery(function($){
$('#results').load('[[~43]]', {
action: 'field33',
parents: '3',
page: '1',
limit: '10',
//offset: '0'
//where: '{"Data.favorite":"1"}'
});
View zip.sh
#!/bin/bash
USER=root
PASSWORD=111111
BACKUP=/home/backup
OLD=7 # Сколько дней хранить бэкапы
# Создаем директорию для сегодняшнего бэкапа
DIR=$BACKUP/`date '+%Y-%m-%d'`
mkdir $DIR