feat: add _formatted placeholders for currency and weight display#147
Draft
Ibochkarev wants to merge 1 commit intobetafrom
Draft
feat: add _formatted placeholders for currency and weight display#147Ibochkarev wants to merge 1 commit intobetafrom
Ibochkarev wants to merge 1 commit intobetafrom
Conversation
System settings become the single source of truth for currency symbol,
currency position, and weight unit. Snippets now pre-format values via
Format::price($value, true) and Format::weightWithUnit() and pass them
to chunks as *_formatted fields, eliminating lexicon calls for display.
- Format.php: add weightWithUnit(), getWeightUnit(), getCurrencySymbol(),
extend getSettings() with weight_unit
- settings.php + lexicons (ru/en): add ms3_weight_unit system setting
- Snippets (ms3_cart, ms3_order_total, ms3_order, ms3_get_order): add
price_formatted, cost_formatted, weight_formatted, cart_cost_formatted,
delivery_cost_formatted, total_cost_formatted alongside raw numeric fields
- ms3_order.php: expose currency_symbol for JS-updated cost spans
- OrdersPageService: add _formatted fields to order list and detail data,
fix raw numeric values before formatting in getOrderProducts()
- Notification.php: add _formatted fields to products and total array
- Chunks: replace {'ms3_frontend_currency'|lexicon} and
{'ms3_frontend_weight_unit'|lexicon} with *_formatted placeholders
Lexicon keys ms3_frontend_currency and ms3_frontend_weight_unit are
retained for backward compatibility but no longer used by core chunks.
Member
Author
|
@biz87 проверь плиз туда ли я пошел или нужно было сделать иначе |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Описание
Системные настройки становятся единственным источником истины для символа
валюты и единиц веса. Сниппеты теперь предварительно форматируют значения
через
Format::price($value, true)иFormat::weightWithUnit()и передаютрезультат в чанки через новые
*_formattedплейсхолдеры. Чанки используютготовые строки без лексиконных вызовов для валюты и веса.
Ранее символ валюты и единица веса отображались в чанках через лексиконы
(
{'ms3_frontend_currency'|lexicon},{'ms3_frontend_weight_unit'|lexicon}),хотя системные настройки (
ms3_currency_symbol,ms3_currency_position) ужеуправляли форматированием в PHP. Изменение символа валюты в системной
настройке не затрагивало вывод в чанках.
Тип изменений
Связанные Issues
Closes #144
Как это было протестировано?
Конфигурация тестирования:
Чеклист
Дополнительные заметки
Обратная совместимость:
price,cost,weight) не удалены — JS-логика не затронутаms3_frontend_currencyиms3_frontend_weight_unitсохранены,но не используются core-чанками
обновлённых чанков, заменив лексиконные вызовы на
*_formattedплейсхолдерыОсобые места кода:
ms3_order.tpl— JS динамически обновляет span'ы#ms3_order_costи др., поэтомулексикон заменён на
{$order.currency_symbol}(передаётся из сниппета), а не на_formattedплейсхолдерms3_get_order.php— сохраняются raw-числа до форматирования, чтобы_formattedполя получали корректный числовой вход