|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / a / home / dev2.destoffenstraat.com / app / code / Swissup / Orderattachment / Block / Email / |
Filename | /home/a/home/dev2.destoffenstraat.com/app/code/Swissup/Orderattachment/Block/Email/Attachments.php |
Size | 1.95 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 21-Aug-2025 12:26 |
Last modified | 15-Apr-2022 17:45 |
Last accessed | 22-Aug-2025 22:12 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
namespace Swissup\Orderattachment\Block\Email;
class Attachments extends \Magento\Framework\View\Element\Template
{
protected $_template = 'email/order/attachments.phtml';
/**
* @var \Swissup\Orderattachment\Helper\Attachment
*/
protected $attachmentHelper;
/**
* @var \Magento\Sales\Model\OrderRepository
*/
protected $orderRepository;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Swissup\Orderattachment\Helper\Attachment $attachmentHelper
* @param \Magento\Sales\Model\OrderRepository $orderRepository
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Swissup\Orderattachment\Helper\Attachment $attachmentHelper,
\Magento\Sales\Model\OrderRepository $orderRepository,
array $data = []
) {
parent::__construct($context, $data);
$this->attachmentHelper = $attachmentHelper;
$this->orderRepository = $orderRepository;
}
/**
* @return \Magento\Sales\Model\Order
*/
public function getOrder()
{
if ($this->hasOrder()) {
return $this->getData('order');
}
if ($this->hasOrderId()) {
try {
$order = $this->orderRepository->get($this->getData('order_id'));
$this->setData('order', $order);
return $order;
} catch (\Exception $e) {
//
}
}
}
public function getOrderId()
{
$order = $this->getOrder();
if ($order) {
return $order->getId();
}
return false;
}
public function getOrderAttachments()
{
$order = $this->getOrder();
if (!$order) {
return [];
}
$quoteId = $order->getQuoteId();
return $this->attachmentHelper->getOrderAttachments($quoteId, false);
}
}
namespace Swissup\Orderattachment\Block\Email;
class Attachments extends \Magento\Framework\View\Element\Template
{
protected $_template = 'email/order/attachments.phtml';
/**
* @var \Swissup\Orderattachment\Helper\Attachment
*/
protected $attachmentHelper;
/**
* @var \Magento\Sales\Model\OrderRepository
*/
protected $orderRepository;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Swissup\Orderattachment\Helper\Attachment $attachmentHelper
* @param \Magento\Sales\Model\OrderRepository $orderRepository
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Swissup\Orderattachment\Helper\Attachment $attachmentHelper,
\Magento\Sales\Model\OrderRepository $orderRepository,
array $data = []
) {
parent::__construct($context, $data);
$this->attachmentHelper = $attachmentHelper;
$this->orderRepository = $orderRepository;
}
/**
* @return \Magento\Sales\Model\Order
*/
public function getOrder()
{
if ($this->hasOrder()) {
return $this->getData('order');
}
if ($this->hasOrderId()) {
try {
$order = $this->orderRepository->get($this->getData('order_id'));
$this->setData('order', $order);
return $order;
} catch (\Exception $e) {
//
}
}
}
public function getOrderId()
{
$order = $this->getOrder();
if ($order) {
return $order->getId();
}
return false;
}
public function getOrderAttachments()
{
$order = $this->getOrder();
if (!$order) {
return [];
}
$quoteId = $order->getQuoteId();
return $this->attachmentHelper->getOrderAttachments($quoteId, false);
}
}