Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. protected $_coreRegistryl;
  2. protected $_checkoutSession;
  3. protected $_remote;
  4. protected $orderFactory;
  5. protected $_objectManager;
  6.  
  7. public function __construct(
  8. MagentoBackendBlockTemplateContext $context,
  9. MagentoFrameworkRegistry $registry,
  10. MagentoCheckoutModelSession $checkoutSession,
  11. MagentoFrameworkDataFormFactory $formFactory,
  12. MagentoSalesModelOrder $order,
  13. MagentoFrameworkObjectManagerInterface $om,
  14. MagentoSalesModelOrderFactory $orderFactory,
  15. MagentoFrameworkHTTPPhpEnvironmentRemoteAddress $remote
  16. ) {
  17. $this->_coreRegistry = $registry;
  18. $this->_checkoutSession = $checkoutSession;
  19. $this->_order = $order;
  20. $this->_objectManager = $om;
  21. $this->_remote = $remote;
  22. $this->orderFactory = $orderFactory;
  23. parent::__construct($context, $registry, $formFactory);
  24. }
  25.  
  26. public function getOrder()
  27. {
  28. $orderId = $this->_checkoutSession->getLastOrderId();
  29. return $this->orderFactory->create()->load($orderId);
  30. }
  31.  
  32. protected function _prepareForm()
  33. {
  34. $model = $this->getModel();
  35. $order = $this->getOrder();
  36. if($order->getId() && $this->_checkoutSession->getData('session_check') == '1') {
  37. /** @var MagentoFrameworkDataForm $form */
  38. $form = $this->_formFactory->create( .....
  39.  
  40. class Success extends MagentoCheckoutControllerOnepage
  41. {
  42. /**
  43. * Order success action
  44. *
  45. * @return MagentoFrameworkControllerResultInterface
  46. */
  47. public function execute()
  48. {
  49. $session = $this->getOnepage()->getCheckout();
  50. if (!$this->_objectManager->get('MagentoCheckoutModelSessionSuccessValidator')->isValid()) {
  51. return $this->resultRedirectFactory->create()->setPath('checkout/cart');
  52. }
  53. $session->clearQuote();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement