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 | |
$parentPageId = $modx->resource->get('id'); | |
$level = count($modx->getParentIds($parentPageId)); | |
echo $level; |
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 | |
switch ($modx->event->name) { | |
case 'OnWebPagePrerender': | |
$output = &$modx->resource->_output; // перехватываем содержимое страницы | |
$output = str_replace(' type="text/javascript"',"",$output); | |
break; | |
} |
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 | |
$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 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) |
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 | |
$catid = array($modx->resource->id); | |
$in_id = implode(",", $catid) ; | |
$sql = "SELECT msc.category_id, msc.option_id, mso.key, mso.type | |
FROM {$modx->getTableName('msCategoryOption')} msc | |
LEFT JOIN {$modx->getTableName('msOption')} mso ON msc.option_id = mso.id | |
WHERE msc.category_id IN ($in_id) AND mso.filtr=1 ORDER BY mso.category, mso.id ASC"; | |
$q = $modx->prepare($sql); | |
$q->execute(); | |
$options = $q->fetchAll(PDO::FETCH_ASSOC); |
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
в head | |
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script> | |
<script src="https://maps.google.com/maps/api/js?language=ru&key=AIzaSyBkYlYr9e5MXFICXWBIxDZgg8N53X_WiSU"></script> | |
<script src="/assets/js/infobox.min.js"></script> | |
<script src="/assets/js/markerclusterer.js"></script> | |
======================================================= | |
вызов в шаблоне | |
{if $.get.tpl == '0' || $.get.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
{ | |
"formtabs":[ | |
{ | |
"MIGX_id":2, | |
"caption":"\u0412\u043a\u043b\u0430\u0434\u043a\u0430", | |
"print_before_tabs":"0", | |
"fields":[ | |
{ | |
"MIGX_id":4, | |
"field":"tab_name", |
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 msOrder extends xPDOSimpleObject | |
{ | |
public function updateProducts() | |
{ | |
$originalContext = $this->xpdo->context->get('key'); | |
$this->xpdo->switchContext($this->get('context')); | |
$originalMiniShop = isset($this->xpdo->services['minishop2']) ? $this->xpdo->services['minishop2'] : null; | |
$cart = array(); | |
foreach ($this->getMany('Products') as $product) { |
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="form-group"> | |
<input type="text" name="product" value="[[!+fi.product]]" class="form-control" readonly="readonly"> | |
</div> | |
JS вешаем на кнопку | |
{ignore} | |
<script> | |
$(document).ready(function() { | |
$('a.theme-btn.btn-style-five').on('click', function(){ |