Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Success.php
Go to the documentation of this file.
1 <?php
13 
15 
20 class Success extends \Magento\Checkout\Block\Onepage\Success
21 {
25  protected $currentCustomer;
26 
35  public function __construct(
36  \Magento\Framework\View\Element\Template\Context $context,
37  \Magento\Checkout\Model\Session $checkoutSession,
38  \Magento\Sales\Model\Order\Config $orderConfig,
39  \Magento\Framework\App\Http\Context $httpContext,
40  \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer,
41  array $data = []
42  ) {
43  parent::__construct(
44  $context,
45  $checkoutSession,
46  $orderConfig,
48  $data
49  );
50  $this->currentCustomer = $currentCustomer;
51  }
52 
58  private function orderHasDownloadableProducts()
59  {
60  return $this->isVisible($this->_checkoutSession->getLastRealOrder())
61  && $this->currentCustomer->getCustomerId()
62  ? $this->_checkoutSession->getHasDownloadableProducts(true)
63  : false;
64  }
65 
71  protected function prepareBlockData()
72  {
73  parent::prepareBlockData();
74 
75  $this->addData(
76  [
77  'order_has_downloadable' => $this->orderHasDownloadableProducts()
78  ]
79  );
80  }
81 
87  public function getDownloadableProductsUrl()
88  {
89  return $this->getUrl('downloadable/customer/products', ['_secure' => true]);
90  }
91 }
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Framework\App\Http\Context $httpContext, \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer, array $data=[])
Definition: Success.php:35