harden rag an shop scoring

This commit is contained in:
team 1
2026-04-19 11:10:33 +02:00
parent e92c1e90b5
commit 83fc13206f
3 changed files with 22 additions and 18 deletions

View File

@@ -376,7 +376,7 @@ final readonly class ShopSearchService
private function cleanUpDescription(array $description): string
{
if (isset($description['translated']['description'])) {
$newDesc = strip_tags((string) $description['translated']['description']);
$newDesc = strip_tags((string) ($description['translated']['description']));
$newDesc = html_entity_decode($newDesc);
$newDesc = preg_replace('/^[ \t]*\R/m', '', $newDesc);
$newDesc = preg_replace('/[ \t]{2,}/', ' ', $newDesc);
@@ -409,18 +409,27 @@ final readonly class ShopSearchService
return null;
}
$unitPrice = $calculatedPrice['unitPrice']
?? $calculatedPrice['totalPrice']
?? $calculatedPrice['referencePrice']
?? $calculatedPrice['listPrice']
?? $calculatedPrice['regulationPrice']
?? null;
$candidates = [
$calculatedPrice['unitPrice'] ?? null,
$calculatedPrice['totalPrice'] ?? null,
$calculatedPrice['referencePrice'] ?? null,
$calculatedPrice['listPrice'] ?? null,
$calculatedPrice['regulationPrice'] ?? null,
];
if (!is_numeric($unitPrice)) {
return null;
foreach ($candidates as $candidate) {
if (!is_numeric($candidate)) {
continue;
}
return number_format((float) $unitPrice, 2, ',', '.') . ' €';
$value = (float) $candidate;
if ($value > 0.0) {
return number_format($value, 2, ',', '.') . ' €';
}
}
return null;
}
private function extractUrl(array $row): ?string

View File

@@ -16,6 +16,7 @@ class CommerceIntentConfig
'sku',
'Artikel',
'kaufen',
'kostet',
];
}
@@ -41,6 +42,7 @@ class CommerceIntentConfig
'teuer',
'preis',
'kosten',
'kostet',
];
return implode('|', $pattern);

View File

@@ -69,14 +69,7 @@ final class ShopwareCriteriaBuilder
]
]
]
],
'sort' => [
[
'field' => 'name',
'order' => 'ASC',
'naturalSorting' => true,
],
],
]
];
if ($grouping) {