本文整理匯總了PHP中Magento\Catalog\Model\ResourceModel\Product\Collection::_afterLoad方法的典型用法代碼示例。如果您正苦於以下問題:PHP Collection::_afterLoad方法的具體用法?PHP Collection::_afterLoad怎麽用?PHP Collection::_afterLoad使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Catalog\Model\ResourceModel\Product\Collection
的用法示例。
在下文中一共展示了Collection::_afterLoad方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _afterLoad
/**
* Set store id for each collection item when collection was loaded
*
* @return $this
*/
public function _afterLoad()
{
parent::_afterLoad();
if ($this->getStoreId() && $this->_items) {
foreach ($this->_items as $item) {
$item->setStoreId($this->getStoreId());
}
}
return $this;
}
示例2: _afterLoad
/**
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
*
* {@inheritDoc}
*/
protected function _afterLoad()
{
// Resort items according the search response.
$orginalItems = $this->_items;
$this->_items = [];
foreach ($this->queryResponse->getIterator() as $document) {
$documentId = $document->getId();
if (isset($orginalItems[$documentId])) {
$orginalItems[$documentId]->setDocumentScore($document->getScore());
$orginalItems[$documentId]->setDocumentSource($document->getSource());
$this->_items[$documentId] = $orginalItems[$documentId];
}
}
return parent::_afterLoad();
}
示例3: _afterLoad
/**
* Action after load
*
* @return $this
*/
protected function _afterLoad()
{
parent::_afterLoad();
if ($this->_addStoreDataFlag) {
$this->_addStoreData();
}
return $this;
}