/** * Retrieve required options from parent * * @return void * @throws \Magento\Framework\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { throw new \Magento\Framework\Model\Exception(__('Invalid parent block for this block')); } parent::_beforeToHtml(); }
/** * Retrieve required options from parent * * @return void * @throws \Magento\Framework\Exception\LocalizedException */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { throw new \Magento\Framework\Exception\LocalizedException(__('Invalid parent block for this block')); } $this->setOrder($this->getParentBlock()->getOrder()); parent::_beforeToHtml(); }
/** * Prepare child blocks * * @return $this */ protected function _prepareLayout() { $onclick = "submitAndReloadArea(\$('creditmemo_item_container'),'" . $this->getUpdateUrl() . "')"; $this->addChild('update_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Update Qty\'s'), 'class' => 'update-button', 'onclick' => $onclick]); if ($this->getCreditmemo()->canRefund()) { if ($this->getCreditmemo()->getInvoice() && $this->getCreditmemo()->getInvoice()->getTransactionId()) { $this->addChild('submit_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Refund'), 'class' => 'save submit-button refund primary', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemo()']); } $this->addChild('submit_offline', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Refund Offline'), 'class' => 'save submit-button primary', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemoOffline()']); } else { $this->addChild('submit_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Refund Offline'), 'class' => 'save submit-button primary', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemoOffline()']); } return parent::_prepareLayout(); }
/** * Prepare child blocks * * @return $this */ protected function _beforeToHtml() { $onclick = "submitAndReloadArea(\$('invoice_item_container'),'" . $this->getUpdateUrl() . "')"; $this->addChild('update_button', 'Magento\\Backend\\Block\\Widget\\Button', ['class' => 'update-button', 'label' => __('Update Qty\'s'), 'onclick' => $onclick]); $this->_disableSubmitButton = true; $submitButtonClass = ' disabled'; foreach ($this->getInvoice()->getAllItems() as $item) { /** * @see bug #14839 */ if ($item->getQty()) { $this->_disableSubmitButton = false; $submitButtonClass = ''; break; } } if ($this->getOrder()->getForcedShipmentWithInvoice()) { $_submitLabel = __('Submit Invoice and Shipment'); } else { $_submitLabel = __('Submit Invoice'); } $this->addChild('submit_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => $_submitLabel, 'class' => 'save submit-button primary' . $submitButtonClass, 'onclick' => 'disableElements(\'submit-button\');$(\'edit_form\').submit()', 'disabled' => $this->_disableSubmitButton]); return parent::_prepareLayout(); }
/** * Prepare child blocks * * @return string */ protected function _beforeToHtml() { $this->addChild('submit_button', 'Magento\\Backend\\Block\\Widget\\Button', array('label' => __('Submit Shipment'), 'class' => 'save submit-button primary', 'onclick' => 'submitShipment(this);')); return parent::_beforeToHtml(); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry * @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration * @param \Magento\Framework\Registry $registry * @param \Magento\Catalog\Model\Product\OptionFactory $optionFactory * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration, \Magento\Framework\Registry $registry, \Magento\Catalog\Model\Product\OptionFactory $optionFactory, array $data = []) { $this->_optionFactory = $optionFactory; parent::__construct($context, $stockRegistry, $stockConfiguration, $registry, $data); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService * @param \Magento\Framework\Registry $registry * @param \Magento\GiftMessage\Helper\Message $messageHelper * @param \Magento\Checkout\Helper\Data $checkoutHelper * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService, \Magento\Framework\Registry $registry, \Magento\GiftMessage\Helper\Message $messageHelper, \Magento\Checkout\Helper\Data $checkoutHelper, array $data = array()) { $this->_checkoutHelper = $checkoutHelper; $this->_messageHelper = $messageHelper; parent::__construct($context, $stockItemService, $registry, $data); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService * @param \Magento\Framework\Registry $registry * @param \Magento\Catalog\Model\Product\OptionFactory $optionFactory * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService, \Magento\Framework\Registry $registry, \Magento\Catalog\Model\Product\OptionFactory $optionFactory, array $data = array()) { $this->_optionFactory = $optionFactory; parent::__construct($context, $stockItemService, $registry, $data); }