Ejemplo n.º 1
0
 /**
  * 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));
     }
 }