-
Notifications
You must be signed in to change notification settings - Fork 9.4k
magento/magento2#24730: Fix Frontend Invoice PDF configured Logo image #30632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
2389da7
6827503
9181adc
4d0debd
7b7b83a
182a65c
0287723
65bb095
f229c75
5855832
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Magento\Sales\Helper\Invoice; | ||
|
||
use Magento\Framework\App\Helper\AbstractHelper; | ||
use Magento\Framework\UrlInterface; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class Logo extends AbstractHelper | ||
mozok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
const XML_PATH_SALES_IDENTITY_LOGO_HTML = 'sales/identity/logo_html'; | ||
mozok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
protected $logoBaseDir = 'sales/store/logo_html/'; | ||
mozok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getLogoFile() | ||
mozok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
$result = null; | ||
|
||
$invoiceLogoPath = $this->getIdentityLogoHtml(); | ||
if ($invoiceLogoPath) { | ||
$result = $this->_urlBuilder->getBaseUrl( | ||
['_type' => UrlInterface::URL_TYPE_MEDIA] | ||
) . $this->getLogoBaseDir() . $invoiceLogoPath; | ||
mozok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
return $result; | ||
mozok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getLogoBaseDir() | ||
mozok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
return $this->logoBaseDir; | ||
} | ||
|
||
/** | ||
* @param null|int|string $store | ||
* @return mixed | ||
*/ | ||
public function getIdentityLogoHtml($store = null) | ||
{ | ||
return $this->scopeConfig->getValue( | ||
self::XML_PATH_SALES_IDENTITY_LOGO_HTML, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
mozok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,13 @@ | |
<update handle="print" /> | ||
<body> | ||
<attribute name="class" value="account"/> | ||
<referenceContainer name="header-wrapper"> | ||
<referenceBlock name="logo"> | ||
<arguments> | ||
<argument name="logo_src" xsi:type="helper" helper="Magento\Sales\Helper\Invoice\Logo::getLogoFile"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change xsi:type, I believe it should be "object" instead of "helper" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I rely on check in original Block class
So I want to inject result of my service class execution into 'logo_src' argument just in one layout. |
||
</arguments> | ||
</referenceBlock> | ||
</referenceContainer> | ||
<referenceContainer name="page.main.title"> | ||
<block class="Magento\Sales\Block\Order\PrintOrder\Invoice" name="order.status" template="Magento_Sales::order/order_status.phtml" /> | ||
<block class="Magento\Sales\Block\Order\PrintOrder\Invoice" name="order.date" template="Magento_Sales::order/order_date.phtml" /> | ||
|
Uh oh!
There was an error while loading. Please reload this page.