-
Notifications
You must be signed in to change notification settings - Fork 154
[BugFix] Fix area for image placeholder in graphql response. #245
Conversation
@@ -71,7 +79,15 @@ private function getImageUrl(string $imageType, ?string $imagePath): string | |||
$image = $this->productImageFactory->create(); | |||
$image->setDestinationSubdir($imageType) | |||
->setBaseFile($imagePath); | |||
$imageUrl = $image->getUrl(); | |||
|
|||
$imageUrl = $image->isBaseFilePlaceholder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naydav could we get someone to test this solution please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have test, need just unskip it and add a few asserts
Also, need to unskip test |
@VoronoyAlexandr |
/** | ||
* @var PlaceholderProvider | ||
*/ | ||
private $_placeholderProvider; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use prefix _
for variables
|
||
/** | ||
* Url constructor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra comment
$imageUrl = $image->getUrl(); | ||
return $imageUrl; | ||
|
||
if ($image->isBaseFilePlaceholder()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to cover this logic with API-functional test
use Magento\Store\Model\StoreManagerInterface; | ||
|
||
/** | ||
* Class Placeholder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide clear dockblocks for all of classes
* Class Placeholder | ||
* @package Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Image | ||
*/ | ||
class Placeholder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this class has a lot of responsibility (like helper in Magento 1)
@@ -51,7 +51,6 @@ public function testProductWithBaseImage() | |||
*/ | |||
public function testProductWithoutBaseImage() | |||
{ | |||
$this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/239'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add additional logic for checking of placeholders
} | ||
|
||
return $this->_assetRepository->createAsset( | ||
"Magento_Catalog::images/product/placeholder/{$imageType}.jpg", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to check behavior if I changed default placeholder on some custom value via configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's done above
if ($imageAsset->getFilePath()) {
return $imageAsset->getUrl();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need config fixture to check this
Hello @VoronoyAlexandr, Please let me know if you need any assistance. |
Closing this one due to inactivity. |
Hi @VoronoyAlexandr, thank you for your contribution! |
Description (*)
PR for issue #239 Fix resolving of image placeholder for Product without images.
Changed area to "frontend" instead "graphql" for placeholder asset.
Fixed Issues (if relevant)
Manual testing scenarios (*)
Request:
Response:
Contribution checklist (*)