Hi @SiCo
As you can see, we have a created ProductImage Helper to get product images in Product package.
In this helper there is a method called getGalleryImages which is returning images of product.
To show all variant images on product view page, first off all you need to override 'gallery.blade.php'.
Then create a helper function in your package and called your helper using your overrided view file.
Paste given code in your helpers getGalleryImages method.
/**
* Retrieve collection of gallery images
*
* @param Product $product
* @return array
*/
public function getGalleryImages($product)
{
if (! $product)
return [];
$images = [];
if ($product->product->type == 'configurable') {
foreach ($product->variants as $variant) {
foreach ($variant->images as $image) {
if (! Storage::has($image->path))
continue;
$images[] = [
'small_image_url' => url('cache/small/' . $image->path),
'medium_image_url' => url('cache/medium/' . $image->path),
'large_image_url' => url('cache/large/' . $image->path),
'original_image_url' => url('cache/original/' . $image->path),
];
}
}
}
foreach ($product->images as $image) {
if (! Storage::has($image->path))
continue;
$images[] = [
'small_image_url' => url('cache/small/' . $image->path),
'medium_image_url' => url('cache/medium/' . $image->path),
'large_image_url' => url('cache/large/' . $image->path),
'original_image_url' => url('cache/original/' . $image->path),
];
}
if (! $product->parent_id && ! count($images)) {
$images[] = [
'small_image_url' => asset('vendor/webkul/ui/assets/images/product/small-product-placeholder.png'),
'medium_image_url' => asset('vendor/webkul/ui/assets/images/product/meduim-product-placeholder.png'),
'large_image_url' => asset('vendor/webkul/ui/assets/images/product/large-product-placeholder.png'),
'original_image_url' => asset('vendor/webkul/ui/assets/images/product/large-product-placeholder.png')
];
}
return $images;
}
Follow this link to override view file - https://forums.bagisto.com/topic/221/how-to-override-view-file-in-bagisto
Thanks