buckaroo-it / Magento2

Repository containing the Magento2 plugin by Buckaroo
MIT License
28 stars 35 forks source link

Apple Pay button issue on product page #1102

Open jansentjeu opened 3 days ago

jansentjeu commented 3 days ago

If there is no configuration value in the database for payment/buckaroo_magento2_applepay/available_buttons an error will appear on the product page. TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in Block/Catalog/Product/View/Applepay.php:66

Steps to reproduce:

  1. Make sure there is no value for the configuration payment/buckaroo_magento2_applepay/available_buttons in the database
  2. Go to a product page
  3. An error is displayed

Cause of the issue: It's because of the changes in commit 385f7d16924d37baec581e63934207cf2cf59844, file Block/Catalog/Product/View/Applepay.php, function canShowButton($page). Here the check $this->applepayConfigProvider->getAvailableButtons() has been removed. If there is no configuration value in the database, false is returned. However, an in_array() call is executed on this.

Solution: Add the check again. See screenshot below.

Scherm­afbeelding 2024-11-18 om 21 20 18

Version: