fix sse error handling if shop api error part 5
This commit is contained in:
@@ -60,11 +60,72 @@ final class ShopwareCriteriaBuilder
|
||||
grouping: $grouping,
|
||||
includeRichTextFields: false,
|
||||
includeMediaFields: false,
|
||||
includeSeoUrls: true,
|
||||
includeSeoUrls: false,
|
||||
includeManufacturer: false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an ultra-safe Store API payload for the final recovery attempt.
|
||||
* It keeps only identity, availability and price fields and intentionally
|
||||
* avoids grouping, associations, translated text, SEO, media and custom data.
|
||||
*/
|
||||
public function buildUltraSafe(
|
||||
CommerceSearchQuery $query,
|
||||
?int $limit = 25,
|
||||
?bool $grouping = false
|
||||
): array
|
||||
{
|
||||
$criteria = [
|
||||
'page' => 1,
|
||||
'limit' => max(1, $limit),
|
||||
'total-count-mode' => 0,
|
||||
'includes' => [
|
||||
'product' => [
|
||||
'id',
|
||||
'productNumber',
|
||||
'available',
|
||||
'calculatedPrice',
|
||||
],
|
||||
'calculated_price' => [
|
||||
'unitPrice',
|
||||
'totalPrice',
|
||||
'referencePrice',
|
||||
'listPrice',
|
||||
'regulationPrice',
|
||||
],
|
||||
],
|
||||
'associations' => [],
|
||||
];
|
||||
|
||||
if ($query->searchText !== '') {
|
||||
$criteria['search'] = $query->searchText;
|
||||
}
|
||||
|
||||
if ($query->priceMin !== null) {
|
||||
$criteria['min-price'] = $query->priceMin;
|
||||
}
|
||||
|
||||
if ($query->priceMax !== null) {
|
||||
$criteria['max-price'] = $query->priceMax;
|
||||
}
|
||||
|
||||
$criteria['filter'] = [
|
||||
[
|
||||
'type' => 'equals',
|
||||
'field' => 'active',
|
||||
'value' => true,
|
||||
],
|
||||
[
|
||||
'type' => 'equals',
|
||||
'field' => 'available',
|
||||
'value' => true,
|
||||
],
|
||||
];
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
private function buildCriteria(
|
||||
CommerceSearchQuery $query,
|
||||
?int $limit,
|
||||
|
||||
Reference in New Issue
Block a user