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 | |
/** | |
* ========================= | |
* ChangeTemplate | |
* ========================= | |
* | |
* Plugin for MODX Revolution | |
* Set which template is inherited by children | |
* documents of a certain parent document | |
* |
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 | |
ini_set('max_execution_time', 0); | |
ignore_user_abort(true); | |
$c = 'modResource'; | |
$q = $modx->newQuery($c); | |
$q->where(array('class_key' => 'msProduct')); | |
$q->sortby('id'); | |
$q->select(array( | |
"{$c}.*", | |
)); |
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 | |
print '<pre>'; | |
$query = $this->modx->newQuery('msProduct'); | |
$query->setClassAlias('Product'); | |
$query->leftJoin('msProductData','Data', '`Product`.`id` = `Data`.`id`'); | |
$query->select($this->modx->getSelectColumns('msProduct','Product','')); | |
$query->select($this->modx->getSelectColumns('msProductData','Data','data.')); | |
$query->where(array( | |
'`Data`.`vendor`' => 5, |
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 | |
// ********************************* // | |
/** @var mindbox $mindbox */ | |
$modx->loadClass('modMindbox', MODX_CORE_PATH . 'components/mindbox/model/', true, true); | |
$mindbox = new modMindbox($modx, []); | |
if (!$mindbox) { | |
return 'Could not load modMindbox class!'; | |
} | |
$q = $modx->newQuery('msOrder', [ |
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
{set $goods = 'msProducts' | snippet : [ | |
'sortby' => '{"null_total_remains":"DESC", "menuindex":"DESC"}', | |
'tpl' => 'good.category3', | |
'leftJoin' => [ | |
"remains" => [ | |
"class" => "modTemplateVarResource", | |
"on" => "msProduct.id = remains.contentid AND remains.tmplvarid IN (29,30,31,32,33,34,52)" // id TV с остатками | |
], | |
], | |
'select' => [ |
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 | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class AddRoleIdToUsersTable extends Migration | |
{ | |
public function up() | |
{ |
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
$('button#cart_add').click(function(e){ // не забудьте изменить селектор | |
// Добавляем товары в корзину | |
var products = []; | |
$('input[name="price"]:checked').each(function () { | |
var product = {}; | |
product['id'] = $(this).data('dop'); | |
product['count'] = $(this).parents('.tm-dop').find('input.number-input').val(); | |
products.push(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
<?php | |
/* | |
Скрипт надо запускать от юзера - владельца сайта, чтобы созданные файлы пакетов не принадлежали юзеру root | |
$ sudo -u USERNAME php /var/www/USERNAME/packages.php /var/www/USERNAME/www/ | |
Или от root, а после выставить владельца: | |
$ php /root/scripts/modx/packages.php /var/www/USERNAME/www/ && /var/www/USERNAME/chmod | |
Чтобы запустить из веба, просто положите скрипт в корень или куда-нибудь глубже и вызовите по HTTP | |
*/ |
NewerOlder