I use custom variable in Mirasvit Extension for export parent images also from variants.
For test I export single product and working correct. Now I set filter with export all configurable products in website and I get issue:
Notice: Undefined variable: images in /home/azinvest/domains/under.pl/public_html/pub/media/feed/tmp/16110634559723.php on line 14
On line 14 custom variable is:
}
$images = implode(', ', $images);
}
Here is full code dynamic variable.
$storeManager = $objectManager->create('\Magento\Store\Model\StoreManagerInterface');
$mediaUrl = $storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
if ($product->getTypeId() != 'configurable') {
$images = $mediaUrl . 'catalog/product' . $product->getImage();
} else {
$children = $product->getTypeInstance()->getUsedProducts($product);
foreach ($children as $child){
if ($child->getMediaGalleryImages()) {
foreach ($child->getMediaGalleryImages() as $image) {
$images[] = $mediaUrl . 'catalog/product' . $image['file'];
}
}
}
$images = implode(', ', $images);
}
return $images;
Any solution?