Closed clicks-kodet closed 2 years ago
Hello @clicks-kodet ,
Thanks for your message.
I will contact the developer directly for this. As soon as I have new information I will share it here.
This is not how it works.
$shortcutButtons->getNameInLayout() returns which layout block is currently processed.
The mentioned if statement determines where the button should not be displayed. The "addtocart.shortcut.buttons" block is used on the product details page. The Payone PayPal Express button is not supposed to be shown there.
The module intends to show the button in the mini-basket and on the basket page, which works reliably.
According to: https://github.com/PAYONE-GmbH/magento-2/blob/d343e22cb6c8bd6b3db2bfc74ece52e6f6851356/Observer/AddPaypalExpressButtons.php#L71
the button will not be rendered in case there is already a block
\Magento\Catalog\Block\ShortcutButtons
with nameaddtocart.shortcut.buttons
oraddtocart.shortcut.buttons.additional
in the current layout. Why?The default template contains this block and that case the button would never be rendered. I'd completely understand if the
if
would be negatedas in such case you couldn't render it into block which doesn't exist and you intend to use it.
Could you explain me the current logic behind the
if
statement?