ixelink Posted May 27, 2009 Share Posted May 27, 2009 Hi All, It took me a great while, but Options As Images is working good now. I still have to set the value for an option to make the image to appear, but I've just deleted the asking for that piece in the script, so the (fake) value won't be displayed anymore and the image does appear. >>But I have a greater problem now. Adding a few more doesn't break them towards the next row, although the number that was set in 'Maximum number of images per row' has been exceded. The counting doesn't work: $count++; if ($count%OPTIONS_IMAGES_NUMBER_PER_ROW == 0) { echo '</td></tr><tr>'; $count = 0; } } echo '</table>'; } Does anyone know what can be wrong here? To me it seems to be incomplete! Regards, Maarten Quote Link to comment Share on other sites More sharing options...
germ Posted May 27, 2009 Share Posted May 27, 2009 Backup the file and then add some debugging code: After this: $count++; Add this: echo '<!-- $count = ' . $count . ' //-->' . "\n"; echo '<!-- OPTIONS_IMAGES_NUMBER_PER_ROW = ' . OPTIONS_IMAGES_NUMBER_PER_ROW . ' //-->' . "\n"; echo '<!-- Remainder: ' . $count%OPTIONS_IMAGES_NUMBER_PER_ROW . ' //-->' . "\n"; Then look at the HTML source code and you may get a clue. Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
ixelink Posted May 27, 2009 Author Share Posted May 27, 2009 (edited) Hi Germ, Thanks a lot for your answer! Always a mirracle when someone does a contribution to help! I've added this code beneath $count++; , but absolutely nothing happens. It looks like the counting doesn't work at all. The to be working script (with your piece included) is: <?php if ($products_options_name['products_options_images_enabled'] == 'false'){ echo '<td class="main"> ' . tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . '</td></tr>'; }else { $count=0; echo '<td class="main"><table><tr>'; foreach ($products_options_array as $opti_array){ echo '<td align="center"><table cellspacing="5" cellpadding="0" border="0">'; if (OPTIONS_IMAGES_CLICK_ENLARGE == 'true'){ echo '<td align="center"><a href="java script:popupWindow(\'' . tep_href_link(FILENAME_OPTIONS_IMAGES_POPUP, 'oID=' . $opti_array['id']) .'\')">' . tep_image(DIR_WS_IMAGES . 'options/' . $opti_array['thumbnail'], $opti_array['text'], OPTIONS_IMAGES_WIDTH, OPTIONS_IMAGES_HEIGHT) . '</a></td></tr>'; }else{ echo '<tr><td align="center">' . tep_image(DIR_WS_IMAGES . 'options/' . $opti_array['thumbnail'], $opti_array['text'], OPTIONS_IMAGES_WIDTH, OPTIONS_IMAGES_HEIGHT) . '</td></tr>'; } echo '<tr><td class="main" align="center">' . $opti_array['text'] . '</td></tr>'; //Radio button disable auto check mod Options as Images MS2 v1.5 //This will add a variable to the loop and make the value untrue. //However if you check a radio button, you still can't uncheck it by clicking it again. //In that case you need to change 'radio' to 'checkbox' in the below code. . . //this will put a checkbox there which can be unchecked by clicking it again. // echo '<tr><td align="center"><input type="checkbox" name ="id[' . $products_options_name['products_options_id'] . ']" value="' . $opti_array['id'] . '" unchecked></td></tr></table></td>'; if ($selected_attribute != $opti_array['id']) { if ($iec=='1') { $checkedd=''; } else { $checkedd='checked'; } } else { $checkedd='checked'; } echo '<tr><td align="center"><input type="checkbox" name ="id[' . $products_options_name['products_options_id'] . ']" value="' . $opti_array['id'] . '" ' . $uncheckedd . ' /></td></tr></table></td>'; $iec='1'; //END Radio button disable auto check mod Options as Images MS2 v1.5 $count++; echo '<!-- $count = ' . $count . ' //-->' . "\n"; echo '<!-- OPTIONS_IMAGES_NUMBER_PER_ROW = ' . OPTIONS_IMAGES_NUMBER_PER_ROW . ' //-->' . "\n"; echo '<!-- Remainder: ' . $count%OPTIONS_IMAGES_NUMBER_PER_ROW . ' //-->' . "\n"; if ($count%OPTIONS_IMAGES_NUMBER_PER_ROW == 0) { echo '</td></tr><tr>'; $count = 0; } } echo '</table>'; } ?> </td></tr></table> <?php } ?> </td> <?php } ?> As you see I have the checkbox enabled and unchecked. I hope that everything has gone right! Regards, Maarten Edited May 27, 2009 by ixelink Quote Link to comment Share on other sites More sharing options...
ixelink Posted May 27, 2009 Author Share Posted May 27, 2009 Well Jim, I've deleted the <!-- and //--> stuff and now I see a result! Next I have to find the clue... Perhaps (because it's late at night here [Netherlands]) I have to follow up this tomorrow. Hope to meet you again then when I need it! Thanks anyhow for your help. Regards, Maarten Quote Link to comment Share on other sites More sharing options...
ixelink Posted May 27, 2009 Author Share Posted May 27, 2009 It keeps starting with count=1 but as it shows all images I was cheated..! Quote Link to comment Share on other sites More sharing options...
ixelink Posted May 28, 2009 Author Share Posted May 28, 2009 (edited) The counting works. Thankyou Jim for your debugging script! But the problem seems to be the fact that I want the images of different options to be displaid horizontally instead of vertically. That needs a very delicate editing of table items in this options_images.php. Haven't figured it out yet, but I hope to sort it out! :blink: If there's anyone who has suggetions, it would be welcome! Thanks and regards, Maarten Edited May 28, 2009 by ixelink Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.