Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra code generated on initial load


Saturn5

Recommended Posts

When the catalog loads for the first time, the footer (date/requests line and banner) are placed on the side of the main body. On a refresh of the page, it is put onto the bottom where it belongs.

 

The initial load (errored load) has the osCsid attached to all the links in the source code: " catalog/reviews.php?osCsid=7870346bad62a5e9f26209275655130f"> "

 

The refreshed load (presented correctly) does not have the osCsid attached to all the links in the source code: " catalog/reviews.php"> "

 

In viewing for differences of the source from the initial and refreshed loads, I discovered that in the initial load, it includes an additional " </ " mark near the end of the reviews section. The refreshed load does not have this extra half tag.

 

Initial load:

<td class="boxText">There are currently no product reviews</td>

</tr>

<tr>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>

</tr>

</table>

</td>

</tr>

</ </td>

</tr>

<!-- reviews_eof //-->

<!-- right_navigation_eof //-->

 

Refreshed load:

<td class="boxText">There are currently no product reviews</td>

</tr>

<tr>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

<!-- reviews_eof //-->

<!-- right_navigation_eof //-->

 

Looking at the /boxes/reviews.php and the catalog/reviews.php files, I'm not finding what would be causing the first load to be creating the erroneous code. The <?php tag ends and then has the last end tags before the eof notice:

?>

</td>

</tr>

<!-- reviews_eof //-->

 

So the erroneous tag is the last output of the <?php script. I'll post the script from the file on my server below, but I haven't made modification to this file, so it should be the same.

 

Any assistance would be appreciated.

 

Additional data provided:

 

<!-- reviews //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_REVIEWS);

 

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_REVIEWS));

 

$random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'";

if (isset($HTTP_GET_VARS['products_id'])) {

$random_select .= " and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'";

}

$random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;

$random_product = tep_random_select($random_select);

 

$info_box_contents = array();

 

if ($random_product) {

// display random review box

$review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$random_product['reviews_id'] . "' and languages_id = '" . (int)$languages_id . "'");

$review = tep_db_fetch_array($review_query);

 

$review = tep_break_string(tep_output_string_protected($review['reviews_text']), 15, '-<br>');

 

$info_box_contents[] = array('text' => '<div align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $review . ' ..</a><br><div align="center">' . tep_image(DIR_WS_IMAGES . 'stars_' . $random_product['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</div>');

} elseif (isset($HTTP_GET_VARS['products_id'])) {

// display 'write a review' box

$info_box_contents[] = array('text' => '<table border="0" cellspacing="0" cellpadding="2"><tr><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a></td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . BOX_REVIEWS_WRITE_REVIEW .'</a></td></tr></table>');

} else {

// display 'no reviews' box

$info_box_contents[] = array('text' => BOX_REVIEWS_NO_REVIEWS);

}

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- reviews_eof //-->

Link to comment
Share on other sites

Ok, reading it, I was initially braindead. the </ tag should have read </table>

 

For some reason I didn't get that in my first read, but the question remains why the initial load creates this error and subsequent loads do not.

 

I'm guessing it has to do with cookies, but can't find where the reviews.php bothers with that, so don't understand why it would be having trouble with the structure for presentation.

 

Thanks again

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...