fix p47
This commit is contained in:
@@ -65,6 +65,66 @@ final class ShopwareCriteriaBuilder
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a narrow, rich-text-free criteria payload for exact article-number lookups.
|
||||
* Pure product-number searches should not run through Shopware full-text search,
|
||||
* because broad numeric search can surface unrelated products and trigger JSON
|
||||
* encoding problems in rich text/custom fields.
|
||||
*/
|
||||
public function buildExactProductNumber(string $productNumber, ?int $limit = 5): array
|
||||
{
|
||||
$productNumber = trim($productNumber);
|
||||
|
||||
$criteria = [
|
||||
'page' => 1,
|
||||
'limit' => max(1, $limit),
|
||||
'total-count-mode' => 0,
|
||||
'includes' => [
|
||||
'product' => [
|
||||
'id',
|
||||
'name',
|
||||
'translated.name',
|
||||
'productNumber',
|
||||
'available',
|
||||
'calculatedPrice',
|
||||
'manufacturer',
|
||||
],
|
||||
'product_manufacturer' => [
|
||||
'name',
|
||||
],
|
||||
'calculated_price' => [
|
||||
'unitPrice',
|
||||
'totalPrice',
|
||||
'referencePrice',
|
||||
'listPrice',
|
||||
'regulationPrice',
|
||||
],
|
||||
],
|
||||
'associations' => [
|
||||
'manufacturer' => new \stdClass(),
|
||||
],
|
||||
'filter' => [
|
||||
[
|
||||
'type' => 'equals',
|
||||
'field' => 'active',
|
||||
'value' => true,
|
||||
],
|
||||
[
|
||||
'type' => 'equals',
|
||||
'field' => 'available',
|
||||
'value' => true,
|
||||
],
|
||||
[
|
||||
'type' => 'equals',
|
||||
'field' => 'productNumber',
|
||||
'value' => $productNumber,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an ultra-safe Store API payload for the final recovery attempt.
|
||||
* It keeps only identity, availability and price fields and intentionally
|
||||
|
||||
Reference in New Issue
Block a user