![]() 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/Controller/Adminhtml/ |
<?php /** * Copyright © Extmag. All rights reserved. */ namespace Extmag\Shiplab\Controller\Adminhtml; use Extmag\Shiplab\Api\PriceRulesRepositoryInterface; use Extmag\Shiplab\Model\PriceRulesFactory; use Extmag\Shiplab\Model\PriceRulesRepository; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\Backend\Model\View\Result\Page; use Magento\Framework\App\Request\DataPersistorInterface; use Extmag\Core\Helper\Registry; use Magento\Framework\View\Result\PageFactory; use Magento\SalesRule\Model\RegistryConstants; abstract class PriceRules extends Action { /** * @var PageFactory */ protected $resultPageFactory; /** * Core registry * * @var Registry */ protected $registry; /** * Core registry * * @var \Extmag\ExtendedRates\Model\PriceRules */ protected $priceRules; /** * @var DataPersistorInterface */ protected $dataPersistor; /** * @var PriceRulesRepository */ protected $priceRulesRepository; /** * Initialize Group Controller * * @param Context $context * @param PageFactory $resultPageFactory * @param Registry $registry * @param PriceRulesFactory $priceRules * @param PriceRulesRepositoryInterface $priceRulesRepository * @param DataPersistorInterface $dataPersistor */ public function __construct( Context $context, PageFactory $resultPageFactory, Registry $registry, PriceRulesFactory $priceRules, PriceRulesRepositoryInterface $priceRulesRepository, DataPersistorInterface $dataPersistor ) { parent::__construct($context); $this->resultPageFactory = $resultPageFactory; $this->registry = $registry; $this->priceRules = $priceRules; $this->dataPersistor = $dataPersistor; $this->priceRulesRepository = $priceRulesRepository; } /** * Initiate rule * * @return void */ protected function _initRule() { $this->registry->register( RegistryConstants::CURRENT_SALES_RULE, $this->priceRules->create() ); $id = (int)$this->getRequest()->getParam('id'); if (!$id && $this->getRequest()->getParam('entity_id')) { $id = (int)$this->getRequest()->getParam('entity_id'); } if ($id) { $this->registry->registry(RegistryConstants::CURRENT_SALES_RULE)->load($id); } } /** * Init page * * @return Page */ protected function initPage() { /** @var Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Extmag_Shiplab::shiplab_price_rules_index') ->addBreadcrumb(__('Shiplab Shipping Rates'), __('Shiplab Shipping Rates')) ->addBreadcrumb(__('Price Rules'), __('Price Rules')); return $resultPage; } }