Skip to content

Commit

Permalink
Merge pull request #21 from alma/feature/ecom-2262-home-maison-error-…
Browse files Browse the repository at this point in the history
…sylius

Fix cart builder for product without image
  • Loading branch information
Francois-Gomis authored Dec 13, 2024
2 parents d1394a1 + a5ac041 commit 22d1d2f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

v2.1.0
------

- Fix: CartBuilder fix call to member function getPath() on null

v2.0.0
------

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "alma/sylius-payment-plugin",
"type": "sylius-plugin",
"version": "2.1.0",
"keywords": [
"alma",
"buy now pay later",
Expand Down
2 changes: 1 addition & 1 deletion src/AlmaSyliusPaymentPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final class AlmaSyliusPaymentPlugin extends Bundle
{
const VERSION = "2.0.0";
const VERSION = "2.1.0";

use SyliusPluginTrait;

Expand Down
4 changes: 2 additions & 2 deletions src/DataBuilder/CartDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ private function getProductPictureUrl(ProductVariantInterface $variant): string
/** @var ImageInterface[] $images */
$images = $subject->getImages();

if (count($mainPictures) > 0) {
if (!empty($mainPictures) && $mainPictures[0] !== null ) {
$path = $mainPictures[0]->getPath();
} elseif (count($images) > 0) {
} elseif (!empty($images) && $images[0] !== null) {
$path = $images[0]->getPath();
}

Expand Down

0 comments on commit 22d1d2f

Please sign in to comment.