Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIPRES-468 "Title" multilanguage functionality #997

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
dc0311f
PIPRES-468: frontend implementation by reusing prestashop multilang form
GytisZum Nov 12, 2024
460aa45
comments deleted
GytisZum Nov 12, 2024
398eb36
added todos to finish functionality
GytisZum Nov 12, 2024
e5003b1
[PIP-RES-468] closing string
MarijusCoding Nov 19, 2024
1bd4f8f
[PIPRES-468] small fixes
MarijusCoding Nov 19, 2024
6407595
[PIPRES-468] db
MarijusCoding Nov 19, 2024
067cf83
[PIPRES-468] repo
MarijusCoding Nov 19, 2024
3d695be
[PIPRES-468] object model
MarijusCoding Nov 19, 2024
dca8157
[PIPRES-468] wip
MarijusCoding Nov 19, 2024
d74d88d
[PIPRES-468] wip
MarijusCoding Nov 19, 2024
8a33974
[PIPRES-468] typo
MarijusCoding Nov 19, 2024
20c2a20
[PIPRES-468] wip
MarijusCoding Nov 20, 2024
6fa8d36
[PIPRES-468] changed type
MarijusCoding Nov 20, 2024
f83eaa9
[PIPRES-468] edit table schema and rendering title
MarijusCoding Nov 20, 2024
d6b0451
[PIPRES-468] working MVP
MarijusCoding Nov 20, 2024
690c460
[PIPRES-468] improvements
MarijusCoding Nov 20, 2024
7348037
[PIPRES-468] improvements
MarijusCoding Nov 20, 2024
87e531f
[PIPRES-468] update invertus contact address
MarijusCoding Nov 20, 2024
1a50e17
[PIPRES-468] rendering titles by language logic
MarijusCoding Nov 20, 2024
834f0a4
[PIPRES-468] typo return
MarijusCoding Nov 20, 2024
ac1d4df
[PIPRES-468] interface
MarijusCoding Nov 20, 2024
0d318a1
[PIPRES-468] added interface and dependencies
MarijusCoding Nov 20, 2024
cb4e4eb
[PIPRES-468] use interface
MarijusCoding Nov 20, 2024
90c620e
[PIPRES-468] add upgrade file
MarijusCoding Nov 20, 2024
b213c5b
[PIPRES-468] removed useless dependencies
MarijusCoding Nov 20, 2024
203204b
[PIPRES-468] removed dependency
MarijusCoding Nov 20, 2024
d44e438
[PIPRES-468] comments on interface
MarijusCoding Nov 20, 2024
937adb1
[PIPRES-468] fix
MarijusCoding Nov 20, 2024
39f8740
[PIPRES-468] optimized and gived default EN title
MarijusCoding Nov 20, 2024
978195c
[PIPRES-468] delete comments
MarijusCoding Nov 20, 2024
61bc86d
[PIPRES-468] stable
MarijusCoding Nov 20, 2024
745eecf
[PIPRES-468] stable
MarijusCoding Nov 20, 2024
63516f8
[PIPRES-468] stable
MarijusCoding Nov 20, 2024
6bcf548
[PIPRES-468] stable
MarijusCoding Nov 20, 2024
86d1bc3
[PIPRES-468] stable
MarijusCoding Nov 20, 2024
2ee9e0d
[PIPRES-468] stable
MarijusCoding Nov 20, 2024
3c7482c
[PIPRES-468] changed method to get object
MarijusCoding Nov 20, 2024
0f69450
[PIPRES-468] whitespace deletion
MarijusCoding Nov 20, 2024
912a768
[PIPRES-468] Multishop compatibility fix
MarijusCoding Nov 21, 2024
ee70cc4
[PIPRES-468] fixed comments
MarijusCoding Nov 21, 2024
1827b0a
[PIPRES-468] rename services
MarijusCoding Nov 25, 2024
976a2f2
[PIPRES-468] removed useless translation service, removed title from …
MarijusCoding Nov 25, 2024
056b7f6
[PIPRES-468] updated upgrade logic to add all titles into new table o…
MarijusCoding Nov 25, 2024
a40cb89
[PIPRES-468] bump version, fixed upgrade failing
MarijusCoding Nov 25, 2024
518fe5d
[PIPRES-468] fix
MarijusCoding Nov 25, 2024
f4145ff
[PIPRES-468] renamed services
MarijusCoding Nov 25, 2024
4ed282c
[PIPRES-468] renamed service to provider
MarijusCoding Nov 26, 2024
5367ae4
[PIPRES-468] deleted service
MarijusCoding Nov 26, 2024
7f85c3a
[PIPRES-468] renamed provider
MarijusCoding Nov 26, 2024
b70ecee
[PIPRES-468] removed table
MarijusCoding Nov 26, 2024
f113d60
[PIPRES-468] removed title from old database
MarijusCoding Nov 26, 2024
a097824
[PIPRES-468] rename lang to translation
MarijusCoding Nov 26, 2024
01fc707
[PIPRES-468] optimized querys
MarijusCoding Nov 26, 2024
cb0b08b
[PIPRES-468] removed overengineered functions
MarijusCoding Nov 26, 2024
eb670fe
[PIPRES-468] removed provider
MarijusCoding Nov 26, 2024
ccb1d49
[PIPRES-468] removed privder
MarijusCoding Nov 26, 2024
1488849
[PIPRES-468] remove dependency
MarijusCoding Nov 26, 2024
c630fd8
[PIPRES-468] whitespace
MarijusCoding Nov 26, 2024
d57a9c7
[PIPRES-468] removed useless altering
MarijusCoding Nov 26, 2024
4cb2f2b
[PIPRES-468] added return type
MarijusCoding Nov 26, 2024
81e1b6d
[PIPRES-468] add autoindex
MarijusCoding Nov 26, 2024
7e6a927
[PIPRES-468] validation
MarijusCoding Nov 26, 2024
a1345fc
[PIPRES-468] added ps version checking
MarijusCoding Nov 26, 2024
e067c74
[PIPRES-468] fix typos
MarijusCoding Nov 26, 2024
c5cbb62
[PIPRES-468] fix name
MarijusCoding Nov 27, 2024
e9f923e
[PIPRES-468] shopContext -> context
MarijusCoding Nov 27, 2024
19cdf48
[PIPRES-468] fix
MarijusCoding Dec 2, 2024
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
Prev Previous commit
Next Next commit
[PIPRES-468] rendering titles by language logic
  • Loading branch information
