harden rag an shop scoring
This commit is contained in:
@@ -376,7 +376,7 @@ final readonly class ShopSearchService
|
|||||||
private function cleanUpDescription(array $description): string
|
private function cleanUpDescription(array $description): string
|
||||||
{
|
{
|
||||||
if (isset($description['translated']['description'])) {
|
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 = html_entity_decode($newDesc);
|
||||||
$newDesc = preg_replace('/^[ \t]*\R/m', '', $newDesc);
|
$newDesc = preg_replace('/^[ \t]*\R/m', '', $newDesc);
|
||||||
$newDesc = preg_replace('/[ \t]{2,}/', ' ', $newDesc);
|
$newDesc = preg_replace('/[ \t]{2,}/', ' ', $newDesc);
|
||||||
@@ -409,18 +409,27 @@ final readonly class ShopSearchService
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$unitPrice = $calculatedPrice['unitPrice']
|
$candidates = [
|
||||||
?? $calculatedPrice['totalPrice']
|
$calculatedPrice['unitPrice'] ?? null,
|
||||||
?? $calculatedPrice['referencePrice']
|
$calculatedPrice['totalPrice'] ?? null,
|
||||||
?? $calculatedPrice['listPrice']
|
$calculatedPrice['referencePrice'] ?? null,
|
||||||
?? $calculatedPrice['regulationPrice']
|
$calculatedPrice['listPrice'] ?? null,
|
||||||
?? null;
|
$calculatedPrice['regulationPrice'] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
if (!is_numeric($unitPrice)) {
|
foreach ($candidates as $candidate) {
|
||||||
return null;
|
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
|
private function extractUrl(array $row): ?string
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class CommerceIntentConfig
|
|||||||
'sku',
|
'sku',
|
||||||
'Artikel',
|
'Artikel',
|
||||||
'kaufen',
|
'kaufen',
|
||||||
|
'kostet',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ class CommerceIntentConfig
|
|||||||
'teuer',
|
'teuer',
|
||||||
'preis',
|
'preis',
|
||||||
'kosten',
|
'kosten',
|
||||||
|
'kostet',
|
||||||
];
|
];
|
||||||
|
|
||||||
return implode('|', $pattern);
|
return implode('|', $pattern);
|
||||||
|
|||||||
@@ -69,14 +69,7 @@ final class ShopwareCriteriaBuilder
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
]
|
||||||
'sort' => [
|
|
||||||
[
|
|
||||||
'field' => 'name',
|
|
||||||
'order' => 'ASC',
|
|
||||||
'naturalSorting' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($grouping) {
|
if ($grouping) {
|
||||||
|
|||||||
Reference in New Issue
Block a user