Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Popup.php
Go to the documentation of this file.
1 <?php
8 
10 
16 {
22  protected $_registry;
23 
27  protected $dateTimeFormatter;
28 
35  public function __construct(
36  \Magento\Framework\View\Element\Template\Context $context,
37  \Magento\Framework\Registry $registry,
39  array $data = []
40  ) {
41  $this->_registry = $registry;
42  parent::__construct($context, $data);
43  $this->dateTimeFormatter = $dateTimeFormatter;
44  }
45 
51  public function getTrackingInfo()
52  {
53  /* @var $info \Magento\Shipping\Model\Info */
54  $info = $this->_registry->registry('current_shipping_info');
55 
56  return $info->getTrackingInfo();
57  }
58 
66  public function formatDeliveryDateTime($date, $time)
67  {
68  return $this->formatDeliveryDate($date) . ' ' . $this->formatDeliveryTime($time);
69  }
70 
77  public function formatDeliveryDate($date)
78  {
79  $format = $this->_localeDate->getDateFormat(\IntlDateFormatter::MEDIUM);
80  return $this->dateTimeFormatter->formatObject($this->_localeDate->date(new \DateTime($date)), $format);
81  }
82 
90  public function formatDeliveryTime($time, $date = null)
91  {
92  if (!empty($date)) {
93  $time = $date . ' ' . $time;
94  }
95 
96  $format = $this->_localeDate->getTimeFormat(\IntlDateFormatter::SHORT);
97  return $this->dateTimeFormatter->formatObject($this->_localeDate->date(new \DateTime($time)), $format);
98  }
99 
106  public function getContactUsEnabled()
107  {
108  return (bool)$this->_scopeConfig->getValue(
109  'contacts/contacts/enabled',
110  \Magento\Store\Model\ScopeInterface::SCOPE_STORE
111  );
112  }
113 
117  public function getStoreSupportEmail()
118  {
119  return $this->_scopeConfig->getValue(
120  'trans_email/ident_support/email',
121  \Magento\Store\Model\ScopeInterface::SCOPE_STORE
122  );
123  }
124 
128  public function getContactUs()
129  {
130  return $this->getUrl('contact');
131  }
132 }
formatDeliveryTime($time, $date=null)
Definition: Popup.php:90
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, DateTimeFormatterInterface $dateTimeFormatter, array $data=[])
Definition: Popup.php:35
$format
Definition: list.phtml:12
formatDeliveryDateTime($date, $time)
Definition: Popup.php:66
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52