Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Success Class Reference
Inheritance diagram for Success:
Template AbstractBlock DataObject BlockInterface Success

Public Member Functions

 __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, array $data=[])
 
 getAdditionalInfoHtml ()
 
 getContinueUrl ()
 
- Public Member Functions inherited from Template
 __construct (Template\Context $context, array $data=[])
 
 setTemplateContext ($templateContext)
 
 getTemplate ()
 
 setTemplate ($template)
 
 getTemplateFile ($template=null)
 
 getArea ()
 
 assign ($key, $value=null)
 
 fetchView ($fileName)
 
 getBaseUrl ()
 
 getObjectData (\Magento\Framework\DataObject $object, $key)
 
 getCacheKeyInfo ()
 
- Public Member Functions inherited from AbstractBlock
 __construct (\Magento\Framework\View\Element\Context $context, array $data=[])
 
 getJsLayout ()
 
 getRequest ()
 
 getParentBlock ()
 
 setLayout (\Magento\Framework\View\LayoutInterface $layout)
 
 getLayout ()
 
 setNameInLayout ($name)
 
 getChildNames ()
 
 setAttribute ($name, $value=null)
 
 setChild ($alias, $block)
 
 addChild ($alias, $block, $data=[])
 
 unsetChild ($alias)
 
 unsetCallChild ($alias, $callback, $result, $params)
 
 unsetChildren ()
 
 getChildBlock ($alias)
 
 getChildHtml ($alias='', $useCache=true)
 
 getChildChildHtml ($alias, $childChildAlias='', $useCache=true)
 
 getBlockHtml ($name)
 
 insert ($element, $siblingName=0, $after=true, $alias='')
 
 append ($element, $alias='')
 
 getGroupChildNames ($groupName)
 
 getChildData ($alias, $key='')
 
 getUiId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getJsId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getUrl ($route='', $params=[])
 
 getViewFileUrl ($fileId, array $params=[])
 
 formatDate ( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false, $timezone=null)
 
 formatTime ( $time=null, $format=\IntlDateFormatter::SHORT, $showDate=false)
 
 getModuleName ()
 
 escapeHtml ($data, $allowedTags=null)
 
 escapeJs ($string)
 
 escapeHtmlAttr ($string, $escapeSingleQuote=true)
 
 escapeCss ($string)
 
 stripTags ($data, $allowableTags=null, $allowHtmlEntities=false)
 
 escapeUrl ($string)
 
 escapeXssInUrl ($data)
 
 escapeQuote ($data, $addSlashes=false)
 
 escapeJsQuote ($data, $quote='\'')
 
 getNameInLayout ()
 
 getCacheKeyInfo ()
 
 getCacheKey ()
 
 getVar ($name, $module=null)
 
 isScopePrivate ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from BlockInterface
 toHtml ()
 

Protected Member Functions

 _beforeToHtml ()
 
 prepareBlockData ()
 
 isVisible (Order $order)
 
 canViewOrder (Order $order)
 
- Protected Member Functions inherited from Template
 _construct ()
 
 _toHtml ()
 
 getRootDirectory ()
 
 getMediaDirectory ()
 
- Protected Member Functions inherited from AbstractBlock
 _construct ()
 
 _prepareLayout ()
 
 _beforeToHtml ()
 
 _afterToHtml ($html)
 
 _toHtml ()
 
 _getNotFoundUrl ($route='', $params=['_direct'=> 'core/index/notFound'])
 
 getCacheTags ()
 
 getCacheLifetime ()
 
 _loadCache ()
 
 _saveCache ($data)
 
 _getSidPlaceholder ($cacheKey=null)
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_checkoutSession
 
 $_orderConfig
 
 $httpContext
 
- Protected Attributes inherited from Template
 $_viewVars = []
 
 $_baseUrl
 
 $_jsUrl
 
 $_allowSymlinks
 
 $_filesystem
 
 $_template
 
 $templateEnginePool
 
 $_storeManager
 
 $_appState
 
 $directory
 
 $templateContext
 
 $pageConfig
 
 $resolver
 
 $validator
 
