Example #1
0
 protected function _beforeToHtml()
 {
     // Magento order data
     // ---------------------------------------
     $this->realMagentoOrderId = NULL;
     $magentoOrder = $this->order->getMagentoOrder();
     if (!is_null($magentoOrder)) {
         $this->realMagentoOrderId = $magentoOrder->getRealOrderId();
     }
     // ---------------------------------------
     $data = array('class' => 'primary', 'label' => $this->__('Edit'), 'onclick' => "OrderEditItemObj.openEditShippingAddressPopup({$this->order->getId()});");
     $buttonBlock = $this->createBlock('Magento\\Button')->setData($data);
     $this->setChild('edit_shipping_info', $buttonBlock);
     // ---------------------------------------
     if (!is_null($magentoOrder) && $magentoOrder->hasShipments() && !$this->order->getChildObject()->isPrime()) {
         $url = $this->getUrl('*/order/resubmitShippingInfo', array('id' => $this->order->getId()));
         $data = array('class' => 'primary', 'label' => $this->__('Resend Shipping Information'), 'onclick' => 'setLocation(\'' . $url . '\');');
         $buttonBlock = $this->createBlock('Magento\\Button')->setData($data);
         $this->setChild('resubmit_shipping_info', $buttonBlock);
     }
     // ---------------------------------------
     // Shipping data
     // ---------------------------------------
     /** @var $shippingAddress \Ess\M2ePro\Model\Amazon\Order\ShippingAddress */
     $shippingAddress = $this->order->getShippingAddress();
     $this->shippingAddress = $shippingAddress->getData();
     $this->shippingAddress['country_name'] = $shippingAddress->getCountryName();
     // ---------------------------------------
     // TODO NOT SUPPORTED FEATURES
     // Merchant Fulfillment
     // ---------------------------------------
     //        if (!$this->order->getChildObject()->isCanceled()
     //            && !$this->order->getChildObject()->isPending()
     //            && !$this->order->getChildObject()->isFulfilledByAmazon()
     //            && $this->order->getMarketplace()->getChildObject()->isMerchantFulfillmentAvailable()) {
     //            $orderId = $this->order->getId();
     //            $data = array(
     //                'class'   => '',
     //                'label'   => $this->__('Use Amazon\'s Shipping Services'),
     //                'onclick' => "OrderMerchantFulfillmentObj.getPopupAction({$orderId});",
     //                'style'   => 'margin-top: 3px; margin-left: 6px;'
     //            );
     //            $buttonBlock = $this->getLayout()->createBlock('Magento\Button')->setData($data);
     //            $this->setChild('use_amazons_shipping_services', $buttonBlock);
     //        }
     // ---------------------------------------
     $this->jsUrl->addUrls(['order/getDebugInformation' => $this->getUrl('*/order/getDebugInformation/', array('id' => $this->getRequest()->getParam('id'))), 'getEditShippingAddressForm' => $this->getUrl('*/amazon_order_shippingAddress/edit/', array('id' => $this->getRequest()->getParam('id'))), 'saveShippingAddress' => $this->getUrl('*/amazon_order_shippingAddress/save', array('id' => $this->getRequest()->getParam('id')))]);
     $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Controller\\Adminhtml\\Order\\EditItem'));
     $this->setChild('shipping_address', $this->createBlock('Amazon\\Order\\Edit\\ShippingAddress'));
     $this->setChild('item', $this->createBlock('Amazon\\Order\\View\\Item'));
     $this->setChild('item_edit', $this->createBlock('Order\\Item\\Edit'));
     $this->setChild('log', $this->createBlock('Order\\View\\Log\\Grid'));
     return parent::_beforeToHtml();
 }