本文整理匯總了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));
}
}