Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected $_coreRegistryl;
- protected $_checkoutSession;
- protected $_remote;
- protected $orderFactory;
- protected $_objectManager;
- public function __construct(
- MagentoBackendBlockTemplateContext $context,
- MagentoFrameworkRegistry $registry,
- MagentoCheckoutModelSession $checkoutSession,
- MagentoFrameworkDataFormFactory $formFactory,
- MagentoSalesModelOrder $order,
- MagentoFrameworkObjectManagerInterface $om,
- MagentoSalesModelOrderFactory $orderFactory,
- MagentoFrameworkHTTPPhpEnvironmentRemoteAddress $remote
- ) {
- $this->_coreRegistry = $registry;
- $this->_checkoutSession = $checkoutSession;
- $this->_order = $order;
- $this->_objectManager = $om;
- $this->_remote = $remote;
- $this->orderFactory = $orderFactory;
- parent::__construct($context, $registry, $formFactory);
- }
- public function getOrder()
- {
- $orderId = $this->_checkoutSession->getLastOrderId();
- return $this->orderFactory->create()->load($orderId);
- }
- protected function _prepareForm()
- {
- $model = $this->getModel();
- $order = $this->getOrder();
- if($order->getId() && $this->_checkoutSession->getData('session_check') == '1') {
- /** @var MagentoFrameworkDataForm $form */
- $form = $this->_formFactory->create( .....
- class Success extends MagentoCheckoutControllerOnepage
- {
- /**
- * Order success action
- *
- * @return MagentoFrameworkControllerResultInterface
- */
- public function execute()
- {
- $session = $this->getOnepage()->getCheckout();
- if (!$this->_objectManager->get('MagentoCheckoutModelSessionSuccessValidator')->isValid()) {
- return $this->resultRedirectFactory->create()->setPath('checkout/cart');
- }
- $session->clearQuote();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement