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
Ext.override(miniShop2.panel.Product, { | |
getProductFields: function (config) { | |
var enabled = miniShop2.config.data_fields; | |
var available = miniShop2.config.extra_fields; | |
var product_fields = this.getAllProductFields(config); | |
var col1 = []; | |
var col2 = []; | |
var tmp; | |
for (var i = 0; i < available.length; i++) { |
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 | |
$parents = file_exists(MODX_BASE_PATH . 'parents.txt')?json_decode(file_get_contents(MODX_BASE_PATH . 'parents.txt'), true):[]; | |
//print_r($parents); | |
$ress = $modx->getCollection('modResource'); | |
foreach($ress as $res){ | |
$content = $res->get('content'); | |
preg_match_all('/\[\[\~(\d+)\~{0,}\]\]/', $content, $links); | |
if($links[1]){ | |
foreach($links[1] as $k => $lnk){ | |
if(isset($parents[$lnk])){ |
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 | |
$modx->addPackage('colorsProducts', MODX_CORE_PATH . 'components/colorsProducts/model/'); | |
for($idx=1;$idx <= 20;$idx++){ | |
$url = 'https://colorscheme.ru/ncs-colors-'.$idx.'.html'; | |
$options = array( | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_HEADER => false, | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_ENCODING => "", |
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 | |
$modx->addPackage('colorsProducts', MODX_CORE_PATH . 'components/colorsProducts/model/'); | |
$url = 'https://ral.ru/classic_colours'; | |
$options = array( | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_HEADER => false, | |
CURLOPT_FOLLOWLOCATION => false, | |
CURLOPT_ENCODING => "", | |
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17", |
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 | |
// Сколько ресурсов обрабатывать за раз | |
$step = 1; | |
// Если процесс уже остановлен, сбрасываем OFFSET | |
if (!isset($_SESSION['Console']['completed'])) { | |
$_SESSION['console_offset'] = 0; | |
} | |
$offset = isset($_SESSION['console_offset']) && $_SESSION['console_offset'] ? $_SESSION['console_offset'] : 0; | |
// Формируем запрос |
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 'OnDocFormPrerender': | |
$script = ' | |
if(Ext.getCmp(\'minishop2-product-tabs\')){ | |
MODx.addTab("minishop2-product-tabs",{title:"Параметры товара / Размеры",id:"modx-resource-table-sizes"}); | |
a = Ext.getCmp(\'modx-resource-table-sizes\'); | |
b = Ext.getCmp(\'minishop2-options-vtabs\'); |
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 'OnDocFormPrerender': | |
$script = ' | |
if (MODx.loadRTE && Ext.getCmp(\'modx-resource-introtext\')) { | |
MODx.loadRTE(\'modx-resource-introtext\'); | |
} | |
'; | |
$modx->controller->addHtml('<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
DirectoryIndex index.php | |
RewriteEngine On | |
RewriteBase / | |
# Rewrite www.example.com -> example.com | |
RewriteCond %{HTTP_HOST} . | |
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
# Force rewrite to https for every host |
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 | |
$allFormFields = $hook->getValues(); | |
if(is_array($allFormFields)){ | |
foreach($allFormFields as $k => $v){ | |
if (filter_var($v, FILTER_VALIDATE_EMAIL)) { | |
$mail = trim($v); | |
} | |
} | |
if($mail){ |
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 | |
/** | |
* Plugin to add a "created by" field on a resource form and moves "published on" to document tab | |
* | |
* @var modX $modx | |
* @var array $scriptProperties | |
* | |
* @event OnDocFormPrerender | |
*/ | |
$dateFormat = $modx->getOption('manager_date_format',null,'d.m.Y'); |