Jump to content
Latest News: (loading..)
Sign in to follow this  
aftabn10

Product Info Error

Recommended Posts

Hi, I have added STS Template to my oscommerce shop rc2a. Everything seems to be working fine, the only issue is that when I vist the product_info page for any product, the left hand column does not align properly with the content box, but on the other pages everything is ok.

 

I have gone through my code to see if and what errors I have made, but I have been unable to identify. If somebody could please help identify any issues with my product info code that might help me to resolve this issue.

 

Would really appreciate it. Thanks in advance.

 

Here is my code:

 

<?php
/*
 $Id: product_info.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 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);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<?php 
# cDynamic Meta Tags
require(DIR_WS_INCLUDES . 'meta_tags.php');
#
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<meta name="<?php echo $products_description; ?>" content="<?php echo $products_name; ?>" />
<meta name="keywords" content="" />
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">	
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
   <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="1" width="93%" align="center" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>
     <tr>
       <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 } else {
// BOF MaxiDVD: Modified For Ultimate Images Pack!
   $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, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, 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 . "'");
// EOF MaxiDVD: Modified For Ultimate Images Pack!
   $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 . "'");

   // see if rp product
   $rp_has_trial = false;
   if($product_info['products_type'] == 'recurring'){
       // recurring product
     $rp_array = array();
     $rp_product_query = tep_db_query('SELECT billingPeriod, billingFrequency, totalBillingCycles, trialBillingPeriod, trialBillingFrequency, trialTotalBillingCycles, trialAmt FROM ' . TABLE_RP_PAYPAL_PRODUCT_PROFILE . ' WHERE products_id=' . (int)$HTTP_GET_VARS['products_id']);
     if($rp_product = tep_db_fetch_array($rp_product_query)){
       // recurring data
        $rp_array = $rp_product;
        if(strlen($rp_product['trialBillingPeriod'])>0){
            $rp_has_trial = true;
        }
     }
   }
// rp addition here
   if(count($rp_array)>0){
        include_once(DIR_WS_CLASSES . '/paypal_rp_product_info.php');
        $rpPinfo = new paypal_rp_product_info($product_info, $rp_array, $products_price);
        $rpPinfoHeaderArr = $rpPinfo->getProductInfoHeader();
        $rpPInfoArr = $rpPinfo->getProductInfoFull();
   }
   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
     $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <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'];
   }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td><span class="pageHeading"> <?php echo $rpPinfoHeaderArr['trial']; ?> <?php print $rpPinfoHeaderArr['normal'];?> <?php print $rpPinfoHeaderArr['normal']; ?></span></td>
           <?php
           if(count($rp_array)>0 and $rp_has_trial){
           // rp with trial
           ?> 
           <?php
           // rp no trial
           }elseif (count($rp_array)>0){
           ?>
            
           <?php
           }else{
           // standard product
           ?>
           <?php
           }
           ?>
         </tr>
       <td></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
     </tr>
     <tr>
       <td class="main"><?php
   if (tep_not_null($product_info['products_image'])) {
?><table border="0" align="center" cellpadding="0" cellspacing="0">
			  <tr><td height="19"></td></tr>
			  <tr><td width="253" height="22"><span class="tx2"><?php
 $manufacturer_query = tep_db_query("select m.manufacturers_image, m.manufacturers_name, m.manufacturers_id from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p  where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
$manufacturer = tep_db_fetch_array($manufacturer_query);
?><?php if (tep_not_null($manufacturer['manufacturers_name'])) {echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id'] , 'NONSSL') . '">'. $manufacturer['manufacturers_name'] . '</a>';}?></span> <-- Click here to View Full Collection</span></td>
			  <td>    <span class="tx2"><?php 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'];
   }
?></span></td>
			  <tr><td width="448" height="1" bgcolor="#6B737A"></td></tr>
			  <tr><td height="22" colspan="2"></td></tr>
		 </table>
         <table width="448" height="91" border="0" align="center" cellpadding="2" cellspacing="0">
           <tr>
             <td width="72" rowspan="2" align="center" valign="top" class="bd">
<!-- // BOF MaxiDVD: Modified For Ultimate Images Pack! //-->
<?php
if ($product_info['products_image_med']!='') {
         $new_image = $product_info['products_image_med'];
         $image_width = MEDIUM_IMAGE_WIDTH;
         $image_height = MEDIUM_IMAGE_HEIGHT;
        } else {
         $new_image = $product_info['products_image_lrg'];
         $image_width = LARGE_IMAGE_WIDTH;
         $image_height = LARGE_IMAGE_HEIGHT;}?>
<!-- // Ultimate Images Pack 2.04 LightBox fix //-->
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image_lrg']) . '" rel="lightbox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image_med'], $product_info['products_name'], MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>
<!-- // EOF MaxiDVD: Modified For Ultimate Images Pack! //-->              </td>
             <td width="16" rowspan="2" align="center" class="smallText"> </td>
             <td width="360" align="left" valign="top" class="ml1"><?php
// BOF MaxiDVD: Modified For Ultimate Images Pack!
if (ULTIMATE_ADDITIONAL_IMAGES == 'enable') { include(DIR_WS_MODULES . 'additional_images.php'); }
// EOF MaxiDVD: Modified For Ultimate Images Pack!
; ?> </td>
		  </tr>
		  <tr>
		  <td height="5" align="center">( Click on any picture to enlarge )</td>
		  </tr>
		  <tr>
		  <td height="10" align="center"></td>
           </tr>
         </table>
	  <table width="445" height="91" border="0" align="center" cellpadding="2" cellspacing="0">
           <tr><td height="2" colspan="2" align="left" class="ml1"></td>
		  </tr>
             <tr><td colspan="2" align="left" class="ml1"><?php echo $products_name; ?></td>
		  </tr>
           <tr>
             <td colspan="2" align="left" class="smallText"><?php echo stripslashes($product_info['products_description']); ?></td>
           </tr>
           <tr>
             <td height="7" colspan="2"></td>
           </tr>
           <tr>
             <td width="137" align="left" valign="top" class="tx3"><img src="images/separator.gif" width="1" height="3" align="top"><br><?php echo $products_price; ?></td>
           <td width="300" align="left" class="tx3"><?php
   }
?>		  		  





<?php
//++++ QT Pro: End Changed Code
?>

         <?php
         // rp check for rp data
         if(count($rp_array)>0){
             print '<p>';
             if(array_key_exists('trial', $rpPInfoArr)){
                 print $rpPInfoArr['trial'] . "<br>\n";
             }
             print $rpPInfoArr['normal'];
         }
   $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();
   }
//++++ QT Pro: End Changed Code
?>
<?php
     }
?>          </td>
           </tr>
           <tr>
             <td height="3" colspan="2"></td>

           </tr>
           <tr>
             <td colspan="2"><img src="images/m21.gif" border="0" alt="" width="87" height="1"></td>
           </tr>
           <tr>
		  <td colspan="2"><!--Begin Sold Out-->
<?php
   If ($product_info['products_quantity']>0) {
   $submit_button = tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
	} else { 
   $submit_button = tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/button_sold_out.gif', 'Sold Out', IMAGE_BUTTON_SOLD_OUT);
 }
?>
                <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . $submit_button; ?>
<!--End Sold Out--> 
<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td></tr>
         </table>        </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   $reviews = tep_db_fetch_array($reviews_query);
   if ($reviews['count'] > 0) {
?>
     <tr>
       <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   }

   if (tep_not_null($product_info['products_url'])) {
?>
     <tr>
       <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   }

   if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
     <tr>
       <td align="left" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
     </tr>
<?php
   } else {
?>
     <tr>
       <td align="left" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
     </tr>
<?php
   }
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"></td>
               <td class="main" align="right"> </td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
?>        </td>
     </tr>
   </table></form></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×