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

Public Member Functions

 __construct (\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Http\Context $httpContext, \Magento\Payment\Helper\Data $paymentHelper, array $data=[])
 
 getPaymentInfoHtml ()
 
 getOrder ()
 
 getBackUrl ()
 
 getBackTitle ()
 
 getInvoiceUrl ($order)
 
 getViewUrl ($order)
 
 getCreditmemoUrl ($order)
 
 getPrintShipmentUrl ($shipment)
 
 getPrintAllShipmentsUrl ($order)
 
- 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

 _prepareLayout ()
 
- 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

 $_template = 'Magento_Shipping::order/shipment.phtml'
 
 $_coreRegistry = null
 
 $httpContext
 
 $_paymentHelper
 
- 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

Sales order view block

@api

Since
100.0.2

Definition at line 16 of file Shipment.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\View\Element\Template\Context  $context,
\Magento\Framework\Registry  $registry,
\Magento\Framework\App\Http\Context  $httpContext,
\Magento\Payment\Helper\Data  $paymentHelper,
array  $data = [] 
)
Parameters
\Magento\Framework\View\Element\Template\Context$context
\Magento\Framework\Registry$registry
\Magento\Framework\App\Http\Context$httpContext
\Magento\Payment\Helper\Data$paymentHelper
array$data

Definition at line 47 of file Shipment.php.

53  {
54  $this->_paymentHelper = $paymentHelper;
55  $this->_coreRegistry = $registry;
56  $this->httpContext = $httpContext;
57  parent::__construct($context, $data);
58  $this->_isScopePrivate = true;
59  }

Member Function Documentation

◆ _prepareLayout()

_prepareLayout ( )
protected
Returns
void

Definition at line 64 of file Shipment.php.

65  {
66  $this->pageConfig->getTitle()->set(__('Order # %1', $this->getOrder()->getRealOrderId()));
67  $infoBlock = $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout());
68  $this->setChild('payment_info', $infoBlock);
69  }
__()
Definition: __.php:13

◆ getBackTitle()

getBackTitle ( )

Return back title for logged in and guest users

Returns
\Magento\Framework\Phrase

Definition at line 107 of file Shipment.php.

108  {
109  if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
110  return __('Back to My Orders');
111  }
112  return __('View Another Order');
113  }
__()
Definition: __.php:13

◆ getBackUrl()

getBackUrl ( )

Return back url for logged in and guest users

Returns
string

Definition at line 94 of file Shipment.php.

95  {
96  if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
97  return $this->getUrl('*/*/history');
98  }
99  return $this->getUrl('*/*/form');
100  }

◆ getCreditmemoUrl()

getCreditmemoUrl (   $order)
Parameters
object$order
Returns
string

Definition at line 137 of file Shipment.php.

138  {
139  return $this->getUrl('*/*/creditmemo', ['order_id' => $order->getId()]);
140  }
$order
Definition: order.php:55

◆ getInvoiceUrl()

getInvoiceUrl (   $order)
Parameters
object$order
Returns
string

Definition at line 119 of file Shipment.php.

120  {
121  return $this->getUrl('*/*/invoice', ['order_id' => $order->getId()]);
122  }
$order
Definition: order.php:55

◆ getOrder()

getOrder ( )

Retrieve current order model instance

Returns
\Magento\Sales\Model\Order

Definition at line 84 of file Shipment.php.

85  {
86  return $this->_coreRegistry->registry('current_order');
87  }

◆ getPaymentInfoHtml()

getPaymentInfoHtml ( )
Returns
string

Definition at line 74 of file Shipment.php.

75  {
76  return $this->getChildHtml('payment_info');
77  }

◆ getPrintAllShipmentsUrl()

getPrintAllShipmentsUrl (   $order)
Parameters
object$order
Returns
string

Definition at line 155 of file Shipment.php.

156  {
157  return $this->getUrl('*/*/printShipment', ['order_id' => $order->getId()]);
158  }
$order
Definition: order.php:55

◆ getPrintShipmentUrl()

getPrintShipmentUrl (   $shipment)
Parameters
object$shipment
Returns
string

Definition at line 146 of file Shipment.php.

147  {
148  return $this->getUrl('*/*/printShipment', ['shipment_id' => $shipment->getId()]);
149  }
foreach($order->getItems() as $orderItem) $shipment

◆ getViewUrl()

getViewUrl (   $order)
Parameters
object$order
Returns
string

Definition at line 128 of file Shipment.php.

129  {
130  return $this->getUrl('*/*/view', ['order_id' => $order->getId()]);
131  }
$order
Definition: order.php:55

Field Documentation

◆ $_coreRegistry

$_coreRegistry = null
protected

Definition at line 28 of file Shipment.php.

◆ $_paymentHelper

$_paymentHelper
protected

Definition at line 38 of file Shipment.php.

◆ $_template

$_template = 'Magento_Shipping::order/shipment.phtml'
protected

Definition at line 21 of file Shipment.php.

◆ $httpContext

$httpContext
protected

Definition at line 33 of file Shipment.php.


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