Skip to content

Commit

Permalink
Merge pull request #1158 from magento-engcom/develop-prs
Browse files Browse the repository at this point in the history
[EngCom] Public Pull Requests
 - MAGETWO-69573: Adding logo in media folder #9797
 - MAGETWO-69555: Allow for referenceBlock to include template argument #9772
 - MAGETWO-69540: Fix for #5897: getIdentities relies on uninitialized collection #9777
 - MAGETWO-69533: [BUGFIX][6244] Fix Issue with code label display in cart checkout. #9721
 - MAGETWO-69499: Update select.js #9475
 - MAGETWO-69451: Replace Zend_Json in the configurable product block test #9753
 - MAGETWO-69373: Customer with unique attribute can't be saved #7844 #9712
 - MAGETWO-69369: Replace the direct usage of Zend_Json with a call to the Json Help class #9344
 - MAGETWO-69085: Do not hardcode product link types #9600
 - MAGETWO-69554: Patch to allow multiple filter_url_params to function #9723
  • Loading branch information
ishakhsuvarov authored Jun 1, 2017
2 parents 4f03483 + 894ed7b commit 6e15e7d
Show file tree
Hide file tree
Showing 22 changed files with 716 additions and 61 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ atlassian*
/pub/media/favicon/*
/pub/media/import/*
!/pub/media/import/.htaccess
/pub/media/logo/*
/pub/media/theme/*
/pub/media/theme_customization/*
!/pub/media/theme_customization/.htaccess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ protected function _beforeToHtml()
*/
public function getItems()
{
/**
* getIdentities() depends on _itemCollection populated, but it can be empty if the block is hidden
* @see https://github.com/magento/magento2/issues/5897
*/
if (is_null($this->_itemCollection)) {
$this->_prepareData();
}
return $this->_itemCollection;
}

Expand Down
7 changes: 7 additions & 0 deletions app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ protected function _beforeToHtml()
*/
public function getItemCollection()
{
/**
* getIdentities() depends on _itemCollection populated, but it can be empty if the block is hidden
* @see https://github.com/magento/magento2/issues/5897
*/
if (is_null($this->_itemCollection)) {
$this->_prepareData();
}
return $this->_itemCollection;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ class Helper
*/
private $dateTimeFilter;

/**
* @var \Magento\Catalog\Model\Product\LinkTypeProvider
*/
private $linkTypeProvider;

/**
* Helper constructor.
* @param \Magento\Framework\App\RequestInterface $request
Expand All @@ -83,21 +88,25 @@ class Helper
* @param ProductLinks $productLinks
* @param \Magento\Backend\Helper\Js $jsHelper
* @param \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
* @param \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
*/
public function __construct(
\Magento\Framework\App\RequestInterface $request,
\Magento\Store\Model\StoreManagerInterface $storeManager,
StockDataFilter $stockFilter,
\Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks $productLinks,
\Magento\Backend\Helper\Js $jsHelper,
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter,
\Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider = null
) {
$this->request = $request;
$this->storeManager = $storeManager;
$this->stockFilter = $stockFilter;
$this->productLinks = $productLinks;
$this->jsHelper = $jsHelper;
$this->dateFilter = $dateFilter;
$this->linkTypeProvider = $linkTypeProvider ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Catalog\Model\Product\LinkTypeProvider::class);
}

/**
Expand Down Expand Up @@ -244,11 +253,17 @@ protected function setProductLinks(\Magento\Catalog\Model\Product $product)

$product = $this->productLinks->initializeLinks($product, $links);
$productLinks = $product->getProductLinks();
$linkTypes = [
'related' => $product->getRelatedReadonly(),
'upsell' => $product->getUpsellReadonly(),
'crosssell' => $product->getCrosssellReadonly()
];
$linkTypes = [];

/** @var \Magento\Catalog\Api\Data\ProductLinkTypeInterface $linkTypeObject */
foreach ($this->linkTypeProvider->getItems() as $linkTypeObject) {
$linkTypes[$linkTypeObject->getName()] = $product->getData($linkTypeObject->getName() . '_readonly');
}

// skip linkTypes that were already processed on initializeLinks plugins
foreach ($productLinks as $productLink) {
unset($linkTypes[$productLink->getLinkType()]);
}

foreach ($linkTypes as $linkType => $readonly) {
if (isset($links[$linkType]) && !$readonly) {
Expand Down
Loading

0 comments on commit 6e15e7d

Please sign in to comment.