Skip to content

Commit

Permalink
8176: LinkManagement::getChildren() does not include product visibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmalevanec committed Dec 11, 2017
1 parent 321278b commit 8bde633
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\ConfigurableProduct\Model\Product\Type;

use Magento\Catalog\Api\Data\ProductAttributeInterface;
Expand Down Expand Up @@ -682,7 +683,7 @@ private function saveConfigurableOptions(ProductInterface $product)
->setProductId($product->getData($metadata->getLinkField()))
->save();
}
/** @var $configurableAttributesCollection \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection */
/** @var $configurableAttributesCollection \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection */
$configurableAttributesCollection = $this->_attributeCollectionFactory->create();
$configurableAttributesCollection->setProductFilter($product);
$configurableAttributesCollection->addFieldToFilter(
Expand Down Expand Up @@ -1397,7 +1398,16 @@ private function getConfiguredUsedProductCollection(\Magento\Catalog\Model\Produ
->addFilterByRequiredOptions()
->setStoreId($product->getStoreId());

$requiredAttributes = ['name', 'price', 'weight', 'image', 'thumbnail', 'status', 'media_gallery'];
$requiredAttributes = [
'name',
'price',
'weight',
'image',
'thumbnail',
'status',
'visibility',
'media_gallery'
];
foreach ($requiredAttributes as $attributeCode) {
$collection->addAttributeToSelect($attributeCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();

$this->productFactory = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterfaceFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();

$this->salableProcessor = $this->createMock(SalableProcessor::class);

$this->model = $this->objectHelper->getObject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public function testGetChildren()

$this->assertArrayHasKey('status', $product);
$this->assertEquals('1', $product['status']);

$this->assertArrayHasKey('visibility', $product);
$this->assertEquals('1', $product['visibility']);
}
}

Expand Down

0 comments on commit 8bde633

Please sign in to comment.