本文整理汇总了PHP中Magento\Catalog\Model\Product\Option::getCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::getCollection方法的具体用法?PHP Option::getCollection怎么用?PHP Option::getCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product\Option
的用法示例。
在下文中一共展示了Option::getCollection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareLayout
/**
* Prepare item info
*
* @return void
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
$this->_shouldRenderInfo = true;
$key = 'order_item_info';
foreach (array('name' => __('Product Name'), 'sku' => __('SKU'), 'qty' => __('Quantity')) as $itemKey => $label) {
$value = $this->_recurringPayment->getInfoValue($key, $itemKey);
if ($value) {
$this->_addInfo(array('label' => $label, 'value' => $value));
}
}
$request = $this->_recurringPayment->getInfoValue($key, 'info_buyRequest');
if (empty($request)) {
return;
}
$request = unserialize($request);
if (empty($request['options'])) {
return;
}
$options = $this->_option->getCollection()->addIdsToFilter(array_keys($request['options']))->addTitleToResult($this->_recurringPayment->getInfoValue($key, 'store_id'))->addValuesToResult();
foreach ($options as $option) {
$quoteItemOption = $this->_quoteItemOptionFactory->create()->setId($option->getId());
$group = $option->groupFactory($option->getType())->setOption($option)->setRequest(new \Magento\Framework\Object($request))->setProduct($this->_product)->setUseQuotePath(true)->setQuoteItemOption($quoteItemOption)->validateUserValue($request['options']);
$skipHtmlEscaping = false;
if ('file' == $option->getType()) {
$skipHtmlEscaping = true;
$downloadParams = array('id' => $this->_recurringPayment->getId(), 'option_id' => $option->getId(), 'key' => $request['options'][$option->getId()]['secret_key']);
$group->setCustomOptionDownloadUrl('sales/download/downloadProfileCustomOption')->setCustomOptionUrlParams($downloadParams);
}
$optionValue = $group->prepareForCart();
$this->_addInfo(array('label' => $option->getTitle(), 'value' => $group->getFormattedOptionValue($optionValue), 'skip_html_escaping' => $skipHtmlEscaping));
}
}