cancel
Showing results for 
Search instead for 
Did you mean: 

MGS Frontend Builder Issue

SOLVED

Re: MGS Frontend Builder Issue

public function getProductMediaGallery(ModelProduct $product)
    {
        if (!in_array($product->getData('image'), [null, self::EMPTY_IMAGE_VALUE], true)) {
            $baseImage = $product->getData('image');
        } else {
            $productMediaAttributes = array_filter($product->getMediaAttributeValues(), function ($value) {
                return $value !== self::EMPTY_IMAGE_VALUE && $value !== null;
            });
            foreach ($productMediaAttributes as $attributeCode => $value) {
                if ($attributeCode !== 'swatch_image') {
                    $baseImage = (string)$value;
                    break;
                }
            }
        }

        if (empty($baseImage)) {
            return [];
        }

        $resultGallery = $this->getAllSizeImages($product, $baseImage);
        $resultGallery['gallery'] = $this->getGalleryImages($product);

        return $resultGallery;
    }

Re: MGS Frontend Builder Issue

how can i set isset condition please kindly help

Re: MGS Frontend Builder Issue

this is my error after updating Magento from 2.2.3 to 2.3.5 

[Sat Oct 10 01:11:06.447121 2020] [php7:error] [pid 19107] [client 72.255.57.102:33964] PHP Fatal error: Declaration of MGS\\Mpanel\\Helper\\Swatches\\Data::getProductMediaGallery(Magento\\Catalog\\Model\\Product $product) must be compatible with Magento\\Swatches\\Helper\\Data::getProductMediaGallery(Magento\\Catalog\\Model\\Product $product): array in /var/www/html/app/code/MGS/Mpanel/Helper/Swatches/Data.php on line 0, 

Re: MGS Frontend Builder Issue

For me the solution was to set function

getProductMediaGallery

to array:

public function getProductMediaGallery(ModelProduct $product): array