I made a custom module in which it scans a certain path (“pub/media/showroom/images/”) and creates tabs for each found folder where each tab holds the images from it’s respected folder.
I’d like to have the tabs filled with products(thumbnails) by category with a link to the product info.
Now my question is… How do I get a list of all product images/thumbnails by category id with a link to each individual product info page? So when a product image is clicked, the product info is shown in a block beneath my custom module.
showroom.phtml @ app/code/Vendor/Module/view/frontend/templates
<div id="piecesArea"> <?php $ folders = scandir("pub/media/showroom/images/"); $ ignore = Array(".", "..", ".htaccess"); /* Display the tabs according to folder names */ echo "<ul id=\"tabs\">"; foreach($ folders as $ key => $ curfol){ if(!in_array($ curfol, $ ignore)) { $ curfol=ltrim($ curfol,'1234567890'); echo "<li>$ curfol</li>\n"; } }; echo "</ul>"; /* For each tab, display the images */ foreach($ folders as $ key => $ curfol){ if(!in_array($ curfol, $ ignore)) { $ key = $ key-1; echo "<div class=\"container\">\n"; $ images = scandir("pub/media/showroom/images/".$ curfol); foreach($ images as $ curimg){ if(!in_array($ curimg, $ ignore)) { echo "<img src=\"".$ this->getViewFileUrl("Vendor_Module::images/images/$ curfol/$ curimg")."\">"; } }; echo "</div>\n"; } }; ?> </div>