Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

## Навигация

- **Текущий месяц:** [Апрель 2026](#апрель-2026) (ниже)
- **Предыдущий месяц:** [Март 2026](#март-2026) (ниже)
- **Текущий месяц:** [Май 2026](#май-2026) (ниже)
- **Предыдущий месяц:** [Апрель 2026](#апрель-2026) (ниже)
- **Ещё раньше:** [Февраль 2026](#февраль-2026), [Январь 2026](#январь-2026) (ниже)
- **Архив по месяцам:**
- [Декабрь 2025](changelogs/2025-12.md)
Expand All @@ -15,6 +15,18 @@

---

## Май 2026

### Разработка

#### ✨ Улучшено

**Сниппеты msOrder / msGetOrder — числовые суммы для шаблонов (#242):**
- В массив `$order` сниппета **msOrder** добавлены `cost_numeric`, `cart_cost_numeric`, `delivery_cost_numeric`, `discount_cost_numeric` (float из ответа `getCost()`): для Fenom/pdoTools доступен безопасный `|number` и арифметика; поля `cost`, `cart_cost`, `delivery_cost`, `discount_cost` по-прежнему отформатированные строки для совместимости с чанками.
- В **msGetOrder** в плейсхолдер `total` добавлены `cost_numeric`, `cart_cost_numeric`, `delivery_cost_numeric` (значения из модели заказа).

---

## Апрель 2026

### [2026-04-27] 🚀 Версия 1.10.1-beta1
Expand Down
5 changes: 5 additions & 0 deletions core/components/minishop3/elements/snippets/ms3_get_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,18 @@
'payment' => ($payment = $msOrder->getOne('Payment'))
? $payment->toArray()
: [],
// Блок total: cost, cart_cost и delivery_cost — отформатированные строки для шаблона;
// поля с суффиксом _numeric — те же суммы числом, из записи заказа в БД.
'total' => [
'cost' => $ms3->format->price($msOrder->get('cost')),
'cost_formatted' => $ms3->format->price($msOrder->get('cost'), true),
'cost_numeric' => (float)$msOrder->get('cost'),
'cart_cost' => $ms3->format->price($msOrder->get('cart_cost')),
'cart_cost_formatted' => $ms3->format->price($msOrder->get('cart_cost'), true),
'cart_cost_numeric' => (float)$msOrder->get('cart_cost'),
'delivery_cost' => $ms3->format->price($msOrder->get('delivery_cost')),
'delivery_cost_formatted' => $ms3->format->price($msOrder->get('delivery_cost'), true),
'delivery_cost_numeric' => (float)$msOrder->get('delivery_cost'),
'weight' => $ms3->format->weight($msOrder->get('weight')),
'weight_formatted' => $ms3->format->weightWithUnit($msOrder->get('weight')),
'cart_weight' => $ms3->format->weight($msOrder->get('weight')),
Expand Down
8 changes: 7 additions & 1 deletion core/components/minishop3/elements/snippets/ms3_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@
$response = $ms3->order->getCost();
if ($response['success']) {
$cost = $response['data'];
// Суммы в cost, cart_cost, delivery_cost и discount_cost — это строки с локальным форматом
// (разделители тысяч, десятичный разделитель), как в стандартных чанках. Те же величины
// как числа — в полях с суффиксом _numeric (удобно для |number в Fenom и арифметики).
$order['cost'] = $ms3->format->price($cost['cost']);
$order['cart_cost'] = $ms3->format->price($cost['cart_cost']);
$order['delivery_cost'] = $ms3->format->price($cost['delivery_cost']);
$order['discount_cost'] = $ms3->format->price($cost['total_discount']);
// Pre-formatted fields with currency symbol for display in chunks
$order['cost_numeric'] = (float)($cost['cost'] ?? 0);
$order['cart_cost_numeric'] = (float)($cost['cart_cost'] ?? 0);
$order['delivery_cost_numeric'] = (float)($cost['delivery_cost'] ?? 0);
$order['discount_cost_numeric'] = (float)($cost['total_discount'] ?? 0);
$order['cost_formatted'] = $ms3->format->price($cost['cost'], true);
$order['cart_cost_formatted'] = $ms3->format->price($cost['cart_cost'], true);
$order['delivery_cost_formatted'] = $ms3->format->price($cost['delivery_cost'], true);
Expand Down