Skip to content
Merged
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
24 changes: 22 additions & 2 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,26 @@ lib {
}
}

module.tx_form.settings.yamlConfigurations {
1543219101 = EXT:cart/Configuration/Yaml/FormSetup.yaml
module {
# settings of the backend module, Extbase reads them from the TypoScript setup (not from page TSconfig)
tx_cart {
settings {
format.currency {
currencySign = {$plugin.tx_cart.settings.format.currency.currencySign}
decimalSeparator = {$plugin.tx_cart.settings.format.currency.decimalSeparator}
thousandsSeparator = {$plugin.tx_cart.settings.format.currency.thousandsSeparator}
prependCurrency = {$plugin.tx_cart.settings.format.currency.prependCurrency}
separateCurrency = {$plugin.tx_cart.settings.format.currency.separateCurrency}
decimals = {$plugin.tx_cart.settings.format.currency.decimals}
}

backend {
dateFormat = {$plugin.tx_cart.settings.backend.dateFormat}
}
}
}

tx_form.settings.yamlConfigurations {
1543219101 = EXT:cart/Configuration/Yaml/FormSetup.yaml
}
}
21 changes: 0 additions & 21 deletions Configuration/page.tsconfig
Original file line number Diff line number Diff line change
@@ -1,23 +1,2 @@
# Template path for dashboard widgets
templates.typo3/cms-dashboard.1712899110 = extcode/cart:Resources/Private/

tx_cart {
persistence {
storagePid = {$module.tx_cart.persistence.storagePid}
}

settings {
format.currency {
currencySign = {$plugin.tx_cart.settings.format.currency.currencySign}
decimalSeparator = {$plugin.tx_cart.settings.format.currency.decimalSeparator}
thousandsSeparator = {$plugin.tx_cart.settings.format.currency.thousandsSeparator}
prependCurrency = {$plugin.tx_cart.settings.format.currency.prependCurrency}
separateCurrency = {$plugin.tx_cart.settings.format.currency.separateCurrency}
decimals = {$plugin.tx_cart.settings.format.currency.decimals}
}

backend {
dateFormat = {$plugin.tx_cart.settings.backend.dateFormat}
}
}
}
52 changes: 52 additions & 0 deletions Tests/Functional/Controller/Backend/Order/OrderControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,23 @@ public function listActionRendersTheResetLinkOnlyIfThereIsAnActiveSearch(): void
);
}

#[Test]
public function listActionFormatsPricesAndDatesWithTheSettingsOfTheTypoScriptOfCart(): void
{
$this->importPHPDataSet(__DIR__ . '/../../../../Fixtures/Orders.php');
$this->includeTypoScriptOfCart();

$html = self::normalizeWhitespace(
(string)self::dispatchListAction(1, ['orderNumber' => 'O-20260222-1'])->getBody()
);

// order number and date, invoice number and date, total gross and net of the order in Tests/Fixtures/Orders.php
self::assertSame(
['O-20260222-1', '2026-02-22', 'I-20260224-1', '2026-02-24', '21,52 €', '18,08 €'],
array_slice(self::getCellsOfOrderRow($html, 'O-20260222-1'), 3, 6)
);
}

#[Test]
public function listActionRendersOnlyTheOrdersOfTheMonthGivenAsOrderNumberSearchArgumentOnAllPages(): void
{
Expand Down Expand Up @@ -765,6 +782,41 @@ private function setItemsPerPage(int $itemsPerPage): void
);
}

/**
* The static TypoScript of cart on the root page of the order storage, like a shop includes it.
*/
private function includeTypoScriptOfCart(): void
{
$this->getConnectionPool()->getConnectionForTable('sys_template')->insert(
'sys_template',
[
'uid' => 1,
'pid' => self::SHOP_ROOT_PID,
'title' => 'Shop',
'root' => 1,
'clear' => 3,
'include_static_file' => 'EXT:cart/Configuration/TypoScript',
]
);
}

/**
* @return list<string> the text of the cells of the row of the order in the order list
*/
private static function getCellsOfOrderRow(string $html, string $orderNumber): array
{
$orderList = mb_strstr($html, '<table') ?: '';
preg_match('/<tr[^>]*>(?:(?!<\/tr>).)*' . preg_quote($orderNumber, '/') . '.*?<\/tr>/s', $orderList, $rowMatches);
self::assertArrayHasKey(0, $rowMatches, 'The order ' . $orderNumber . ' has not been rendered.');

preg_match_all('/<td[^>]*>(.*?)<\/td>/s', $rowMatches[0], $cellMatches);

return array_map(
static fn(string $cell): string => trim(str_replace("\u{a0}", ' ', html_entity_decode(strip_tags($cell)))),
$cellMatches[1]
);
}

private function createOrders(int $numberOfOrders): void
{
$connectionPool = $this->getConnectionPool();
Expand Down
Loading