![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/extmag/shiplab/Block/Rma/ |
<?php /** * Copyright © Extmag. All rights reserved. */ namespace Extmag\Shiplab\Block\Rma; use Magento\Framework\Phrase; use Magento\Framework\View\Element\Template; use Magento\Framework\View\Element\Template\Context; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Model\Order; /** * Customer address edit block * * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 */ class Edit extends Template { /** * @var OrderRepositoryInterface */ protected $orderRepository; /** * @var Order */ protected $order; /** * @param Context $context * @param OrderRepositoryInterface $orderRepository * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( Context $context, OrderRepositoryInterface $orderRepository, array $data = [] ) { parent::__construct( $context, $data ); $this->orderRepository = $orderRepository; } /** * Prepare the layout of the address edit block. * * @return $this */ protected function _prepareLayout() { parent::_prepareLayout(); $this->order = $this->orderRepository->get($this->getRequest()->getParam('order_id')); $this->pageConfig->getTitle()->set($this->getTitle()); return $this; } public function getAccessibleProducts() { $products = []; foreach ($this->order->getAllVisibleItems() as $item) { $products[] = [ 'id' => $item->getId(), 'name' => $item->getName(), 'sku' => $item->getSku(), 'qty' => ( ($item->getQtyShipped() > 0 ? $item->getQtyShipped() : $item->getQtyOrdered()) - $item->getQtyRefunded() ), ]; } return $products; } /** * Return the title, either editing an existing address, or adding a new one. * * @return Phrase */ public function getTitle() { return __('Add New RMA'); } /** * Return the Url to go back. * * @return string */ public function getBackUrl() { return $this->getUrl('sales/order/view', ['order_id' => $this->order->getId()]); } /** * Return the Url for saving. * * @return string */ public function getSaveUrl() { return $this->_urlBuilder->getUrl( 'extmag_shiplab/rma/save', ['_secure' => true, 'order_id' => $this->order->getId()] ); } }