cancel
Showing results for 
Search instead for 
Did you mean: 

how to keep showing all product thumbnail images ,after select an option image

SOLVED

how to keep showing all product thumbnail images ,after select an option image

hi

at the product detailed page ,

how to keep showing all product thumbnail images ,after select an option image.

 

thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: how to keep showing all product thumbnail images ,after select an option image

Hello @bestshop24h 

 

Hope you are talking about configurable product

 

There are diff gallerySwitchStrategy

 

you need to change this into prepend 

 

so final code of 

"gallerySwitchStrategy": "prepend",

vendor/magento/module-swatches/view/frontend/templates/product/view/renderer.phtml

 

hope it will help you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

Re: how to keep showing all product thumbnail images ,after select an option image

go to  vendor/magento/module-swatches/view/frontend/templates/product/view/renderer.phtml


edit the text "replace" in the  following code 


"gallerySwitchStrategy": "<?php /* @escapeNotVerified */ echo $block->getVar('gallery_switch_strategy',
'Magento_ConfigurableProduct') ?: 'replace'; ?>",

change from  "replace"  to "prehend"

 

"gallerySwitchStrategy": "<?php /* @escapeNotVerified */ echo $block->getVar('gallery_switch_strategy',
'Magento_ConfigurableProduct') ?: 'prepend'; ?>",

 

and then,at the backend-system-cache management,click
flush cache storage and Flush Magento Cache

View solution in original post

4 REPLIES 4

Re: how to keep showing all product thumbnail images ,after select an option image

Hi @bestshop24h 

Try to customise your product detail page, get all product images using below code and set your design according to your requirement:

<?php
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $product = $objectManager->create('Magento\Catalog\Model\Product')->load($_product->getId());        
    $images = $product->getMediaGalleryImages();
    foreach($images as $child){ ?>
        <img src="<?php echo $child->getUrl(); ?>" >
<?php } ?>

It may help you to resolve issue.

If issue resolve, please click on 'Kudos' & Accept as Solution!

Problem solved? Click Accept as Solution!

Re: how to keep showing all product thumbnail images ,after select an option image

Hello @bestshop24h 

 

Hope you are talking about configurable product

 

There are diff gallerySwitchStrategy

 

you need to change this into prepend 

 

so final code of 

"gallerySwitchStrategy": "prepend",

vendor/magento/module-swatches/view/frontend/templates/product/view/renderer.phtml

 

hope it will help you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: how to keep showing all product thumbnail images ,after select an option image

go to  vendor/magento/module-swatches/view/frontend/templates/product/view/renderer.phtml


edit the text "replace" in the  following code 


"gallerySwitchStrategy": "<?php /* @escapeNotVerified */ echo $block->getVar('gallery_switch_strategy',
'Magento_ConfigurableProduct') ?: 'replace'; ?>",

change from  "replace"  to "prehend"

 

"gallerySwitchStrategy": "<?php /* @escapeNotVerified */ echo $block->getVar('gallery_switch_strategy',
'Magento_ConfigurableProduct') ?: 'prepend'; ?>",

 

and then,at the backend-system-cache management,click
flush cache storage and Flush Magento Cache

Re: how to keep showing all product thumbnail images ,after select an option image

How to get the child products  images as well  associated with this parent product using  this code