Skip to content

Commit

Permalink
fixup! added Persoo bundle for product search
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik committed Jan 23, 2024
1 parent ea4a9ee commit 2a5cd46
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Model/Product/Connection/ProductConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public function createConnectionForCategory(
/**
* @param array $products
* @param string $search
* @param int $offset
* @param int $limit
* @param int $countOfProducts
* @param \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterData $productFilterData
* @param string|null $orderingMode
Expand All @@ -153,16 +155,22 @@ public function createConnectionForCategory(
public function createConnectionForSearchFromArray(
array $products,
string $search,
int $offset,
int $limit,
int $countOfProducts,
ProductFilterData $productFilterData,
?string $orderingMode = null,
): ProductConnection {
$connectionBuilder = new ConnectionBuilder();
$connection = $connectionBuilder->connectionFromArray($products);

$pageInfo = $connection->getPageInfo();
$pageInfo->setHasPreviousPage($offset > 0);
$pageInfo->setHasNextPage($offset + $limit < $countOfProducts);

return new ProductConnection(
$connection->getEdges(),
$connection->getPageInfo(),
$pageInfo,
$this->getProductFilterOptionsClosure($productFilterData, $search),
$orderingMode,
$countOfProducts,
Expand Down

0 comments on commit 2a5cd46

Please sign in to comment.