1
0
Fork 0
mirror of synced 2025-04-03 22:03:34 +03:00
Edit output text
This commit is contained in:
Ivan Chaplygin 2024-04-10 15:17:25 +03:00
parent caa05a4188
commit 8ac713a43c
5 changed files with 33 additions and 28 deletions

View file

@ -508,8 +508,8 @@ msgstr "Активировать участие в программе лояль
msgid "Send"
msgstr "Отправить"
msgid "To register in the Loyalty Program, fill in the form:"
msgstr "Для регистрации в Программе лояльности заполните форму:"
msgid "To register in the loyalty program, fill in the form:"
msgstr "Для регистрации в программе лояльности заполните форму:"
msgid " I agree with "
msgstr " Я согласен с "
@ -523,8 +523,8 @@ msgstr "условиями обработки персональных данн
msgid "Phone"
msgstr "Телефон"
msgid "Error while registering in the loyalty program. Try again later."
msgstr "Ошибка при регистрации в программе лояльности. Попробуйте позже."
msgid "Error while registering in the loyalty program. Try again later"
msgstr "Ошибка при регистрации в программе лояльности. Попробуйте позже"
msgid "The card is not linked"
msgstr "Карта не привязана"
@ -535,8 +535,8 @@ msgstr "Обычные товары"
msgid "Promotional products"
msgstr "Акционные товары"
msgid "bonus for every"
msgstr "бонус за каждые"
msgid "accrual of 1 bonus for each"
msgstr "начисление 1 бонуса за каждые"
msgid "of the purchase amount"
msgstr "от суммы покупки"
@ -547,8 +547,11 @@ msgstr "начисление бонусов в размере"
msgid "discount"
msgstr "скидка"
msgid "Error while retrieving data. Try again later."
msgstr "Ошибка при получении данных. Попробуйте позже."
msgid "Error while retrieving data. Try again later"
msgstr "Ошибка при получении данных. Попробуйте позже"
msgid "Error when activating the loyalty program. Try again later."
msgstr "Ошибка при активации программы лояльности. Попробуйте позже."
msgid "Error when activating the loyalty program. Try again later"
msgstr "Ошибка при активации программы лояльности. Попробуйте позже"
msgid "Enter the correct phone number"
msgstr "Введите корректный номер телефона"

View file