- Protected Attributes inherited from AbstractBlock
 $_design
 
 $_session
 
 $_sidResolver
 
 $_nameInLayout
 
 $_layout
 
 $jsLayout = []
 
 $_request
 
 $_urlBuilder
 
 $_eventManager
 
 $_frontController
 
 $_assetRepo
 
 $_viewConfig
 
 $_cacheState
 
 $_logger
 
 $_escaper
 
 $filterManager
 
 $_localeDate
 
 $inlineTranslation
 
 $_isScopePrivate = false
 
 $_scopeConfig
 
 $_cache
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractBlock
static extractModuleName ($className)
 
- Data Fields inherited from Template
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink'
 
- Data Fields inherited from AbstractBlock
const CACHE_GROUP = \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER
 
const CACHE_KEY_PREFIX = 'BLOCK_'
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

One page checkout success page

@api

Since
100.0.2

Definition at line 17 of file Success.php.

Constructor & Destructor Documentation

◆ __construct()

__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,
array  $data = [] 
)
Parameters
\Magento\Framework\View\Element\Template\Context$context
\Magento\Checkout\Model\Session$checkoutSession
\Magento\Sales\Model\Order\Config$orderConfig
\Magento\Framework\App\Http\Context$httpContext
array$data

Definition at line 41 of file Success.php.

47  {
48  parent::__construct($context, $data);
49  $this->_checkoutSession = $checkoutSession;
50  $this->_orderConfig = $orderConfig;
51  $this->_isScopePrivate = true;
52  $this->httpContext = $httpContext;
53  }

Member Function Documentation

◆ _beforeToHtml()

_beforeToHtml ( )
protected

Initialize data and prepare it for output

Returns
string

Definition at line 70 of file Success.php.

71  {
72  $this->prepareBlockData();
73  return parent::_beforeToHtml();
74  }

◆ canViewOrder()

canViewOrder ( Order  $order)
protected

Can view order

Parameters
Order$order
Returns
bool

Definition at line 123 of file Success.php.

124  {
125  return $this->httpContext->getValue(Context::CONTEXT_AUTH)
126  && $this->isVisible($order);
127  }
$order
Definition: order.php:55

◆ getAdditionalInfoHtml()

getAdditionalInfoHtml ( )

Render additional order information lines and return result html

Returns
string

Definition at line 60 of file Success.php.

61  {
62  return $this->_layout->renderElement('order.success.additional.info');
63  }

◆ getContinueUrl()

getContinueUrl ( )
Returns
string
Since
100.2.0

Definition at line 133 of file Success.php.

134  {
135  return $this->_storeManager->getStore()->getBaseUrl();
136  }

◆ isVisible()

isVisible ( Order  $order)
protected

Is order visible

Parameters
Order$order
Returns
bool

Definition at line 109 of file Success.php.

110  {
111  return !in_array(
112  $order->getStatus(),
113  $this->_orderConfig->getInvisibleOnFrontStatuses()
114  );
115  }
$order
Definition: order.php:55

◆ prepareBlockData()

prepareBlockData ( )
protected

Prepares block data

Returns
void

Definition at line 81 of file Success.php.

82  {
83  $order = $this->_checkoutSession->getLastRealOrder();
84 
85  $this->addData(
86  [
87  'is_order_visible' => $this->isVisible($order),
88  'view_order_url' => $this->getUrl(
89  'sales/order/view/',
90  ['order_id' => $order->getEntityId()]
91  ),
92  'print_url' => $this->getUrl(
93  'sales/order/print',
94  ['order_id' => $order->getEntityId()]
95  ),
96  'can_print_order' => $this->isVisible($order),
97  'can_view_order' => $this->canViewOrder($order),
98  'order_id' => $order->getIncrementId()
99  ]
100  );
101  }
$order
Definition: order.php:55

Field Documentation

◆ $_checkoutSession

$_checkoutSession
protected

Definition at line 22 of file Success.php.

◆ $_orderConfig

$_orderConfig
protected

Definition at line 27 of file Success.php.

◆ $httpContext

$httpContext
protected

Definition at line 32 of file Success.php.


The documentation for this class was generated from the following file: