Skip to content

Commit

Permalink
Merge pull request #1604 from rbayet/fix_1581_1591_better_show_all_su…
Browse files Browse the repository at this point in the history
…pport

Fixes #1591 #1581 Explicit collection page size
  • Loading branch information
romainruaud authored Nov 4, 2019
2 parents dd48213 + 78c5bd0 commit 08ac95b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ private function initLayer()

$this->applyFilters();

$this->layerResolver->get()->getProductCollection()->setPageSize(0);

return $this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,21 @@ public function resetOrder()
return $this;
}

/**
* {@inheritDoc}
*/
public function setPageSize($size)
{
/*
* Explicitely setting the page size to false or null is to be treated as having not set any page size.
* That is: no pagination, all items are expected.
*/
$size = ($size === null) ? false : $size;
$this->_pageSize = $size;

return $this;
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -532,7 +547,7 @@ private function prepareRequest()
$searchRequestName = $this->searchRequestName;

// Pagination params.
$size = $this->_pageSize ? $this->_pageSize : $this->getSize();
$size = ($this->_pageSize !== false) ? $this->_pageSize : $this->getSize();
$from = $size * (max(1, $this->_curPage) - 1);

// Setup sort orders.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private function getAttributes($category)
/** @var \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection $fulltextCollection */
$fulltextCollection = $this->fulltextCollectionFactory->create();
$fulltextCollection->setStoreId($storeId)
->setPageSize(1)
->setPageSize(0)
->addFieldToFilter('category_ids', $this->getCategoryFilterParam($category));

$attributeSetIds = array_keys($fulltextCollection->getFacetedData('attribute_set_id'));
Expand Down

0 comments on commit 08ac95b

Please sign in to comment.