@ -20,7 +20,7 @@ jQuery(function() {
let phone = jQuery('#phoneLoyalty');
if (!phone.val().match(/(?:\+|\d)[\d\-\(\) ]{7,}\d/)) {
phone.parent().append('<span style="color: red" id="warningLoyaltyPhone">test</span>')
phone.parent().append('<span style="color: red" id="warningLoyaltyPhone">' + messagePhone + '</span>')
event.preventDefault();
return false;

View file

@ -640,18 +640,18 @@ if (!class_exists('WC_Retailcrm_Base')) {
if (empty($site)) {
writeBaseLogs('Error with CRM credentials: need an valid apiKey assigned to one certain site');
echo json_encode(['error' => __('Error while registering in the loyalty program. Try again later.', 'retailcrm')]);
echo json_encode(['error' => __('Error while registering in the loyalty program. Try again later', 'retailcrm')]);
}
if (!$userId || !$phone) {
writeBaseLogs('Errors when registering a loyalty program. Passed parameters: userId = ' . ($userId ?? 'NULL') . ' phone = ' . ($phone ?? 'NULL'));
echo json_encode(['error' => __('Error while registering in the loyalty program. Try again later.', 'retailcrm')]);
echo json_encode(['error' => __('Error while registering in the loyalty program. Try again later', 'retailcrm')]);
}
$isSuccessful = $this->loyalty->registerCustomer($userId, $phone, $site);
if (!$isSuccessful) {
echo json_encode(['error' => __('Error while registering in the loyalty program. Try again later.', 'retailcrm')]);
echo json_encode(['error' => __('Error while registering in the loyalty program. Try again later', 'retailcrm')]);
} else {
echo json_encode(['isSuccessful' => true]);
}
@ -665,13 +665,13 @@ if (!class_exists('WC_Retailcrm_Base')) {
if (!$loyaltyId) {
writeBaseLogs('Errors when activate loyalty program. loyaltyId is missing');
echo json_encode(['error' => __('Error when activating the loyalty program. Try again later.', 'retailcrm')]);
echo json_encode(['error' => __('Error when activating the loyalty program. Try again later', 'retailcrm')]);
}
$isSuccessful = $this->loyalty->activateLoyaltyCustomer($loyaltyId);
if (!$isSuccessful) {
echo json_encode(['error' => __('Error when activating the loyalty program. Try again later.', 'retailcrm')]);
echo json_encode(['error' => __('Error when activating the loyalty program. Try again later', 'retailcrm')]);
} else {
echo json_encode(['isSuccessful' => true]);
}
@ -898,16 +898,18 @@ if (!class_exists('WC_Retailcrm_Base')) {
$jsScript = 'retailcrm-loyalty-actions';
$loyaltyUrl = ['url' => get_admin_url()];
$jsScriptsPath = plugins_url() . '/woo-retailcrm/assets/js/';
$messagePhone = __('Enter the correct phone number', 'retailcrm');
wp_register_script($jsScript, $jsScriptsPath . $jsScript . '.js', false, '0.1');
wp_enqueue_script($jsScript, $jsScriptsPath . $jsScript . '.js', '', '', true);
wp_localize_script($jsScript, 'LoyaltyUrl', $loyaltyUrl);
wp_localize_script($jsScript, 'customerId', $userId);
wp_localize_script($jsScript, 'messagePhone', $messagePhone);
$result = $this->loyalty->getForm($userId);
if ([] === $result) {
echo '<p style="color: red">'. __('Error while retrieving data. Try again later.', 'retailcrm') . '</p>';
echo '<p style="color: red">'. __('Error while retrieving data. Try again later', 'retailcrm') . '</p>';
} else {
wp_localize_script($jsScript, 'loyaltyId', $result['loyaltyId'] ?? null);
echo $result['form'];

View file

@ -31,15 +31,15 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
{
$result = [];
$response = $this->apiClient->customersGet($userId);
if (!isset($response['customer']['id'])) {
return $result;
}
$filter['customerId'] = $response['customer']['id'];
try {
$response = $this->apiClient->customersGet($userId);
if (!isset($response['customer']['id'])) {
return $result;
}
$filter['customerId'] = $response['customer']['id'];
$response = $this->apiClient->getLoyaltyAccountList($filter);
} catch (Throwable $exception) {
writeBaseLogs('Exception get loyalty accounts: ' . $exception->getMessage());
@ -79,7 +79,7 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
<p><input type="text" name="phone" id="phoneLoyalty" placeholder="%s" required></p>
<p><input type="submit" value="%s"></p>
</form>',
__('To register in the Loyalty Program, fill in the form:', 'retailcrm'),
__('To register in the loyalty program, fill in the form:', 'retailcrm'),
__(' I agree with ', 'retailcrm'),
__('loyalty program terms', 'retailcrm'),
__(' I agree with ', 'retailcrm'),
@ -149,8 +149,8 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
switch ($loyaltyAccount['level']['type']) {
case 'bonus_converting':
$data[] = __('Ordinary goods', 'retailcrm') . ': 1 ' . __('bonus for every', 'retailcrm') . ' '. $loyaltyAccount['level']['privilegeSize'];
$data[] = __('Promotional products', 'retailcrm') . ': 1 ' . __('bonus for every', 'retailcrm') . ' '. $loyaltyAccount['level']['privilegeSizePromo'];
$data[] = __('Ordinary goods', 'retailcrm') . ': ' . __('accrual of 1 bonus for each', 'retailcrm') . ' '. $loyaltyAccount['level']['privilegeSize'] . ' ' . $loyaltyAccount['loyalty']['currency'];
$data[] = __('Promotional products', 'retailcrm') . ': ' . __('accrual of 1 bonus for each', 'retailcrm') . ' '. $loyaltyAccount['level']['privilegeSizePromo']. ' ' . $loyaltyAccount['loyalty']['currency'];
break;
case 'bonus_percent':
$data[] = __('Ordinary goods', 'retailcrm') . ': ' . __('bonus accrual in the amount of', 'retailcrm'). ' ' . $loyaltyAccount['level']['privilegeSize'] . '% ' . __('of the purchase amount', 'retailcrm');

Binary file not shown.