|
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 / dev2.destoffenstraat.com / app / code / MageWorx / GiftCards / Block / |
Filename | /home/dev2.destoffenstraat.com/app/code/MageWorx/GiftCards/Block/PrintCard.php_bkp |
Size | 3.85 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 13-May-2022 10:39 |
Last accessed | 22-Aug-2025 20:57 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* Copyright © MageWorx. All rights reserved.
* See LICENSE.txt for license details.
*/
namespace MageWorx\GiftCards\Block;
use Magento\Sales\Api\OrderRepositoryInterface;
class PrintCard extends \Magento\Framework\View\Element\Template
{
/**
* @var \Magento\Framework\Registry
*/
protected $registry;
/**
* @var mixed
*/
protected $giftCard;
/**
* @var \Magento\Framework\Escaper
*/
protected $escaper;
/**
* @var OrderRepositoryInterface
*/
protected $orderRepository;
/**
* @var \Magento\Checkout\Helper\Data
*/
protected $checkoutHelper;
/**
* @var \MageWorx\GiftCards\Helper\Data
*/
protected $helper;
/**
* @var \Magento\Catalog\Helper\Image
*/
protected $productImageModel;
/**
* @var \Magento\Framework\View\Asset\Repository
*/
protected $assetRepo;
/**
* @var \MageWorx\GiftCards\Helper\Price
*/
protected $helperPrice;
/**
* PrintCard constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Checkout\Helper\Data $checkoutHelper
* @param \MageWorx\GiftCards\Helper\Data $helper
* @param \Magento\Catalog\Helper\Image $productImageModel
* @param OrderRepositoryInterface $orderRepository
* @param \MageWorx\GiftCards\Helper\Price $helperPrice
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Checkout\Helper\Data $checkoutHelper,
\MageWorx\GiftCards\Helper\Data $helper,
\Magento\Catalog\Helper\Image $productImageModel,
OrderRepositoryInterface $orderRepository,
\MageWorx\GiftCards\Helper\Price $helperPrice,
array $data = []
) {
parent::__construct($context, $data);
$this->registry = $registry;
$this->giftCard = $this->registry->registry('mageworx_print_giftcard');
$this->checkoutHelper = $checkoutHelper;
$this->helper = $helper;
$this->orderRepository = $orderRepository;
$this->helperPrice = $helperPrice;
$this->escaper = $context->getEscaper();
$this->productImageModel = $productImageModel;
$this->assetRepo = $context->getAssetRepository();
}
public function getGiftCard()
{
return $this->giftCard;
}
/**
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getAmount()
{
$price = $this->helperPrice->convertCardCurrencyToStoreCurrency(
$this->giftCard->getCardAmount(),
$this->_storeManager->getStore(),
$this->giftCard->getCardCurrency()
);
return $this->checkoutHelper->formatPrice($price);
}
public function getFrontendName()
{
return $this->helper->getStoreName();
}
public function getOrder()
{
$order = null;
if ($orderId = $this->giftCard->getOrderId()) {
$order = $this->orderRepository->get($orderId);
}
return $order;
}
public function getProductImageUrl($orderItem)
{
$product = $orderItem->getProduct();
$imageUrl = $this->productImageModel->init($product, 'image')->getUrl();
return $imageUrl;
}
public function getDefaultImageUrl()
{
return $this->assetRepo->getUrl('MageWorx_GiftCards::images/giftcard.png');
}
public function getSupportMail()
{
return $this->helper->getSupportMail();
}
public function getPictureHtml()
{
return '<img src="' . $this->giftCard->getPictureUrl() . '" alt="" />';
}
}
/**
* Copyright © MageWorx. All rights reserved.
* See LICENSE.txt for license details.
*/
namespace MageWorx\GiftCards\Block;
use Magento\Sales\Api\OrderRepositoryInterface;
class PrintCard extends \Magento\Framework\View\Element\Template
{
/**
* @var \Magento\Framework\Registry
*/
protected $registry;
/**
* @var mixed
*/
protected $giftCard;
/**
* @var \Magento\Framework\Escaper
*/
protected $escaper;
/**
* @var OrderRepositoryInterface
*/
protected $orderRepository;
/**
* @var \Magento\Checkout\Helper\Data
*/
protected $checkoutHelper;
/**
* @var \MageWorx\GiftCards\Helper\Data
*/
protected $helper;
/**
* @var \Magento\Catalog\Helper\Image
*/
protected $productImageModel;
/**
* @var \Magento\Framework\View\Asset\Repository
*/
protected $assetRepo;
/**
* @var \MageWorx\GiftCards\Helper\Price
*/
protected $helperPrice;
/**
* PrintCard constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Checkout\Helper\Data $checkoutHelper
* @param \MageWorx\GiftCards\Helper\Data $helper
* @param \Magento\Catalog\Helper\Image $productImageModel
* @param OrderRepositoryInterface $orderRepository
* @param \MageWorx\GiftCards\Helper\Price $helperPrice
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Checkout\Helper\Data $checkoutHelper,
\MageWorx\GiftCards\Helper\Data $helper,
\Magento\Catalog\Helper\Image $productImageModel,
OrderRepositoryInterface $orderRepository,
\MageWorx\GiftCards\Helper\Price $helperPrice,
array $data = []
) {
parent::__construct($context, $data);
$this->registry = $registry;
$this->giftCard = $this->registry->registry('mageworx_print_giftcard');
$this->checkoutHelper = $checkoutHelper;
$this->helper = $helper;
$this->orderRepository = $orderRepository;
$this->helperPrice = $helperPrice;
$this->escaper = $context->getEscaper();
$this->productImageModel = $productImageModel;
$this->assetRepo = $context->getAssetRepository();
}
public function getGiftCard()
{
return $this->giftCard;
}
/**
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getAmount()
{
$price = $this->helperPrice->convertCardCurrencyToStoreCurrency(
$this->giftCard->getCardAmount(),
$this->_storeManager->getStore(),
$this->giftCard->getCardCurrency()
);
return $this->checkoutHelper->formatPrice($price);
}
public function getFrontendName()
{
return $this->helper->getStoreName();
}
public function getOrder()
{
$order = null;
if ($orderId = $this->giftCard->getOrderId()) {
$order = $this->orderRepository->get($orderId);
}
return $order;
}
public function getProductImageUrl($orderItem)
{
$product = $orderItem->getProduct();
$imageUrl = $this->productImageModel->init($product, 'image')->getUrl();
return $imageUrl;
}
public function getDefaultImageUrl()
{
return $this->assetRepo->getUrl('MageWorx_GiftCards::images/giftcard.png');
}
public function getSupportMail()
{
return $this->helper->getSupportMail();
}
public function getPictureHtml()
{
return '<img src="' . $this->giftCard->getPictureUrl() . '" alt="" />';
}
}