Skip to content

Commit 150c2a9

Browse files
[Fix bug] Displaying sub-products issue.
1 parent d5b4b1f commit 150c2a9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Block/CategoryId.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public function getProductIdsByCategory()
119119
$productIds = [];
120120
$catIds = $this->getSliderCategoryIds();
121121
$collection = $this->_productCollectionFactory->create();
122+
122123
if (is_array($catIds)) {
123124
$collection->addAttributeToSelect('*')->addCategoriesFilter(array('in' => $catIds));
124125
} else {
@@ -135,11 +136,11 @@ public function getProductIdsByCategory()
135136
$productIdsRandom = [];
136137

137138
foreach ($keys as $key => $value) {
138-
$productCollection = $this->_productCollectionFactory->create()->addIdFilter($value);
139+
$productCollection = $collection->addIdFilter($productIds[$value]);
139140
$mpProductIds = $this->getProductParentIds($productCollection);
140141

141142
if (!in_array($mpProductIds, $productIdsRandom) && !empty($mpProductIds)) {
142-
$productIdsRandom[$value] = $mpProductIds;
143+
$productIdsRandom[] = $mpProductIds[$value];
143144

144145
if ($key >= ($this->getProductsCount() - 1)) {
145146
break;

0 commit comments

Comments
 (0)