Task 6991 | Правки Оформления заказа от 25.06.2025

pull/36/head
parent fcf828c11b
commit 2770ed3e9b
  1. 16
      wp-content/themes/cosmopet/global-functions/multilang-functions.php
  2. 1
      wp-content/themes/cosmopet/modules/shop/components/checkout/assets/css/checkout.css
  3. 55
      wp-content/themes/cosmopet/static/js/cdek-map.js
  4. 6
      wp-content/themes/cosmopet/templates/shop/checkout.twig

@ -1803,7 +1803,6 @@ pll_register_string('Запомнить меня', 'Запомнить меня'
add_action('wp_head', function () {
if (function_exists('pll_current_language')) {
$lang = pll_current_language();
$translations = [
'en' => [
'name_required' => 'The name is required.',
@ -1819,7 +1818,13 @@ add_action('wp_head', function () {
'shipping_method_missing' => 'No delivery method selected. Please check your address or contact the site administration for help.',
'change_address' => 'Change address',
'shipping_updated' => 'Shipping methods will be updated during checkout.',
'coupon_applied' => 'Coupon applied: '
'coupon_applied' => 'Coupon applied: ',
// 🔽 Новые строки из JS
'Choose pick-up' => 'Choose pick-up',
'Re-select pick-up' => 'Re-select pick-up',
'There are no CDEK pick-up points available in this direction, please select another delivery method' =>
'There are no CDEK pick-up points available in this direction, please select another delivery method'
],
'ru' => [
'name_required' => 'Поле имени обязательно для заполнения.',
@ -1835,11 +1840,16 @@ add_action('wp_head', function () {
'shipping_method_missing' => 'Не выбран метод доставки. Пожалуйста перепроверьте ваш адрес или обратитесь за помощью к администрации сайта.',
'change_address' => 'Изменить адрес',
'shipping_updated' => 'Методы доставки будут обновлены в процессе оформления заказа.',
'coupon_applied' => 'Применен промокод: '
'coupon_applied' => 'Применен промокод: ',
'Choose pick-up' => 'Выбрать пункт выдачи',
'Re-select pick-up' => 'Выбрать другой пункт выдачи',
'There are no CDEK pick-up points available in this direction, please select another delivery method' =>
'В этом направлении нет доступных пунктов выдачи CDEK, пожалуйста, выберите другой способ доставки'
]
];
$current_translations = $translations[$lang] ?? $translations['en'];
?>
<? // GP | Обращаемся из wp-content/themes/cosmopet/modules/forms/assets/js/form.js ?>

@ -585,6 +585,7 @@
.form-agreement__check{
display: flex;
align-items: center;
margin-top: 1rem;
}
.form-agreement__square{
width: 18px;

@ -1,3 +1,10 @@
/*
Start: cdek-map.js
Перезапись стандартного скрипта от cdek плагина для подключения дополнительной логики обработчиков
*/
(() => {
"use strict";
var e = {
@ -7,33 +14,31 @@
a: o
}),
o
}
,
},
d: (t, o) => {
for (var n in o)
e.o(o, n) && !e.o(t, n) && Object.defineProperty(t, n, {
enumerable: !0,
get: o[n]
})
}
,
},
o: (e, t) => Object.prototype.hasOwnProperty.call(e, t)
};
const t = window.jQuery;
var o = e.n(t);
const n = window.CDEKWidget;
var i = e.n(n);
const c = window.wp.i18n
, d = window.lodash
, r = o()("#billing_city")
, a = o()("#shipping_city")
, l = "aria-small";
const c = window.wp.i18n,
d = window.lodash,
r = o()("#billing_city"),
a = o()("#shipping_city"),
l = "aria-small";
const h = (e, t, n) => {
console.log("Widget object:", g);
console.log("g.close is", typeof g.close);
o()(".cdek-office-code").val(n.code);
u.find("a").html((0, c.__)("Re-select pick-up", "cdekdelivery"));
u.find("a").html(window.langData.translations["Re-select pick-up"] || "Re-select pick-up");
const i = u.parent().children(".cdek-office-info");
if (i.length === 0) {
@ -64,8 +69,7 @@
const v = (e, t = null) => {
if (console.debug("[CDEK-MAP] Removing selected office info"),
o()(".cdek-office-info").remove(),
e.find("a").html((0,
c.__)("Choose pick-up", "cdekdelivery")),
e.find("a").html(window.langData.translations["Choose pick-up"] || "Choose pick-up"),
o()(".cdek-office-code").val(""),
null !== g && g.clearSelection(),
"string" == typeof t) {
@ -74,25 +78,23 @@
e.prev().text(t),
e.remove()
}
}
, f = (0,
},
f = (0,
d.debounce)((() => {
"" !== (o()("#ship-to-different-address-checkbox").is(":checked") ? a.val() : r.val()) && (console.debug("[CDEK-MAP] City or postcode changed, initiating checkout update"),
void 0 !== window.cdek.saver && o().post(window.cdek.saver, {
code: null
}),
o()(document.body).trigger("update_checkout"))
}
), 500)
, b = new ResizeObserver((e => {
}), 500),
b = new ResizeObserver((e => {
for (const t of e)
"contentRect" in t && "target" in t && (t.contentRect.width < 160 ? p && (p = !1,
s = !0) : p || (p = !0,
s = !0),
s && (p ? t.target.hasAttribute(l) && t.target.removeAttribute(l) : t.target.hasAttribute(l) || t.target.setAttribute(l, ""),
s = !1))
}
));
}));
@ -103,8 +105,7 @@
e && (s = !1,
p = !0,
b.observe(e))
}
)).on("change", ".shipping_method", ( () => o()(document.body).trigger("update_checkout"))).on("click", ".open-pvz-btn", null, (e => {
})).on("change", ".shipping_method", (() => o()(document.body).trigger("update_checkout"))).on("click", ".open-pvz-btn", null, (e => {
u = "A" === e.target.tagName ? o()(e.target.parentElement) : o()(e.target),
v(u);
try {
@ -112,8 +113,7 @@
if (console.debug("[CDEK-MAP] Got points from backend", e),
!e.length)
return console.warn("[CDEK-MAP] Backend points are empty"),
void v(u, (0,
c.__)("There are no CDEK pick-up points available in this direction, please select another delivery method", "cdekdelivery"));
void v(u, window.langData.translations["There are no CDEK pick-up points available in this direction, please select another delivery method"] || "There are no CDEK pick-up points available in this direction, please select another delivery method");
null === g ? g = new(i())({
apiKey: window.cdek.key,
popup: !0,
@ -130,10 +130,7 @@
g.open()
} catch (e) {
console.error("[CDEK-MAP] SyntaxError during points parse"),
v(u, (0,
c.__)("There are no CDEK pick-up points available in this direction, please select another delivery method", "cdekdelivery"))
}
}
))
v(u, window.langData.translations["There are no CDEK pick-up points available in this direction, please select another delivery method"] || "There are no CDEK pick-up points available in this direction, please select another delivery method")
}
)();
}))
})();

@ -21,12 +21,12 @@
<div class="order-contacts__form">
{{ fn('do_action', 'woocommerce_checkout_billing') }}
{% if not fn('is_user_logged_in') %}
<div class="form-agreement__check">
<label for="reg" class="form-agreement__check">
<input id="reg" type="checkbox" name="reg" value="1" class="form-agreement__input">
<div class="form-agreement__square">
</div>
<label for="reg" class="form-agreement__label">{{ fn('pll_e', 'Запомнить меня') }}</label>
</div>
<span class="form-agreement__label">{{ fn('pll_e', 'Запомнить меня') }}</span>
</label>
{% endif %}
</div>

Loading…
Cancel
Save