Skip to content

Commit

Permalink
fix issue with multiple language
Browse files Browse the repository at this point in the history
  • Loading branch information
dangscaleflex committed Sep 29, 2022
1 parent 8f6ce9b commit 28add32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion filerobot.php
Expand Up @@ -96,10 +96,11 @@ public function hookActionPresentProduct($observerData)
*/
private function changeImagesIfFilerobot($presentedProduct)
{

if ($presentedProduct->cover) {
$imageRetriever = new \Scaleflex\PrestashopFilerobot\Adapter\FilerobotImageRetriever($this->context->link);
$image = $imageRetriever->getOneImage($presentedProduct->cover['id_image'], $this->context->language->id);
if (!empty($image)) {
if (!empty($image) && $image[0]['url'] !== null) {
$imageCover = $image[0];
$cover = $imageRetriever->getImage(new Product(), $imageCover['id_image'], $imageCover['url']);
$presentedProduct->cover = $cover;
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/ImageManager.php
Expand Up @@ -102,8 +102,8 @@ public function getThumbnailPath($imageId)
private function getThumbnailTag($imageId, $imageType, $tableName, $imageDir)
{
$imagePath = $this->getImagePath($imageId, $imageType, $tableName, $imageDir);

if (str_contains($imagePath, 'filerobot')) {
$search = 'filerobot.com';
if (preg_match("/{$search}/i", $imagePath)) {
return '<img src="' . $imagePath . '&width=45&height=45" />';
}

Expand Down

0 comments on commit 28add32

Please sign in to comment.