П
Size: a a a
П
ПК
П
ПК
М
ПК
S
S
S
S
S
АЛ
<tr>
<th class="depth">
Глубина (мм)
</th>
<th class="width">
Ширина (мм)
</th>
<th class="height">
Высота (мм)
</th>
</tr>
[[!msProducts?
&parents=`[[+id]]`
&depth=`0`
&level=`0`
&limit=`0`
&tpl=`tableRow`
]]
<tr>
<td>
{$depth}
</td>
<td>
{$width}
</td>
<td>
{$height}
</td>
</tr>
ОШ
ОШ
switch ($modx->event->name) {
case 'msOnAddToCart': case 'msOnChangeInCart': // Обрабатывать только события добавления в корзину и изменения количества
$cartArray = $cart->get(); // Массив корзины
$cartStatus = $cart->status(); // Состояние корзины
$totalCount = $cartStatus['total_count']; // Общее количество товаров в корзине
if ($totalCount < 5) $coeff = 1; // Установка коэффициента в зависимости от количества
elseif ($totalCount < 10) $coeff = 0.8;
elseif ($totalCount < 20) $coeff = 0.7;
else $coeff = 0.6;
foreach ($cartArray as &$cartProduct) { // Обрабатываем все товары корзины
if ($product = $modx->getObject('msProduct', $cartProduct['id'])) { // Получаем объект товара по его ID в корзине
$cartProduct['price'] = $product->price * $coeff; // Изменение цены
}
}
$cart->set($cartArray); // Запись нового состояния корзины
break;
}
ПК
ОШ
АС
<tr>
<th class="depth">
Глубина (мм)
</th>
<th class="width">
Ширина (мм)
</th>
<th class="height">
Высота (мм)
</th>
</tr>
[[!msProducts?
&parents=`[[+id]]`
&depth=`0`
&level=`0`
&limit=`0`
&tpl=`tableRow`
]]
<tr>
<td>
{$depth}
</td>
<td>
{$width}
</td>
<td>
{$height}
</td>
</tr>
АЛ