This file contains hidden or 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 | |
$siteName = $modx->getOption('siteName', $scriptProperties, $modx->getOption('site_name')); // Имя сайта | |
$companyName = $modx->getOption('companyName', $scriptProperties, $modx->getOption('site_name')); // Компания | |
$bid = $modx->getOption('bid', $scriptProperties, 10); // Цена за клик | |
$siteUrl = $modx->makeUrl($modx->getOption('site_start'), '', '', 'full'); // Ссылка на главную страницу сайта | |
$descTpl = strip_tags($modx->getOption('descTpl', $scriptProperties, '[[+description]]')); // Шаблон для описания товара, без html | |
$paramCurrency = $modx->getOption('paramCurrency', $scriptProperties, 'RUR'); // Валюта | |
$paramDelivery = $modx->getOption('paramDelivery', $scriptProperties, true); // Доставка, по умолчанию - да. Можно указать имя параметра. | |
////////////////////////////////////////////////////////////////////////////// |
This file contains hidden or 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
/** v.1.1.0 -- */ | |
msfavorites = { | |
options: { | |
selector: '.msfavorites', | |
add: '.msfavorites-add', | |
remove: '.msfavorites-remove', | |
go: '.msfavorites-go', | |
total: '.msfavorites-total', | |
element: '.ms2_product', |
This file contains hidden or 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 'OnManagerPageBeforeRender': | |
$msoptionscolor = $modx->getService('msoptionscolor', 'msoptionscolor', $modx->getOption('msoptionscolor_core_path', null, $modx->getOption('core_path') . 'components/msoptionscolor/') . 'model/msoptionscolor/'); | |
if (!($msoptionscolor instanceof msoptionscolor)) { | |
return ''; | |
} | |
if (!$config = $controller->config) { | |
return ''; |
This file contains hidden or 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
// Функция сортировки товаров | |
function sortCatalog(products, section, reverse = false) { | |
// Переменные | |
var arProductsList = []; | |
var strHtml = ''; | |
// Переделываем в массив | |
products.each(function (e) { | |
arProductsList.push(products[e]); | |
}); |
This file contains hidden or 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
this.value = sum(this.value); | |
function sum(str) { | |
str=str.trim().replace(/[^\d\.]+/gi,""); | |
var s=str.indexOf(".",str.indexOf(".")); | |
if(s>=0){ | |
str=str.substr(0,s+3); | |
var whole = str.substr(0,s); | |
var fractional = str.substr(s+1, s+3).replace(/[^\d]+/gi,""); | |
str = whole +'.'+ fractional; | |
} |
This file contains hidden or 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 | |
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); |
This file contains hidden or 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 | |
$tplProduct = 3; //номер шаблона для карточки товара | |
$tplParent = 2; //номер шаблона для категорий | |
$tplChildParent = 2; //номер шаблона для подкатегорий | |
$idParent = 6; //id каталога товаров | |
$fileProduct = 'product.xml'; //имя файла с товарами | |
$xpath_expression['pagetitle'] = '//Товары/Номенклатура'; //DOM структура в XML файле до имени | |
$xpath_expression['article'] = '//Товары/Артикул'; //DOM структура в XML файле до артикула | |
$xpath_expression['parents'] = '//Товары/Родитель'; //DOM структура в XML файле до родителей |
This file contains hidden or 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 | |
$tplProduct = 3; //номер шаблона для карточки товара | |
$tplParent = 2; //номер шаблона для категорий | |
$tplChildParent = 2; //номер шаблона для подкатегорий | |
$idParent = 6; //id каталога товаров | |
$fileProduct = 'product.xml'; //имя файла с товарами | |
$xpath_expression['pagetitle'] = '//Товары/Номенклатура'; //DOM структура в XML файле до имени | |
$xpath_expression['article'] = '//Товары/Артикул'; //DOM структура в XML файле до артикула | |
$xpath_expression['parents'] = '//Товары/Родитель'; //DOM структура в XML файле до родителей |
This file contains hidden or 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 hidden or 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 | |
// msOnCreateOrder | |
// msOnChangeOrderStatus | |
switch ($modx->event->name) { | |
case 'msOnCreateOrder': | |
// Новый заказ | |
// $modx->log(xPDO::LOG_LEVEL_ERROR, 'msOnCreateOrder'); | |
$iOrderId = $msOrder->get('id'); | |
$oOrder = $order->get(); |
OlderNewer