Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CONTRIBUTION] Product not found but


Guest

Recommended Posts

Posted

Forum thread for the product not found but contribution by Amanda.

  • Replies 69
  • Created
  • Last Reply
Posted

Hi Fred

Ive just updated the "Product Not Found...But" contrib.

What do you think about having a choice of display of the results???

I was thinking about moding the script so you could display the results like a module similar to the index page rather than vertical.

 

What do you think

 

Kind Regards

 

Dave

Posted

Hi Qorn,

 

Choices are always good :)

 

For the people that have asked where the language file for product_info.php is, it's

catalog/includes/languages/english/product_info.php

 

I've also changed my file to read:-

<?php
/*
 $Id: product_info.php,v 1.15 2002/11/19 01:48:08 dgw_ Exp $

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

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('TEXT_PRODUCT_NOT_FOUND', 'Requested Item has not been found!<br>Please see our selection of similar items below');
define('TEXT_CURRENT_REVIEWS', 'Current Reviews:');
define('TEXT_MORE_INFORMATION', 'For more information, please visit this products <a href="%s" target="_blank"><u>webpage</u></a>.');
define('TEXT_DATE_ADDED', 'This product was added to our catalog on %s.');
define('TEXT_DATE_AVAILABLE', '<font color="#ff0000">This product will be in stock on %s.</font>');
define('TEXT_ALSO_PURCHASED_PRODUCTS', 'Customers who bought this product also purchased');
define('TEXT_PRODUCT_OPTIONS', 'Available Options:');
define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge');
// Product_not_found_BUT contribution
define('TEXT_HEADER_ITEM_NOT_FOUND', 'Product not found!');
define('TABLE_HEADING_IMAGE', '');
define('TABLE_HEADING_MODEL', 'Model');
define('TABLE_HEADING_PRODUCTS', 'Product Name');
define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');
define('TABLE_HEADING_QUANTITY', 'Quantity');
define('TABLE_HEADING_PRICE', 'Price');
define('TABLE_HEADING_WEIGHT', 'Weight');
define('TABLE_HEADING_BUY_NOW', 'Buy Now');
define('TEXT_NUMBER_OF_PRODUCTS', 'Number of Products: ');
define('TEXT_SHOW', '<b>Show:</b>');
define('TEXT_BUY', 'Buy 1 \'');
define('TEXT_NOW', '\' now');
define('TEXT_NO_PRODUCTS', 'Sorry, No items have been found');
?>

Hi Fred

Ive just updated the "Product Not Found...But" contrib.

What do you think about having a choice of display of the results???

I was thinking about moding the script so you could display the results like a module similar to the index page rather than vertical.

 

What do you think

 

Kind Regards

 

Dave

Posted
Do you think this will work with:

 

http://www.oscommerce.com/community/contributions,2823 (Ultimate SEO URLs)

 

Rich

OneCad

 

yes, I am using that as well.

 

but if you use fancy paging links in your module product_listing then you should move this in product_info.php :

 

<div id="form" style="position: absolute; z-index: 50;">

 

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

 

below the else statement or the dropdown box of the listing will pickup the add to cart link. Then again, it should not be that high up in the code anyway.

Treasurer MFC

  • 2 months later...
Posted

I love the idea of the contribution. However I seem to be having a problem with it. When nothing simular is found it displays all the products like it is supposed to but it also displays duplicate products b/c some of my product exisit in more than one category. Any ideas on how to fix this so only one of each product is displayed?

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

  • 1 month later...
Posted
I love the idea of the contribution. However I seem to be having a problem with it. When nothing simular is found it displays all the products like it is supposed to but it also displays duplicate products b/c some of my product exisit in more than one category.  Any ideas on how to fix this so only one of each product is displayed?

 

maybe a SELECT DISTINCT would work or do an array_unique on the result array.

Treasurer MFC

  • 3 weeks later...
Posted

My product_info:

 

<?php
/*
<!--<?php $product_info_title = tep_db_query("select p.products_id, pd.products_name 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 . "'"); 

   $the_title = tep_db_fetch_array($product_info_title)?> <title><?php echo TITLE;?>       <?php echo $the_title['products_name'] ?></title>-->
 $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

 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_CLASSES . 'page_cache.php');
$page_cache = new page_cache($cart_cache);
$page_cache->cache_this_page(); 
 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);
// Start "Category & Manufactureres Name in Product_info" 
 $categories_name_query  = tep_db_query("select c.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " c where c.categories_id = '" . (int)$current_category_id . "' and c.language_id = '" . (int)$languages_id . "'");
 $category = tep_db_fetch_array($categories_name_query);	
// Start "Category & Manufactureres Name in Product_info" 
?>
<?php 
$the_product_info_query = tep_db_query("select pd.language_id, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_barcode, p.products_quantity, p.products_image, pd.products_url, p.products_price, products_last_modified, 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_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'" . " and pd.language_id ='" .  (int)$languages_id . "'"); 
   $the_product_info = tep_db_fetch_array($the_product_info_query); 
  $the_product_name = strip_tags ($the_product_info['products_name'], ""); 
  $the_product_description = strip_tags ($the_product_info['products_description'], ""); 
  $the_product_model = strip_tags ($the_product_info['products_model'], ""); 
?> 
<?php 
$the_manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id"); 
   $the_manufacturers = tep_db_fetch_array($the_manufacturer_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; ?>">
<title><?php echo '100ASA ecommerce' ?>: <?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $the_product_name; ?> [cod: <?php echo $the_product_info['products_model'] ?>]</title>
<meta name="keywords" content="<?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $the_product_name; ?> <?php echo $the_product_model; ?>"> 
<meta name="description" content="<?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $the_product_name; ?> <?php echo $the_product_model; ?>">
<META NAME="TITLE" CONTENT="<?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $the_product_name; ?> <?php echo $the_product_model; ?>">
<meta name="robots" content="index,follow">
<meta name="rating" content="general">
<meta name="distribution" content="global">
<META NAME="revisit-after" CONTENT="7 Days">
<meta name="swww.childkey" content="childkey.green">
<META NAME="RESOURCE-TYPE" CONTENT="DOCUMENT">
<META NAME="AUTHOR" CONTENT="100ASA Foggia Italy">
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></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>
<!-- body_text //-->
   <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="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>
     <tr>
       <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
     </tr>
<!-- amanda -->
<?php

   // the requested product could not be found. But we do not give up.
   // Check if it was disabled and get the category id of that product
   $product_check_query = tep_db_query("select pc.categories_id 
                                        from " . TABLE_PRODUCTS . " p, 
                                             " . TABLE_PRODUCTS_DESCRIPTION . " pd,
                                             " . TABLE_PRODUCTS_TO_CATEGORIES . " pc
                                        where p.products_status != '1' and 
                                              p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and 
                                              pd.products_id = p.products_id and 
                                              pd.products_id = pc.products_id and 
                                              pd.language_id = '" . (int)$languages_id . "'");


   if ($product_check = tep_db_fetch_array($product_check_query)) { // product exists but disabled

     // then we do a query of the other products in the same category
     // and we display them below using the product_listing module
     $listing_sql = "select p.products_model, 
                            pd.products_name, 
                            p.products_image, 
                            p.products_quantity, 
                            p.products_id, 
                            p.manufacturers_id, 
                            p.products_price, 
                            p.products_tax_class_id, 
                            IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
                            IF(s.status, s.specials_new_products_price, p.products_price) as final_price 
                     from " . TABLE_PRODUCTS_DESCRIPTION . " pd, 
                          " . TABLE_CATEGORIES . " c, 
                          " . TABLE_PRODUCTS . " p left join 
                          " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, 
                          " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join 
                          " . TABLE_SPECIALS . " s on p.products_id = s.products_id 
                     where p.products_status = '1' and 
                           p.products_id = p2c.products_id and 
                           pd.products_id = p2c.products_id and 
                           p2c.categories_id = c.categories_id and 
                           c.categories_id = " . $product_check['categories_id'] . " and 
                           pd.language_id = '" . (int)$languages_id . "'";

   } else { // no, the product is totally absent, we are running out of options, so lets do a query anyway with a variation on the product id.

      $wrong_id = $HTTP_GET_VARS['products_id'];
      $size = strlen($wrong_id)-2;
      $wrong_id = substr($wrong_id, 1,$size);
      $listing_sql = "select p.products_model, 
                             pd.products_name, 
                             p.products_image, 
                             p.products_quantity, 
                             p.products_id, 
                             p.manufacturers_id, 
                             p.products_price, 
                             p.products_tax_class_id, 
                             IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
                             IF(s.status, s.specials_new_products_price, p.products_price) as final_price 
                      from " . TABLE_PRODUCTS_DESCRIPTION . " pd, 
                           " . TABLE_CATEGORIES . " c, 
                           " . TABLE_PRODUCTS . " p left join 
                           " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, 
                           " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join 
                           " . TABLE_SPECIALS . " s on p.products_id = s.products_id 
                      where p.products_status = '1' and 
                            p.products_id = p2c.products_id and 
                            pd.products_id = p2c.products_id and 
                            p2c.categories_id = c.categories_id and 
                            p.products_id like '%" . $wrong_id . "%' and 
                            pd.language_id = '" . (int)$languages_id . "'";
   }
?>


     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>

     <tr>
       <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
     </tr>


     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<!--amanda-->
     <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 {
  // Start "Category & Manufactureres Name in Product_info" 
   $product_info_query = tep_db_query("select products.products_id, products.products_listino, products_description.products_name, products_description.products_description, products.products_model, products.products_barcode, products.products_quantity, products.products_image, products_description.products_url, products.products_price, products.products_last_modified, products.products_tax_class_id, products.products_date_added, products.products_date_available, products.manufacturers_id, manufacturers.manufacturers_name FROM products  LEFT JOIN manufacturers ON products.manufacturers_id = manufacturers.manufacturers_id left  join products_description on products_description.products_id = products.products_id WHERE products.products_status = '1' and products.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_description.language_id = '" . (int)$languages_id . "'");
// End "Category & Manufactureres Name in Product_info" 
 // $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 = '<font face="Verdana" size="3"><s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <b><font face="Verdana" size="5" color="#FF0000">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</b></font><br><font face="Verdana" size="1" color="#FF0000">' . TEXT_IVA2 .'</font></b>';
   } else {
     $products_price = '<b><font face="Verdana" size="5" color="#003399">'.$currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])).'<br></b><font face="Verdana" size="1" color="#003399">' . TEXT_IVA2 .'</font>';
   }
   if (tep_not_null($product_info['products_barcode'])) {
   // Start "Category & Manufactureres Name in Product_info" 
     $products_name = '<H2>'.$product_info['manufacturers_name']. ' '. $product_info['products_name'] . '</H2><br><br></b><font face="Verdana" color="#0000aa" size="1">[Codice: ' . $product_info['products_model'] . ']<br></font>' .  '<font face="Verdana" color="#0000aa" size="1">[Produttore: ' . $product_info['manufacturers_name'] . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1">[Barcode: ' . $product_info['products_barcode'] . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1">[' . TEXT_LAST_MODIFIED2 . ' ' . tep_date_long($product_info['products_last_modified']) . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1"><b>[Prezzo di listino: ' . $currencies->display_price($product_info['products_listino'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ']</b></font>';
// End "Category & Manufactureres Name in Product_info" 
 //  $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
$products_name = '<H2>'.$product_info['manufacturers_name']. ' '. $product_info['products_name'] . '</H2><br><br></b><font face="Verdana" color="#0000aa" size="1">[Codice: ' . $product_info['products_model'] . ']<br></font>' .  '<font face="Verdana" color="#0000aa" size="1">[Produttore: ' . $product_info['manufacturers_name'] . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1">[' . TEXT_LAST_MODIFIED2 . ' ' . tep_date_long($product_info['products_last_modified']) . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1"><b>[Prezzo di listino: ' . $currencies->display_price($product_info['products_listino'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ']</b></font>';
//      $products_name = $product_info['products_name'] . ' <span class="smallText">[Produttore:' . $product_info['manufacturers_name'] . ']</span>';
   }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="2" cellpadding="3">
         <tr>
           <td  valign="top"><font color="#003399" face="Verdana"><b><?php echo $products_name; ?></b></font></td>
           <td align="right" valign="top"><?php echo $products_price; ?></td>
<?php

$prod_quantity = $product_info['products_quantity'];

   $minus = ($prod_quantity == -1);

  $ordin = ($prod_quantity == -2);

$red = ($prod_quantity == -3);

  $yellow = ($prod_quantity == 10);

  $green =  ($prod_quantity == 100);?>

      <tr>

<td class="main"><br><?php

                                                switch ($prod_quantity) { 

     case $minus: 
              	 $img = tep_image(DIR_WS_ICONS . 'furgone.gif', TEXT_ARRIVO2).'<FONT COLOR=#0000ff><b> '.TEXT_ARRIVO.'</b></FONT>'; 
                         //  $img = '<FONT COLOR=#0000ff><b>'. TEXT_ARRIVO .'</b></FONT>';

                           break; 

case $ordin: 

                           $img = tep_image(DIR_WS_ICONS . 'prenota.gif', TEXT_ORDINABILE2).'<FONT COLOR=#CC00CC><b> '.TEXT_ORDINABILE.'</b></FONT>';
             //$img = '<FONT COLOR=#CC00CC><b>'. TEXT_ORDINABILE .'</b></FONT>';

                           break; 

                           case $red: 
             $img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE2).'<FONT COLOR=#ff0000><b> '.TEXT_NOT_AVAIBLE.'</b></FONT>';
                           //$img = '<FONT COLOR=#ff0000><b>'. TEXT_NOT_AVAIBLE .'</b></FONT>';

                           break; 

                           case $yellow : 
             $img = tep_image(DIR_WS_ICONS . 'icon_status_yellow.gif', TEXT_FEW_QTY2).'<FONT COLOR=#ff9900><b> '.TEXT_FEW_QTY.'</b></FONT>';
                           //$img = '<FONT COLOR=#ff9900><b>'. TEXT_FEW_QTY .'</b></FONT>';

                           break;

                                                case $green : 
             $img = tep_image(DIR_WS_ICONS . 'icon_status_green.gif', TEXT_BIG_QTY2).'<FONT COLOR=#009900><b> '.TEXT_BIG_QTY .'</b></FONT>';
                           //$img = '<FONT COLOR=#009900><b>'. TEXT_BIG_QTY .'</b></FONT>';

                           break; 

                                                       } 

                                         echo TEXT_IN_STOCK ." " .$img;

                                         ?>     

      </td>

      </tr>

<?php

  ?>     



        </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td class="main">
<?php
   if (tep_not_null($product_info['products_image'])) {
?>
         <table border="0" cellspacing="8" cellpadding="2" align="right" width="30%">
           <tr>
             <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<tr>
           <td align="center" class="smalltext">
      <?php echo TEXT_telefono;?><br><b><?php echo TEXT_numtelefono;?></b><br><br>
      <a href="callto://centoasa"><img src="http://goodies.skype.com/graphics/skypeme_btn_small_blue.gif" border="0" alt="Skype me!"></a><br><br>
     <?php echo '<font face="Verdana" size="1"><a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info['products_id']) .'"  target="_blank">' . tep_image('pdf/pdf.gif') .' download brochure</a></font>'; ?><br><br>
     <?php // ################### Ask a question ############## ?>    
 <img height="19" src="images/ask_a_question.gif" width="21">
  <a href="ask_a_question.php?products_id=<?php echo $product_info['products_id']; ?>" ONMOUSEOVER="window.status='.<?php echo TEXT_QUESTION; ?> .'; return true">
  <?php echo TEXT_QUESTION;?>: <br><b><?php echo $product_info['products_name']; ?></b></a>
<?php // ################ end added ask a question ############ ?>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
             </td>
              </tr>
               </table>
<?php
   }
?>
<!--<p><?php echo nl2br(stripslashes($product_info['products_description'])); ?></p>-->
         <p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
   $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) {
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
           </tr>
<?php
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name 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 . "' order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $products_options_array = array();
       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
       while ($products_options = tep_db_fetch_array($products_options_query)) {
         $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
         if ($products_options['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }
       }

       if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
           </tr>
<?php
     }
?>
         </table>
<?php
   }
?>
       </td>
     </tr>
	 <?php
// DANIEL: begin

 $attributes = "select pop_products_id_slave, products_name, products_price, products_tax_class_id from " . TABLE_PRODUCTS_OPTIONS_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . " pa, ". TABLE_PRODUCTS . " pb WHERE pop_products_id_slave = pa.products_id and pa.products_id=pb.products_id and language_id = '" . (int)$languages_id . "' and pop_products_id_master = '".$HTTP_GET_VARS['products_id']."' and products_status=1 order by pop_order_id, pop_id";
 $attribute_query = tep_db_query($attributes);

 if (mysql_num_rows($attribute_query)>0) {
   echo '<tr><td><br><table class="productlisting">';
   echo '<tr><th align="left" class="productListing-heading"> '. TEXT_RELATIVI.' </th></tr>';
   while ($attributes_values = tep_db_fetch_array($attribute_query)) {
     $products_name_slave = ($attributes_values['products_name']);
     $products_id_slave = ($attributes_values['pop_products_id_slave']);
     $products_price_slave = $currencies->display_price($attributes_values['products_price'], tep_get_tax_rate($attributes_values['products_tax_class_id']));
   //	echo '<tr><td align="left" class="productListing-data"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">'.$products_name_slave.': </a><p align="right">'.$products_price_slave.' </td></tr></p> ';    
      echo '<tr><td align="left" class="productListing-data"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '"><font face="Verdana" >'.$products_name_slave.': <b>'.$products_price_slave.'</b></a></font> </td></tr>';
   }
 echo '</table></td></tr>';
 }

//DANIEL: end

?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>


<?php 

$products_end_query = tep_db_query ("select expires_date from " . TABLE_SPECIALS . " where products_id = ". $HTTP_GET_VARS['products_id'] ." "); 

$products_end = tep_db_fetch_array($products_end_query); 



   if ($products_end['expires_date'] > date('Y-m-d H:i:s')) { 

?> 

     <tr> 

       <td align="center" class="main"><?php echo sprintf(TEXT_DATE_END, tep_date_long($products_end['expires_date'])); ?></td> 

     </tr> 

<?php 

   } ?>

</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><font face="Verdana" color="003399" size="1"><li><?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"><li><?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="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
     </tr>
<?php
   } else {
?>
     <tr>
       <td align="center" 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 width="102"><a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath); ?>"><?php echo tep_image_button('button_back.gif', IMAGE_BUTTON_BACK); ?></a></td>
<td width="168" align="right"><?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>
</td>
               <td class="main" align="right"><?php echo TEXT_QUANTITY . tep_draw_input_field('quantity', '1', 'SIZE=2 maxlength=2') . tep_draw_separator('pixel_trans.gif', '5', '1') . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle'); ?></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
//added for cross -sell
  if ( (USE_CACHE == 'true') && !SID) { 
   echo tep_cache_also_purchased(3600); 
    include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); ?><br>
  <?php
  } else { 
    include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); ?><br>
  <?php
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
  }
?></td>

         </tr>
       </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 
$page_cache->end_page_cache();
require(DIR_WS_INCLUDES . 'application_bottom.php'); 
?>

Skype: centoasa

Skype: remigioruberto

Posted
My product_info:

 

<?php
/*
<!--<?php $product_info_title = tep_db_query("select p.products_id, pd.products_name 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 . "'"); 

? ?$the_title = tep_db_fetch_array($product_info_title)?> <title><?php echo TITLE;?> ? ? ? <?php echo $the_title['products_name'] ?></title>-->
?$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

?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_CLASSES . 'page_cache.php');
$page_cache = new page_cache($cart_cache);
$page_cache->cache_this_page(); 
?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);
// Start "Category & Manufactureres Name in Product_info" 
?$categories_name_query ?= tep_db_query("select c.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " c where c.categories_id = '" . (int)$current_category_id . "' and c.language_id = '" . (int)$languages_id . "'");
?$category = tep_db_fetch_array($categories_name_query);	
// Start "Category & Manufactureres Name in Product_info" 
?>
<?php 
$the_product_info_query = tep_db_query("select pd.language_id, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_barcode, p.products_quantity, p.products_image, pd.products_url, p.products_price, products_last_modified, 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_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'" . " and pd.language_id ='" . ?(int)$languages_id . "'"); 
? ?$the_product_info = tep_db_fetch_array($the_product_info_query); 
? $the_product_name = strip_tags ($the_product_info['products_name'], ""); 
? $the_product_description = strip_tags ($the_product_info['products_description'], ""); 
? $the_product_model = strip_tags ($the_product_info['products_model'], ""); 
?> 
<?php 
$the_manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p ?where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id"); 
? ?$the_manufacturers = tep_db_fetch_array($the_manufacturer_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; ?>">
<title><?php echo '100ASA ecommerce' ?>: <?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $the_product_name; ?> [cod: <?php echo $the_product_info['products_model'] ?>]</title>
<meta name="keywords" content="<?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $the_product_name; ?> <?php echo $the_product_model; ?>"> 
<meta name="description" content="<?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $the_product_name; ?> <?php echo $the_product_model; ?>">
<META NAME="TITLE" CONTENT="<?php echo $the_manufacturers['manufacturers_name']; ?> <?php echo $the_product_name; ?> <?php echo $the_product_model; ?>">
<meta name="robots" content="index,follow">
<meta name="rating" content="general">
<meta name="distribution" content="global">
<META NAME="revisit-after" CONTENT="7 Days">
<meta name="swww.childkey" content="childkey.green">
<META NAME="RESOURCE-TYPE" CONTENT="DOCUMENT">
<META NAME="AUTHOR" CONTENT="100ASA Foggia Italy">
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
?window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></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>
<!-- body_text //-->
? ?<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="0" width="100%" cellspacing="0" cellpadding="0">
<?php
?if ($product_check['total'] < 1) {
?>
? ? ?<tr>
? ? ? ?<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
? ? ?</tr>
<!-- amanda -->
<?php

? ?// the requested product could not be found. But we do not give up.
? ?// Check if it was disabled and get the category id of that product
? ?$product_check_query = tep_db_query("select pc.categories_id 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? from " . TABLE_PRODUCTS . " p, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?" . TABLE_PRODUCTS_DESCRIPTION . " pd,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?" . TABLE_PRODUCTS_TO_CATEGORIES . " pc
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? where p.products_status != '1' and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pd.products_id = p.products_id and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pd.products_id = pc.products_id and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pd.language_id = '" . (int)$languages_id . "'");
? ?if ($product_check = tep_db_fetch_array($product_check_query)) { // product exists but disabled

? ? ?// then we do a query of the other products in the same category
? ? ?// and we display them below using the product_listing module
? ? ?$listing_sql = "select p.products_model, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? pd.products_name, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p.products_image, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p.products_quantity, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p.products_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p.manufacturers_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p.products_price, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p.products_tax_class_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? IF(s.status, s.specials_new_products_price, p.products_price) as final_price 
? ? ? ? ? ? ? ? ? ? ?from " . TABLE_PRODUCTS_DESCRIPTION . " pd, 
? ? ? ? ? ? ? ? ? ? ? ? ? " . TABLE_CATEGORIES . " c, 
? ? ? ? ? ? ? ? ? ? ? ? ? " . TABLE_PRODUCTS . " p left join 
? ? ? ? ? ? ? ? ? ? ? ? ? " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join 
? ? ? ? ? ? ? ? ? ? ? ? ? " . TABLE_SPECIALS . " s on p.products_id = s.products_id 
? ? ? ? ? ? ? ? ? ? ?where p.products_status = '1' and 
? ? ? ? ? ? ? ? ? ? ? ? ? ?p.products_id = p2c.products_id and 
? ? ? ? ? ? ? ? ? ? ? ? ? ?pd.products_id = p2c.products_id and 
? ? ? ? ? ? ? ? ? ? ? ? ? ?p2c.categories_id = c.categories_id and 
? ? ? ? ? ? ? ? ? ? ? ? ? ?c.categories_id = " . $product_check['categories_id'] . " and 
? ? ? ? ? ? ? ? ? ? ? ? ? ?pd.language_id = '" . (int)$languages_id . "'";

? ?} else { // no, the product is totally absent, we are running out of options, so lets do a query anyway with a variation on the product id.

? ? ? $wrong_id = $HTTP_GET_VARS['products_id'];
? ? ? $size = strlen($wrong_id)-2;
? ? ? $wrong_id = substr($wrong_id, 1,$size);
? ? ? $listing_sql = "select p.products_model, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pd.products_name, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p.products_image, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p.products_quantity, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p.products_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p.manufacturers_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p.products_price, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p.products_tax_class_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?IF(s.status, s.specials_new_products_price, p.products_price) as final_price 
? ? ? ? ? ? ? ? ? ? ? from " . TABLE_PRODUCTS_DESCRIPTION . " pd, 
? ? ? ? ? ? ? ? ? ? ? ? ? ?" . TABLE_CATEGORIES . " c, 
? ? ? ? ? ? ? ? ? ? ? ? ? ?" . TABLE_PRODUCTS . " p left join 
? ? ? ? ? ? ? ? ? ? ? ? ? ?" . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? ?" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join 
? ? ? ? ? ? ? ? ? ? ? ? ? ?" . TABLE_SPECIALS . " s on p.products_id = s.products_id 
? ? ? ? ? ? ? ? ? ? ? where p.products_status = '1' and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p.products_id = p2c.products_id and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? pd.products_id = p2c.products_id and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p2c.categories_id = c.categories_id and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? p.products_id like '%" . $wrong_id . "%' and 
? ? ? ? ? ? ? ? ? ? ? ? ? ? pd.language_id = '" . (int)$languages_id . "'";
? ?}
?>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>

? ? ?<tr>
? ? ? ?<td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
<!--amanda-->
? ? ?<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 {
? // Start "Category & Manufactureres Name in Product_info" 
? ?$product_info_query = tep_db_query("select products.products_id, products.products_listino, products_description.products_name, products_description.products_description, products.products_model, products.products_barcode, products.products_quantity, products.products_image, products_description.products_url, products.products_price, products.products_last_modified, products.products_tax_class_id, products.products_date_added, products.products_date_available, products.manufacturers_id, manufacturers.manufacturers_name FROM products ?LEFT JOIN manufacturers ON products.manufacturers_id = manufacturers.manufacturers_id left ?join products_description on products_description.products_id = products.products_id WHERE products.products_status = '1' and products.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_description.language_id = '" . (int)$languages_id . "'");
// End "Category & Manufactureres Name in Product_info" 
?// $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 = '<font face="Verdana" size="3"><s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <b><font face="Verdana" size="5" color="#FF0000">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</b></font><br><font face="Verdana" size="1" color="#FF0000">' . TEXT_IVA2 .'</font></b>';
? ?} else {
? ? ?$products_price = '<b><font face="Verdana" size="5" color="#003399">'.$currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])).'<br></b><font face="Verdana" size="1" color="#003399">' . TEXT_IVA2 .'</font>';
? ?}
? ?if (tep_not_null($product_info['products_barcode'])) {
? ?// Start "Category & Manufactureres Name in Product_info" 
? ? ?$products_name = '<H2>'.$product_info['manufacturers_name']. ' '. $product_info['products_name'] . '</H2><br><br></b><font face="Verdana" color="#0000aa" size="1">[Codice: ' . $product_info['products_model'] . ']<br></font>' . ?'<font face="Verdana" color="#0000aa" size="1">[Produttore: ' . $product_info['manufacturers_name'] . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1">[Barcode: ' . $product_info['products_barcode'] . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1">[' . TEXT_LAST_MODIFIED2 . ' ' . tep_date_long($product_info['products_last_modified']) . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1"><b>[Prezzo di listino: ' . $currencies->display_price($product_info['products_listino'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ']</b></font>';
// End "Category & Manufactureres Name in Product_info" 
?// ?$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
? ?} else {
$products_name = '<H2>'.$product_info['manufacturers_name']. ' '. $product_info['products_name'] . '</H2><br><br></b><font face="Verdana" color="#0000aa" size="1">[Codice: ' . $product_info['products_model'] . ']<br></font>' . ?'<font face="Verdana" color="#0000aa" size="1">[Produttore: ' . $product_info['manufacturers_name'] . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1">[' . TEXT_LAST_MODIFIED2 . ' ' . tep_date_long($product_info['products_last_modified']) . ']<br></font>'. '<font face="Verdana" color="#0000aa" size="1"><b>[Prezzo di listino: ' . $currencies->display_price($product_info['products_listino'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ']</b></font>';
// ? ? ?$products_name = $product_info['products_name'] . ' <span class="smallText">[Produttore:' . $product_info['manufacturers_name'] . ']</span>';
? ?}
?>
? ? ?<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="2" cellpadding="3">
? ? ? ? ?<tr>
? ? ? ? ? ?<td ?valign="top"><font color="#003399" face="Verdana"><b><?php echo $products_name; ?></b></font></td>
? ? ? ? ? ?<td align="right" valign="top"><?php echo $products_price; ?></td>
<?php

$prod_quantity = $product_info['products_quantity'];

? ?$minus = ($prod_quantity == -1);

? $ordin = ($prod_quantity == -2);

$red = ($prod_quantity == -3);

? $yellow = ($prod_quantity == 10);

? $green = ?($prod_quantity == 100);?>

? ? ? <tr>

<td class="main"><br><?php

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? switch ($prod_quantity) { 

? ? ?case $minus: 
? ? ? ? ? ? ? ?	$img = tep_image(DIR_WS_ICONS . 'furgone.gif', TEXT_ARRIVO2).'<FONT COLOR=#0000ff><b> '.TEXT_ARRIVO.'</b></FONT>'; 
? ? ? ? ? ? ? ? ? ? ? ? ?// ?$img = '<FONT COLOR=#0000ff><b>'. TEXT_ARRIVO .'</b></FONT>';

? ? ? ? ? ? ? ? ? ? ? ? ? ?break; 

case $ordin: 

? ? ? ? ? ? ? ? ? ? ? ? ? ?$img = tep_image(DIR_WS_ICONS . 'prenota.gif', TEXT_ORDINABILE2).'<FONT COLOR=#CC00CC><b> '.TEXT_ORDINABILE.'</b></FONT>';
? ? ? ? ? ? ?//$img = '<FONT COLOR=#CC00CC><b>'. TEXT_ORDINABILE .'</b></FONT>';

? ? ? ? ? ? ? ? ? ? ? ? ? ?break; 

? ? ? ? ? ? ? ? ? ? ? ? ? ?case $red: 
? ? ? ? ? ? ?$img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE2).'<FONT COLOR=#ff0000><b> '.TEXT_NOT_AVAIBLE.'</b></FONT>';
? ? ? ? ? ? ? ? ? ? ? ? ? ?//$img = '<FONT COLOR=#ff0000><b>'. TEXT_NOT_AVAIBLE .'</b></FONT>';

? ? ? ? ? ? ? ? ? ? ? ? ? ?break; 

? ? ? ? ? ? ? ? ? ? ? ? ? ?case $yellow : 
? ? ? ? ? ? ?$img = tep_image(DIR_WS_ICONS . 'icon_status_yellow.gif', TEXT_FEW_QTY2).'<FONT COLOR=#ff9900><b> '.TEXT_FEW_QTY.'</b></FONT>';
? ? ? ? ? ? ? ? ? ? ? ? ? ?//$img = '<FONT COLOR=#ff9900><b>'. TEXT_FEW_QTY .'</b></FONT>';

? ? ? ? ? ? ? ? ? ? ? ? ? ?break;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? case $green : 
? ? ? ? ? ? ?$img = tep_image(DIR_WS_ICONS . 'icon_status_green.gif', TEXT_BIG_QTY2).'<FONT COLOR=#009900><b> '.TEXT_BIG_QTY .'</b></FONT>';
? ? ? ? ? ? ? ? ? ? ? ? ? ?//$img = '<FONT COLOR=#009900><b>'. TEXT_BIG_QTY .'</b></FONT>';

? ? ? ? ? ? ? ? ? ? ? ? ? ?break; 

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} 

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?echo TEXT_IN_STOCK ." " .$img;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??> ? ? 

? ? ? </td>

? ? ? </tr>

<?php

? ?> ? ? 
? ? ? ? </tr>
? ? ? ?</table></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td class="main">
<?php
? ?if (tep_not_null($product_info['products_image'])) {
?>
? ? ? ? ?<table border="0" cellspacing="8" cellpadding="2" align="right" width="30%">
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<tr>
? ? ? ? ? ?<td align="center" class="smalltext">
? ? ? <?php echo TEXT_telefono;?><br><b><?php echo TEXT_numtelefono;?></b><br><br>
? ? ? <a href="callto://centoasa"><img src="http://goodies.skype.com/graphics/skypeme_btn_small_blue.gif" border="0" alt="Skype me!"></a><br><br>
? ? ?<?php echo '<font face="Verdana" size="1"><a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info['products_id']) .'" ?target="_blank">' . tep_image('pdf/pdf.gif') .' download brochure</a></font>'; ?><br><br>
? ? ?<?php // ################### Ask a question ############## ?> ? ?
?<img height="19" src="images/ask_a_question.gif" width="21">
? <a href="ask_a_question.php?products_id=<?php echo $product_info['products_id']; ?>" ONMOUSEOVER="window.status='.<?php echo TEXT_QUESTION; ?> .'; return true">
? <?php echo TEXT_QUESTION;?>: <br><b><?php echo $product_info['products_name']; ?></b></a>
<?php // ################ end added ask a question ############ ?>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
? ? ? ? ? ? ?</td>
? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ?</table>
<?php
? ?}
?>
<!--<p><?php echo nl2br(stripslashes($product_info['products_description'])); ?></p>-->
? ? ? ? ?<p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
? ?$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) {
?>
? ? ? ? ?<table border="0" cellspacing="0" cellpadding="2">
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
? ? ? ? ? ?</tr>
<?php
? ? ?$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name 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 . "' order by popt.products_options_name");
? ? ?while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
? ? ? ?$products_options_array = array();
? ? ? ?$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
? ? ? ?while ($products_options = tep_db_fetch_array($products_options_query)) {
? ? ? ? ?$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
? ? ? ? ?if ($products_options['options_values_price'] != '0') {
? ? ? ? ? ?$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
? ? ? ? ?}
? ? ? ?}

? ? ? ?if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
? ? ? ? ?$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
? ? ? ?} else {
? ? ? ? ?$selected_attribute = false;
? ? ? ?}
?>
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
? ? ? ? ? ? ?<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
? ? ? ? ? ?</tr>
<?php
? ? ?}
?>
? ? ? ? ?</table>
<?php
? ?}
?>
? ? ? ?</td>
? ? ?</tr>
?	<?php
// DANIEL: begin

?$attributes = "select pop_products_id_slave, products_name, products_price, products_tax_class_id from " . TABLE_PRODUCTS_OPTIONS_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . " pa, ". TABLE_PRODUCTS . " pb WHERE pop_products_id_slave = pa.products_id and pa.products_id=pb.products_id and language_id = '" . (int)$languages_id . "' and pop_products_id_master = '".$HTTP_GET_VARS['products_id']."' and products_status=1 order by pop_order_id, pop_id";
?$attribute_query = tep_db_query($attributes);

?if (mysql_num_rows($attribute_query)>0) {
? ?echo '<tr><td><br><table class="productlisting">';
? ?echo '<tr><th align="left" class="productListing-heading"> '. TEXT_RELATIVI.' </th></tr>';
? ?while ($attributes_values = tep_db_fetch_array($attribute_query)) {
? ? ?$products_name_slave = ($attributes_values['products_name']);
? ? ?$products_id_slave = ($attributes_values['pop_products_id_slave']);
? ? ?$products_price_slave = $currencies->display_price($attributes_values['products_price'], tep_get_tax_rate($attributes_values['products_tax_class_id']));
? ?//	echo '<tr><td align="left" class="productListing-data"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">'.$products_name_slave.': </a><p align="right">'.$products_price_slave.' </td></tr></p> '; ? ?
? ? ? echo '<tr><td align="left" class="productListing-data"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '"><font face="Verdana" >'.$products_name_slave.': <b>'.$products_price_slave.'</b></a></font> </td></tr>';
? ?}
?echo '</table></td></tr>';
?}

//DANIEL: end

?>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
<?php 

$products_end_query = tep_db_query ("select expires_date from " . TABLE_SPECIALS . " where products_id = ". $HTTP_GET_VARS['products_id'] ." "); 

$products_end = tep_db_fetch_array($products_end_query); 
? ?if ($products_end['expires_date'] > date('Y-m-d H:i:s')) { 

?> 

? ? ?<tr> 

? ? ? ?<td align="center" class="main"><?php echo sprintf(TEXT_DATE_END, tep_date_long($products_end['expires_date'])); ?></td> 

? ? ?</tr> 

<?php 

? ?} ?>

</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><font face="Verdana" color="003399" size="1"><li><?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"><li><?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="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
? ? ?</tr>
<?php
? ?} else {
?>
? ? ?<tr>
? ? ? ?<td align="center" 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 width="102"><a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath); ?>"><?php echo tep_image_button('button_back.gif', IMAGE_BUTTON_BACK); ?></a></td>
<td width="168" align="right"><?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>
</td>
? ? ? ? ? ? ? ?<td class="main" align="right"><?php echo TEXT_QUANTITY . tep_draw_input_field('quantity', '1', 'SIZE=2 maxlength=2') . tep_draw_separator('pixel_trans.gif', '5', '1') . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle'); ?></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
//added for cross -sell
? if ( (USE_CACHE == 'true') && !SID) { 
? ?echo tep_cache_also_purchased(3600); 
? ? include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); ?><br>
? <?php
? } else { 
? ? include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); ?><br>
? <?php
? ? ?include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
? ?}
? }
?></td>

? ? ? ? ?</tr>
? ? ? ?</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 
$page_cache->end_page_cache();
require(DIR_WS_INCLUDES . 'application_bottom.php'); 
?>

 

 

 

first thing.

 

change this :

 

$product_check_query = tep_db_query("select pc.categories_id

from " . TABLE_PRODUCTS . " p,

" . TABLE_PRODUCTS_DESCRIPTION . " pd,

" . TABLE_PRODUCTS_TO_CATEGORIES . " pc

where p.products_status != '1' and

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

pd.products_id = p.products_id and

pd.products_id = pc.products_id and

pd.language_id = '" . (int)$languages_id . "'");

 

to this :

 

$product_check_query = tep_db_query("select categories_id

from " . TABLE_PRODUCTS_TO_CATEGORIES . "

where products_id = '" . (int)$_GET['products_id'] . "'");

 

 

that is enough to check if the product exists and will give the category id, no join needed.

 

 

change this :

 

 

if ($product_check = tep_db_fetch_array($product_check_query)) { // product exists but disabled

 

// then we do a query of the other products in the same category

// and we display them below using the product_listing module

$listing_sql = "select p.products_model,

pd.products_name,

p.products_image,

p.products_quantity,

p.products_id,

p.manufacturers_id,

p.products_price,

p.products_tax_class_id,

IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,

IF(s.status, s.specials_new_products_price, p.products_price) as final_price

from " . TABLE_PRODUCTS_DESCRIPTION . " pd,

" . TABLE_CATEGORIES . " c,

" . TABLE_PRODUCTS . " p left join

" . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id,

" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join

" . TABLE_SPECIALS . " s on p.products_id = s.products_id

where p.products_status = '1' and

p.products_id = p2c.products_id and

pd.products_id = p2c.products_id and

p2c.categories_id = c.categories_id and

c.categories_id = " . $product_check['categories_id'] . " and

pd.language_id = '" . (int)$languages_id . "'";

 

} else { // no, the product is totally absent, we are running out of options, so lets do a query anyway with a variation on the product id.

 

$wrong_id = $HTTP_GET_VARS['products_id'];

$size = strlen($wrong_id)-2;

$wrong_id = substr($wrong_id, 1,$size);

$listing_sql = "select p.products_model,

pd.products_name,

p.products_image,

p.products_quantity,

p.products_id,

p.manufacturers_id,

p.products_price,

p.products_tax_class_id,

IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,

IF(s.status, s.specials_new_products_price, p.products_price) as final_price

from " . TABLE_PRODUCTS_DESCRIPTION . " pd,

" . TABLE_CATEGORIES . " c,

" . TABLE_PRODUCTS . " p left join

" . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id,

" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join

" . TABLE_SPECIALS . " s on p.products_id = s.products_id

where p.products_status = '1' and

p.products_id = p2c.products_id and

pd.products_id = p2c.products_id and

p2c.categories_id = c.categories_id and

p.products_id like '%" . $wrong_id . "%' and

pd.language_id = '" . (int)$languages_id . "'";

}

?>

 

 

to this :

 

// then we do a query of the other products in the same category

// and we display it below using the product_listing module

$listing_sql = "select p.products_model,

pd.products_name,

p.products_image,

p.products_quantity,

p.products_id,

p.manufacturers_id,

m.manufacturers_name,

p.products_price,

p.products_tax_class_id,

IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,

IF(s.status, s.specials_new_products_price, p.products_price) as final_price

from " . TABLE_PRODUCTS_DESCRIPTION . " pd,

" . TABLE_CATEGORIES . " c,

" . TABLE_PRODUCTS . " p left join

" . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id,

" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join

" . TABLE_SPECIALS . " s on p.products_id = s.products_id

where p.products_status = '1' and

p.products_id = p2c.products_id and

pd.products_id = p2c.products_id and

p2c.categories_id = c.categories_id and

c.categories_id = " . $product_check['categories_id'] . " and

pd.language_id = '" . (int)$languages_id . "'";

 

} else { // no, the product is totally absent, so lets do a query anyway with a variation on the product id.

 

$wrong_id = $_GET['products_id'];

$wrong_id = substr($wrong_id, 0,2);

$listing_sql = "select p.products_model,

pd.products_name,

p.products_image,

p.products_quantity,

p.products_id,

p.products_price,

p.products_tax_class_id,

m.manufacturers_name,

p.manufacturers_id,

IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,

IF(s.status, s.specials_new_products_price, p.products_price) as final_price

from " . TABLE_PRODUCTS_DESCRIPTION . " pd,

" . TABLE_CATEGORIES . " c,

" . TABLE_PRODUCTS . " p left join

" . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id,

" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join

" . TABLE_SPECIALS . " s on p.products_id = s.products_id

where p.products_status = '1' and

p.products_id = p2c.products_id and

pd.products_id = p2c.products_id and

p2c.categories_id = c.categories_id and

p.products_id like '%" . $wrong_id . "%' and

pd.language_id = '" . (int)$languages_id . "'";

}

?>

 

try if that helps, otherwise we need to look at your module product_listing.php because it seems you added a product compare in there.

Treasurer MFC

Posted

Parse error: parse error, unexpected '}' in /web/htdocs/www.100asa.it/home/product_info.php on line 174

Skype: centoasa

Skype: remigioruberto

Posted
Parse error: parse error, unexpected '}' in /web/htdocs/www.100asa.it/home/product_info.php on line 174

 

check if you replaced it exactly like it. check the last } ?> of the sections so it does not read } } ?>

Treasurer MFC

Posted
check if you replaced it exactly like it. check the last } ?> of the sections so it does not read  } } ?>

 

 

my mistake , you have to keep this statement :

 

if ($product_check = tep_db_fetch_array($product_check_query)) { // product exists but disabled

Treasurer MFC

Posted

Ok, statement keeped!

But, when I found this page on Google (product don't exist) http://www.100asa.it/product_info.php?cPat...products_id=453

this is the result:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select p.products_model, pd.products_name, p.products_image, 

select count(p.products_id) as total select p.products_model, pd.products_name, p.products_image, p.products_quantity, p.products_id, p.products_price, p.products_tax_class_id, m.manufacturers_name, p.manufacturers_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, categories c, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_id like '%45%' and pd.language_id = '4'

[TEP STOP]

Skype: centoasa

Skype: remigioruberto

Posted
Ok, statement keeped!

But, when I found this page on Google (product don't exist) http://www.100asa.it/product_info.php?cPat...products_id=453

this is the result:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select p.products_model, pd.products_name, p.products_image, 

select count(p.products_id) as total select p.products_model, pd.products_name, p.products_image, p.products_quantity, p.products_id, p.products_price, p.products_tax_class_id, m.manufacturers_name, p.manufacturers_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, categories c, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_id like '%45%' and pd.language_id = '4'

[TEP STOP]

 

i see it, this is caused by the class split_page_results which does not seem to find the from statement in the query string

Treasurer MFC

Posted
i see it, this is caused by the class split_page_results which does not seem to find the from statement in the query string

 

this may be because of copy and pasting the query code.

Try to make the queries 1 long string and see if that helps.

 

the class normally takes everything starting from "from" and glues the "select count(p.products_id) as total" in front of it. But if it cannot find the "from" string in the query, it glues the "select count(p.products_id) as total" in front of the entire query which gives the error.

Treasurer MFC

Posted

Now I've this:

// then we do a query of the other products in the same category
// and we display it below using the product_listing module
$listing_sql = "select p.products_model, pd.products_name,p.products_image,p.products_quantity,p.products_id,p.manufactur
ers_id,m.manufacturers_name,p.products_price,p.products_tax_class_id,IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd," . TABLE_CATEGORIES . " c," . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.categories_id = " . $product_check['categories_id'] . " and pd.language_id = '" . (int)$languages_id . "'";
} else { // no, the product is totally absent, so lets do a query anyway with a variation on the product id.
$wrong_id = $_GET['products_id'];
$wrong_id = substr($wrong_id, 0,2);
$listing_sql = "select p.products_model, pd.products_name,p.products_image,p.products_quantity,p.products_id,p.products_p
rice,p.products_tax_class_id,m.manufacturers_name,p.manufacturers_id,IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd," . TABLE_CATEGORIES . " c," . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_id like '%" . $wrong_id . "%' and pd.language_id = '" . (int)$languages_id . "'"; 
}
?>

 

but, as you can see http://www.100asa.it/product_info.php?cPat...s_id=453&page=1

still don't work!!!

Skype: centoasa

Skype: remigioruberto

Posted
Now I've this:

// then we do a query of the other products in the same category
// and we display it below using the product_listing module
$listing_sql = "select p.products_model, pd.products_name,p.products_image,p.products_quantity,p.products_id,p.manufactur
ers_id,m.manufacturers_name,p.products_price,p.products_tax_class_id,IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd," . TABLE_CATEGORIES . " c," . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.categories_id = " . $product_check['categories_id'] . " and pd.language_id = '" . (int)$languages_id . "'";
} else { // no, the product is totally absent, so lets do a query anyway with a variation on the product id.
$wrong_id = $_GET['products_id'];
$wrong_id = substr($wrong_id, 0,2);
$listing_sql = "select p.products_model, pd.products_name,p.products_image,p.products_quantity,p.products_id,p.products_p
rice,p.products_tax_class_id,m.manufacturers_name,p.manufacturers_id,IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd," . TABLE_CATEGORIES . " c," . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_id like '%" . $wrong_id . "%' and pd.language_id = '" . (int)$languages_id . "'"; 
}
?>

 

but, as you can see http://www.100asa.it/product_info.php?cPat...s_id=453&page=1

still don't work!!!

 

good, what does the query look like that you make in index.php ?

 

In the stock install it looks like this :

 

{$listing_sql = "select " . $select_column_list . " p.products_quantity, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

did you change any of that ?

if not, what does your module product_listing look like now ?

Treasurer MFC

Posted
good, what does the query look like that you make in index.php ?

 

In the stock install it looks like this :

 

        {$listing_sql = "select " . $select_column_list . " p.products_quantity, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

did you change any of that ?

if not, what does your module product_listing look like now ?

 

in the meantime, also check this :

 

http://www.oscommerce.com/forums/index.php?showtopic=152085

Treasurer MFC

Posted
I've made change... try now

 

try this :

 

in product_info.php after this :

 

 

if ($product_check['total'] < 1) {

 

 

 

 

add this :

 

// create column list

$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,

'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,

'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,

'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,

'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,

'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,

'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,

'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

 

asort($define_list);

 

$column_list = array();

reset($define_list);

while (list($key, $value) = each($define_list)) {

if ($value > 0) $column_list[] = $key;

}

Treasurer MFC

Archived

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

×
×
  • Create New...