hyperweb Posted April 30, 2017 Share Posted April 30, 2017 First time poster, I hope this is the right thread as I seem to be having some trouble, I am new to OsCommerce, as I have just picked up a client who has used this platform for some 13 years. I am trying to loop this bit of html. <div class="ms-slide"> <?php echo tep_image('images/' . $product_info['products_image'], addslashes($product_info['products_name'])); ?> <img class="ms-thumb" src="images/<?php echo $product_info['products_image']; ?>" alt="thumb" /> </div> I need this loop to look like this on output : <div class="ms-slide"> <img src="image/main.jpg" /> <img class="ms-thumb" src="image/main.jpg" alt="thumb" /> </div> <div class="ms-slide"> <img src="image/01.jpg" /> <img class="ms-thumb" src="image/01.jpg" alt="thumb" /> </div> <div class="ms-slide"> <img src="image/02.jpg" /> <img class="ms-thumb" src="image/02.jpg" alt="thumb" /> </div> However, I seem to be having a really hard time figuring out how to write a forEach loop regarding the product images. This output would give me my image slide and thumbnails on the product_info.php page. There are no modules in the way to interfere, I themed a copy of the bootstrap edition and I am trying to integrate the product images into my display theme properly. Any help is appreciated! Thanks in advance! Link to comment Share on other sites More sharing options...
frankl Posted May 1, 2017 Share Posted May 1, 2017 @@hyperweb This is the original code, what are you having difficulty with? Why do you want to change it? To make the images into a slider rather than static? (this is assuming you are using the recommended 2.3.4BS version) <?php if (tep_not_null($product_info['products_image'])) { echo tep_image('images/' . $product_info['products_image'], NULL, NULL, NULL, 'itemprop="image" style="display:none;"'); $photoset_layout = (int)MODULE_HEADER_TAGS_PRODUCT_COLORBOX_LAYOUT; $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order"); $pi_total = tep_db_num_rows($pi_query); if ($pi_total > 0) { ?> <div class="piGal pull-right" data-imgcount="<?php echo $photoset_layout; ?>"> <?php $pi_counter = 0; $pi_html = array(); while ($pi = tep_db_fetch_array($pi_query)) { $pi_counter++; if (tep_not_null($pi['htmlcontent'])) { $pi_html[] = '<div id="piGalDiv_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div>'; } echo tep_image('images/' . $pi['image'], '', '', '', 'id="piGalImg_' . $pi_counter . '"'); } ?> </div> <?php if ( !empty($pi_html) ) { echo ' <div style="display: none;">' . implode('', $pi_html) . '</div>'; } } else { ?> <div class="piGal pull-right"> <?php echo tep_image('images/' . $product_info['products_image'], addslashes($product_info['products_name'])); ?> </div> <?php } } ?> osCommerce user since 2003! Link to comment Share on other sites More sharing options...
hyperweb Posted May 1, 2017 Author Share Posted May 1, 2017 @@frankl Thanks for your time here. I figured out what I was missing last night. Link to comment Share on other sites More sharing options...
♥14steve14 Posted May 1, 2017 Share Posted May 1, 2017 And are you going to post what you did so that it may be beneficial to others who find this thread and want to see what the final outcome was. REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
hyperweb Posted May 1, 2017 Author Share Posted May 1, 2017 @@14steve14Not really interested. Link to comment Share on other sites More sharing options...
bonbec Posted May 2, 2017 Share Posted May 2, 2017 @@hyperweb What makes the wealth of our community is sharing.When you have a problem and a community member takes time to help, the least is to give the final result so that it can help someone who is going to have the same problem. with OsC 2.2 since 2006 ... Link to comment Share on other sites More sharing options...
MrPhil Posted May 2, 2017 Share Posted May 2, 2017 @@14steve14 Not really interested. This community seems toxic. Yo, bud, that's how community-supported software works! If you ask a question and someone takes the time and effort to try to help, the least you can do is let us know what solution you found, to aid others who come after you. Link to comment Share on other sites More sharing options...
hyperweb Posted May 2, 2017 Author Share Posted May 2, 2017 @@MrPhil I asked a simple question. I received two very condescending replies. Why would I be interested in helping at this point? User @@frankl pointed out what I discovered myself the night before. Which was a simple misplaced location of where the looping was taking place. I was slightly unfamiliar with this old school way that OsCommerce was built. I refreshed my own memory, and discovered what I needed to. Link to comment Share on other sites More sharing options...
♥mattjt83 Posted May 2, 2017 Share Posted May 2, 2017 @@hyperweb Glad you got your issue sorted out for your client. Best of luck on your project! Matt Link to comment Share on other sites More sharing options...
burt Posted May 2, 2017 Share Posted May 2, 2017 I have removed inflammatory remarks. @@All, let's play nicely. Link to comment Share on other sites More sharing options...
frankl Posted May 2, 2017 Share Posted May 2, 2017 @@hyperweb Come back any time you need help. osCommerce user since 2003! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.