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('display_errors', 1); | |
error_reporting(E_ALL); | |
ini_set('memory_limit', '4048M'); | |
ini_set('max_execution_time', '10000000'); | |
error_reporting(E_ERROR); | |
header('Content-type: text/html; charset=utf-8'); | |
define('MODX_API_MODE', true); | |
require dirname(__FILE__).'/index.php'; |
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
В схеме данных minishop2 ДЛЯ ДОЛБАЕБОВ НАПИСАНО | |
<object class="msProduct" extends="modResource"> | |
.............................. | |
<composite alias="Options" class="msProductOption" local="id" foreign="product_id" cardinality="many" | |
owner="local"/> | |
</object> | |
Поэтому ваш код должен быть ПРИМЕРНО БЛЯТЬ ТАКИМ | |
foreach ($resources as $res) { | |
$data = $res->getMany('Options'); |
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 | |
if ($param != null || $param!= 0){ | |
$where = array('parent' => $param); | |
$elements = $modx->getCollection('msCategory',$where); | |
foreach ($elements as $menuValue){ | |
echo ''//тут выведи html, а вообще в идеале - в чанк | |
$modx->runSnippet('pdoMenu',$menuValue); | |
} | |
} | |
} |
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 | |
if (empty($parent) || empty($tplOuter)){ | |
$parent = $modx->resource->get('id'); | |
$tplOuter = 1; | |
} | |
$letters = $modx->runSnippet('pdoResources', [ | |
'parent' => $parent, | |
'tpl' => '@INLINE [[+$pagetitle:first]]', | |
'sortby' => '{"pagetitle":"ASC"}', |
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
//плагин на событие msOnBeforeAddToCart. | |
$cartArray = $cart->get(); // Массив корзины | |
$cartStatus = $cart->status(); // Состояние корзины | |
$totalCount = $cartStatus['total_count']; // Общее количество товаров в корзине | |
foreach ($cartArray as &$cartProduct) { // Обрабатываем все товары корзины | |
if ($product = $modx->getObject('msProduct', $cartProduct['id'])) { // Получаем объект товара по его ID в корзине | |
$quanity = $product->get('count_prod)'; | |
$cartQuantity = $cartProduct["count"]; | |
if($cartQuantity > $quanity){ | |
$cartProduct['count'] = $quanity; |
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 | |
//проверяем есть ли параметр $parent. Если нет используем ID текущего ресурса. | |
if(empty($parent)) { | |
$parent = 2; | |
$tplOuter = 'tpl_brands'; | |
$tplItem = '@INLINE <a href="[[+uri]]">[[+pagetitle]]</a><br/>'; | |
} | |
//Получаем список заглавных букв |
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 | |
if(empty($parent)) { | |
$parent = 2; | |
$tplOuter = 'tpl_brands'; | |
$tplItem = '@INLINE <a href="[[+uri]]">[[+pagetitle]]</a><br/>'; | |
} | |
//Получаем список заглавных букв | |
$letters = $modx->runSnippet('pdoResources', array( |
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 | |
$q = $modx->newQuery('modResource', array( | |
'parent:IN' => array(0), // Перечисляем id разделов, если надо, но если документов не очень много, то можно с корня | |
)); | |
// Это условие указывает поиск только документов без uri | |
$q->andCondition(array( | |
'uri' => null, | |
'OR:uri:=' => '', | |
)); |
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
use App\Jobs\ProcessPodcast; | |
use App\Podcast; | |
use Illuminate\Bus\Batch; | |
use Illuminate\Support\Facades\Bus; | |
use Throwable; | |
$batch = Bus::batch([ | |
new ProcessPodcast(Podcast::find(1)), | |
new ProcessPodcast(Podcast::find(2)), | |
new ProcessPodcast(Podcast::find(3)), |