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
28 changes: 24 additions & 4 deletions Configuration/TypoScript/setup.typoscript
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,30 @@ plugin {
@import 'EXT:cart/Configuration/TypoScript/Payments/setup.typoscript'
@import 'EXT:cart/Configuration/TypoScript/Shippings/setup.typoscript'

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
}
}

# use this lib to add custom information or content elements to your email template

temp.cartMailContentElement = RECORDS
Expand Down Expand Up @@ -178,7 +202,3 @@ lib {
source = {$plugin.tx_cart.uids.lib.cartMailFooterImpress}
}
}

module.tx_form.settings.yamlConfigurations {
1543219101 = EXT:cart/Configuration/Yaml/FormSetup.yaml
}
20 changes: 0 additions & 20 deletions Configuration/page.tsconfig

This file was deleted.

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 @@ -379,6 +379,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 @@ -704,6 +721,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 => mb_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