Success.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Checkout\Block;
  7. class Success extends \Magento\Framework\View\Element\Template
  8. {
  9. /**
  10. * @var \Magento\Sales\Model\OrderFactory
  11. */
  12. protected $_orderFactory;
  13. /**
  14. * @param \Magento\Framework\View\Element\Template\Context $context
  15. * @param \Magento\Sales\Model\OrderFactory $orderFactory
  16. * @param array $data
  17. * @codeCoverageIgnore
  18. */
  19. public function __construct(
  20. \Magento\Framework\View\Element\Template\Context $context,
  21. \Magento\Sales\Model\OrderFactory $orderFactory,
  22. array $data = []
  23. ) {
  24. $this->_orderFactory = $orderFactory;
  25. parent::__construct($context, $data);
  26. }
  27. /**
  28. * @return int
  29. */
  30. public function getRealOrderId()
  31. {
  32. /** @var \Magento\Sales\Model\Order $order */
  33. $order = $this->_orderFactory->create()->load($this->getLastOrderId());
  34. return $order->getIncrementId();
  35. }
  36. }