Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Options as images not counting the images!


ixelink

Recommended Posts

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

Link to comment
Share on other sites

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.

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

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 by ixelink
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by ixelink
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...