1

enter image description here

I want to display arrow if image count is greater than 4.

In view.xml

<var name="navarrows">false</var>

I changed from true to false. Now arrow is not displayed but I want arrow if image is greater than 4

  • can you please upload your code here? – Rohan Hapani Oct 30 '17 at 10:26
  • @RohanHapani I am not getting proper file where I can modify. I have just gone through gallery.phtml file – Jesni Johnson Oct 30 '17 at 10:28
2

Override template file of gallery in your own theme, copy

vendor/magento/module-catalog/view/frontend/templates/product/view/gallery.phtml

to

your_theme_root/Magento_Catalog/templates/product/view/gallery.phtml

Replace in this template (around 80 line):

 "navarrows": <?php /* @escapeNotVerified */  echo $block->getVar("gallery/navarrows"); ?>,

to

"navarrows": <?php /* @escapeNotVerified */  echo (($block->getVar("gallery/navarrows") == 'true') && ($block->getGalleryImages()->count() > 4)) ? 'true' : 'false'; ?>,

I hope it will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.