Example #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));
     }
 }
Example #2
0
 /**
  * Prepare reference info
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->_shouldRenderInfo = true;
     foreach (array('method_code', 'reference_id', 'schedule_description', 'state') as $key) {
         $this->_addInfo(array('label' => $this->_fields->getFieldLabel($key), 'value' => $this->_recurringPayment->renderData($key)));
     }
 }
Example #3
0
 /**
  * Prepare schedule info
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->_shouldRenderInfo = true;
     foreach (array('start_datetime', 'suspension_threshold') as $key) {
         $this->_addInfo(array('label' => $this->_fields->getFieldLabel($key), 'value' => $this->_recurringPayment->renderData($key)));
     }
     foreach ($this->_recurringPayment->exportScheduleInfo() as $info) {
         $this->_addInfo(array('label' => $info->getTitle(), 'value' => $info->getSchedule()));
     }
 }
Example #4
0
 /**
  * Prepare fees info
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->_shouldRenderInfo = true;
     $this->_addInfo(array('label' => $this->_fields->getFieldLabel('currency_code'), 'value' => $this->_recurringPayment->getCurrencyCode()));
     $params = array('init_amount', 'trial_billing_amount', 'billing_amount', 'tax_amount', 'shipping_amount');
     foreach ($params as $key) {
         $value = $this->_recurringPayment->getData($key);
         if ($value) {
             $this->_addInfo(array('label' => $this->_fields->getFieldLabel($key), 'value' => $this->_coreHelper->formatCurrency($value, false), 'is_amount' => true));
         }
     }
 }
Example #5
0
 /**
  * Prepare address info
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->_shouldRenderInfo = true;
     if ('shipping' == $this->getAddressType()) {
         if ('1' == $this->_recurringPayment->getInfoValue('order_item_info', 'is_virtual')) {
             $this->getParentBlock()->unsetChild('sales.recurring.payment.view.shipping');
             return;
         }
         $key = 'shipping_address_info';
     } else {
         $key = 'billing_address_info';
     }
     $this->setIsAddress(true);
     $address = $this->_addressFactory->create(array('data' => $this->_recurringPayment->getData($key)));
     $this->_addInfo(array('value' => preg_replace('/\\n{2,}/', "\n", $address->format('text'))));
 }
Example #6
0
 /**
  * Prepare payment data
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->addData(array('reference_id' => $this->_recurringPayment->getReferenceId(), 'can_cancel' => $this->_recurringPayment->canCancel(), 'cancel_url' => $this->getUrl('*/*/updateState', array('payment' => $this->_recurringPayment->getId(), 'action' => 'cancel')), 'can_suspend' => $this->_recurringPayment->canSuspend(), 'suspend_url' => $this->getUrl('*/*/updateState', array('payment' => $this->_recurringPayment->getId(), 'action' => 'suspend')), 'can_activate' => $this->_recurringPayment->canActivate(), 'activate_url' => $this->getUrl('*/*/updateState', array('payment' => $this->_recurringPayment->getId(), 'action' => 'activate')), 'can_update' => $this->_recurringPayment->canFetchUpdate(), 'update_url' => $this->getUrl('*/*/updatePayment', array('payment' => $this->_recurringPayment->getId())), 'back_url' => $this->getUrl('*/*/'), 'confirmation_message' => __('Are you sure you want to do this?')));
 }
Example #7
0
 /**
  * Prepare related grid data
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->_prepareRelatedOrders(array('increment_id', 'created_at', 'customer_firstname', 'customer_lastname', 'base_grand_total', 'status'));
     $this->_relatedOrders->addFieldToFilter('status', array('in' => $this->_config->getVisibleOnFrontStatuses()));
     $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager')->setCollection($this->_relatedOrders)->setIsOutputRequired(false);
     $this->setChild('pager', $pager);
     $this->setGridColumns(array(new \Magento\Framework\Object(array('index' => 'increment_id', 'title' => __('Order #'), 'is_nobr' => true, 'width' => 1)), new \Magento\Framework\Object(array('index' => 'created_at', 'title' => __('Date'), 'is_nobr' => true, 'width' => 1)), new \Magento\Framework\Object(array('index' => 'customer_name', 'title' => __('Customer Name'))), new \Magento\Framework\Object(array('index' => 'base_grand_total', 'title' => __('Order Total'), 'is_nobr' => true, 'width' => 1, 'is_amount' => true)), new \Magento\Framework\Object(array('index' => 'status', 'title' => __('Order Status'), 'is_nobr' => true, 'width' => 1))));
     $orders = array();
     foreach ($this->_relatedOrders as $order) {
         $orders[] = new \Magento\Framework\Object(array('increment_id' => $order->getIncrementId(), 'created_at' => $this->formatDate($order->getCreatedAt()), 'customer_name' => $order->getCustomerName(), 'base_grand_total' => $this->_coreHelper->formatCurrency($order->getBaseGrandTotal(), false), 'status' => $order->getStatusLabel(), 'increment_id_link_url' => $this->getUrl('sales/order/view/', array('order_id' => $order->getId()))));
     }
     if ($orders) {
         $this->setGridElements($orders);
     }
 }