Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product not found page not displaying correctly


AGIBBS

Recommended Posts

Posted

Hi,

 

I am running 3 OSC sites all recently updated to the new v2.3.3 and all slightly different with some modifications and add ons. All works fine expect when the 'product not found' page is displayed, links to view below.

 

 

http://www.isenterprises.co.uk/product_info.php?products_id=2005

http://tigertime.isenterprises.co.uk/product_info.php?products_id=2005

http://shop.resultclothing.com/product_info.php?products_id=2005

 

The top 2 sites from above worked before update, but the bottom didn't.

 

It's like the css hasn't conected properly and thrown everything out of wack.

 

 

Any suggestions or tips would be appreciated.

 

Thanks

 

Code for product_info.php is below from one of the above sites:

 

Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
// added for New Product Icon contribution
$today_time = time();
// end addition for New Product Icon contribution
//edited for v2.3.3 update AG 18 4 13
require('includes/application_top.php');
if (!isset($HTTP_GET_VARS['products_id'])) {
tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
//
$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_check = tep_db_fetch_array($product_check_query);
require(DIR_WS_INCLUDES . 'template_top.php');
if ($product_check['total'] < 1) {
?>
<div class="contentContainer">
<div class="contentText">
<?php echo TEXT_PRODUCT_NOT_FOUND; ?>
</div>
<div style="float: right;">
<?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
</div>
</div>
<?php
} else {

Posted

Hi there

 

I think you may have a curly bracket problem (I think the posh term is balancing your braces) - the last bit of your code above is

 

<?php

} else {

 

I think that somewhere in the product_info.php after that there's a '}' out of sync so the page is actually displaying some of the code that applies to valid products - can you post the full product_info.php code?

Posted

Hi Bob,

 

Thanks for your reply. Please find code below, I did wonder if it was a bracket issue...

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
// added for New Product Icon contribution
 $today_time = time();
// end addition for New Product Icon contribution
//edited for v2.3.3 update AG 18 4 13
require('includes/application_top.php');
if (!isset($HTTP_GET_VARS['products_id'])) {
 tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
 //
 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
 require(DIR_WS_INCLUDES . 'template_top.php');
 if ($product_check['total'] < 1) {
?>
<div class="contentContainer">
 <div class="contentText">
   <?php echo TEXT_PRODUCT_NOT_FOUND; ?>
 </div>
 <div style="float: right;">
   <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
 </div>
</div>
<?php
 } else {
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
   $product_info = tep_db_fetch_array($product_info_query);
   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }
   if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
  $products_name = $product_info['products_name'];
   }
 // added for New Product Icon contribution
   //  2592000 = 30 days in the unix timestamp format
   if ( ($today_time - strtotime($product_info['products_date_added'] ) ) < TEXT_NEW_PRODUCT_LENGTH) {
 $img_new_product = tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT . ' : ' . $product_info['products_name']);
   }
   // end addition for New Product Icon contribution
?>
<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>
<div>
 <h1 style="float: right; color:#999;"><?php echo $products_price; ?></h1>
<!-- <h1><?php echo $products_name; ?></h1> -->
		 <!-- // start addition for New Product Icon contribution -->
  <h1><?php echo $img_new_product . $products_name; ?></h1>
	    <!-- end addition for New Product Icon contribution -->
</div>
<div class="contentContainer">
 <div class="contentText">
<?php
   if (tep_not_null($product_info['products_image'])) {
  $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
  if (tep_db_num_rows($pi_query) > 0) {
?>
   <div id="piGal" style="float: right;">
  <ul>
<?php
    $pi_counter = 0;
    while ($pi = tep_db_fetch_array($pi_query)) {
	  $pi_counter++;
	  $pi_entry = '	    <li><a href="';
	  if (tep_not_null($pi['htmlcontent'])) {
	    $pi_entry .= '#piGalimg_' . $pi_counter;
	  } else {
 //edited for v2.3.3 update AG 18 4 13
	    $pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image'], '', 'NONSSL', false);
  //
	  }
	  $pi_entry .= '" target="_blank" rel="fancybox" title="Click to Enlarge">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';
	  if (tep_not_null($pi['htmlcontent'])) {
	    $pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';
	  }
	  $pi_entry .= '</li>';
	  echo $pi_entry;
    }
?>
  </ul>
   </div>
<script type="text/javascript">
$('#piGal ul').bxGallery({
 maxwidth: 300,
 maxheight: 200,
 thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
 thumbcontainer: 300,
 load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>
<?php
  } else {
?>
   <div id="piGal" style="float: right;">
   <!--edited for v2.3.3 update AG 18 4 13-->
  <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image'], '', 'NONSSL', false) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?>
  <!--end of edit-->
   </div>
<?php
  }
?>
<script type="text/javascript">
$("#piGal a[rel^='fancybox']").fancybox({
 cyclic: true
});
</script>
<?php
   }
?>
<?php echo stripslashes($product_info['products_description']); ?>
<?php
}
//++++ QT Pro: End Changed Code
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
//++++ QT Pro: Begin Changed code
  $products_id=(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']);
  require(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php');
  $class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN;
  $pad = new $class($products_id);
  echo $pad->draw();
   }
//Display a table with which attributecombinations is on stock to the customer?
if(PRODINFO_ATTRIBUTE_DISPLAY_STOCK_LIST == 'True'): require(DIR_WS_MODULES . "qtpro_stock_table.php"); endif;
//++++ QT Pro: End Changed Code
?>

   <div style="clear: both;"></div>
<?php
   if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
   <p style="text-align: center;"><?php
// MODIFIED THE DATE FORMAT BELOW SO IT NOW USES A NEW FUNCTION THAT ONLY DISPLAYS MONTH AND YEAR /includes/functions/general.php: tep_date_month_year
echo sprintf(TEXT_DATE_AVAILABLE, tep_date_month_year($product_info['products_date_available'])); ?></p>
<?php
   }
?>
 </div>
<?php
//edited for v2.3.3 update AG 18 4 13
   $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");
//
   $reviews = tep_db_fetch_array($reviews_query);
?>
 <div class="buttonSet">
   <span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>
   <?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>
 </div>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
   } else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
?>
</div>
</form>
<?php

 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Posted

Hi there

 

I think it may be the closing bracket at the top of this chunk

}
//++++ QT Pro: End Changed Code
    $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
    $products_attributes = tep_db_fetch_array($products_attributes_query);
    if ($products_attributes['total'] > 0) {
//++++ QT Pro: Begin Changed code

 

If you take that out then you'll need to add one in further down the page maybe here:

 

<?php
} //<------------- try here
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Archived

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

×
×
  • Create New...