MarijusCoding committed Nov 20, 2024
commit 1a50e17dca6d33ab54dad36099804a3cae6da9f6
3 changes: 1 addition & 2 deletions src/Repository/MultiLangRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ public function getExistingRecordId(string $idPaymentMethod, int $langId, int $i
public function getAllTranslationsByMethod(string $idPaymentMethod, int $langId, int $idShop): ?array
{
$sql = new \DbQuery();
$sql->select('`text`');
$sql->select('`id_lang`, `text`');
$sql->from('mol_payment_method_lang');
$sql->where('`id_method` = "' . pSQL($idPaymentMethod) . '"');
$sql->where('`id_lang` = ' . $langId);
$sql->where('`id_shop` = ' . $idShop);

return \Db::getInstance()->executeS($sql) ?: null;
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private function getMethodsObjForConfig($apiMethods)
}

$methods[$apiMethod['id']] = $apiMethod;
$paymentMethod->title = $this->multiLangService->trans($apiMethod['id']);
$paymentMethod->title = $this->multiLangService->getTransList($apiMethod['id'], $paymentMethod->title);
$methods[$apiMethod['id']]['obj'] = $paymentMethod;

continue;
Expand Down
9 changes: 8 additions & 1 deletion src/Service/PaymentMethodLangService.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public function trans(string $idMethod): string
*/
public function getTransList(string $idMethod): array
{
return $this->multiLangRepository->getAllTranslationsByMethod();
$result = $this->multiLangRepository->getAllTranslationsByMethod($idMethod, $this->context->getLanguageId(), $this->context->getShopId());

$mappedArray = [];
foreach ($result as $value) {
$mappedArray[$value['id_lang']] = $value['text'];
}

return $mappedArray;
}
}
2 changes: 1 addition & 1 deletion views/templates/admin/_configure/helpers/form/form.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
<div class="col-lg-4">
{/if}
<input type="text" name="MOLLIE_METHOD_TITLE_{$paymentMethod.id|escape:'html':'UTF-8'}[{$language.id_lang}]" value="{$methodObj->title|default:''|escape:'html':'UTF-8'}">
<input type="text" name="MOLLIE_METHOD_TITLE_{$paymentMethod.id|escape:'html':'UTF-8'}[{$language.id_lang}]" value="{$methodObj->title[$language.id_lang]|default:''|escape:'html':'UTF-8'}">
{if $languages|count > 1}
</div>
<div class="col-lg-2">
Expand Down