Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

'Add to cart' showing empty shopping cart


yesitshere

Recommended Posts

Try changing

if($product_info['products_quantity'] <= 0 || $product_info['products_status']==0) {

to

if($products_new['products_quantity'] <= 0 || $products_new['products_status']==0)  {

 

you will also need to add the code to pull the info its basing the button off from the database

 

change

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

to

 $products_new_query_raw = "select p.products_id, p.products_status, p.products_quantity, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

 

all that this is doing is adding p.products_status, p.products_quantity to the query.

 

Just a hunch, may or may not fix it

Edited by Jonojamesmac
Link to comment
Share on other sites

change

<?php
/*
 $Id: specials.php,v 1.49 2003/06/09 22:35:33 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SPECIALS);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SPECIALS));
?>
<!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 TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</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" cellspacing="0" cellpadding="0">
 <tr>
   <td class="col_left">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </td>
<!-- body_text //-->
   <td width="100%" class="col_center">

<?php   /*  require(DIR_WS_BOXES . 'panel_top.php');  */  ?>

<? tep_draw_heading_top();?>

<? new contentBoxHeading_ProdNew($info_box_contents);?>

<? tep_draw_heading_top_3();?>		

<?php
 $specials_query_raw = "select p.products_id, p.products_status, p.products_quantity, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";
 $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '2'))) {
?>
<?php echo tep_draw_result_top_1(); ?>        
	<table border="0" width="100%" cellspacing="0" cellpadding="0" class="result box_width_cont">
         <tr>
           <td><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
           <td class="result_right"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
         </tr>
       </table>
<?php echo tep_draw_result_bottom_1(); ?>        
<?php echo tep_draw_result_top(); ?>

<?php
 }
?>

<?php
   $row = 0;
   $specials_query = tep_db_query($specials_split->sql_query);

 $row = 0;
 $col = 0;
 $info_box_contents = array();
  while ($specials = tep_db_fetch_array($specials_query)) {
   $specials['products_name'] = tep_get_products_name($specials['products_id']);
// ----------	
$product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$specials['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
$product = tep_db_fetch_array($product_query);
$p_desc = substr(strip_tags($product['products_description']), 0, MAX_DESCR_1);
$p_id = $product['products_id'];

$p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

$p_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' .$specials['products_name'] . '</a>';

$p_price = '<span class="productSpecialPrice">'.$currencies->display_price($specials['specials_new_products_price'],'').'</span> <s>'.$currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])).'</s>';

// ----------

if($products_new['products_quantity'] <= 0 || $products_new['products_status']==0)  {

$linkbutton =  tep_image_button('button_out_of_stock.gif'); 
}
else
{
$linkbutton = '<a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart1.gif').'</a>'; 
}

// ----------	
   $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => ' style="width:50%;"',
                                          'text' => '
           <table cellpadding="0" cellspacing="0" border="0" style="height:154px">
               <tr>
                 <td>
                       <table cellpadding="0" cellspacing="0" border="0" style="height:35px ">
                           <tr>
                               <td>'.tep_image(DIR_WS_IMAGES.'q1.gif').'</td>
                               <td class="bg5">'.$p_name.'</td>
                               <td>'.tep_image(DIR_WS_IMAGES.'q2.gif').'</td>
                           </tr>
                       </table> 
					<table cellpadding="0" cellspacing="0" border="0" class="bg7" style="height:109px "><tr><td>
                     <table cellpadding="0" cellspacing="0" border="0">
                           <tr>
                             <td class="vam">
                                   <br style="line-height:2px">
									<table cellpadding="0" cellspacing="0" border="0" style="width:104px">
										<tr><td align="center">'.$p_pic.'</td></tr>
									</table>
								</td>
                               <td width="100%">
                                   <table cellpadding="0" cellspacing="0" border="0" style="width:133px">
                                       <tr>
                                           <td style="height:88px " class="vam">'.$p_desc.'</td>
                                       </tr>
                                   </table> 
                               </td>
                               <td class="bg8">'.tep_draw_separator('spacer.gif', '1', '1').'</td>
                           </tr>
                       </table>


                     <table cellpadding="0" cellspacing="0" border="0" style="height:29px ">
                           <tr>
                             	<td align="center" class="vam">'.$p_price.'</td>
                               <td class="vam" style="white-space:nowrap;height:21px">
                                   <table cellpadding="0" cellspacing="0" border="0">
                                       <tr>

<td width="100%">' . $linkbutton . ''.tep_image(DIR_WS_IMAGES.'z6.gif').'<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a></td><td>'.tep_draw_separator('spacer.gif', '5', '1').'</td>

<td>'.tep_draw_separator('spacer.gif', '5', '1').'</td>
                                       </tr>
                                   </table> 
                               </td>
                               <td class="bg8">'.tep_draw_separator('spacer.gif', '1', '1').'</td>
                           </tr>
                       </table> 

					</td></tr></table>
                       <table cellpadding="0" cellspacing="0" border="0">
                           <tr>
                               <td>'.tep_image(DIR_WS_IMAGES.'q3.gif').'</td>
                               <td class="bg6">'.tep_draw_separator('spacer.gif', '1', '1').'</td>
                               <td>'.tep_image(DIR_WS_IMAGES.'q4.gif').'</td>
                           </tr>
                       </table> 
                 </td>
               </tr>
           </table> 
			');

   $col ++;
   if ($col > 1) {
     $col = 0;
     $row ++;
   }
 }

 new contentBox($info_box_contents);

?>

<?php echo tep_draw_result_bottom(); ?>

<?php
 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
<?php echo tep_draw_result_top_2(); ?>        
    	<table border="0" cellspacing="0" cellpadding="0" class="result box_width_cont">
         <tr>
           <td><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
           <td class="result_right"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
         </tr>
       </table>
<?php echo tep_draw_result_bottom_2(); ?>                
<?php
 }
?>

<? tep_draw_heading_bottom_3();?>   

<? tep_draw_heading_bottom();?>

</td>
<!-- body_text_eof //-->
   <td class="col_right">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //--></body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

if($products_new['products_quantity'] <= 0 || $products_new['products_status']==0) {

change to

if($specials['products_quantity'] <= 0 || $specials['products_status']==0) {

 

I did explain above your post, but you may not have seen it.

 

Thanks so so much, I thought I changed it, although I went over several times your comments, I must have missed it.

 

What I still need to change is: advanced_search_result.php and the standard homepage php file, but i'm not sure which one it is.

 

(I mean to say the page that deals with the products that randomly show up on the homepage).

 

 

PS: let me know if I can help you with anything else.

 

I'm pretty good in the travel sector.

Link to comment
Share on other sites

Shoot,

 

this Advanced search, has a completely different way of working then products new and specials, I don't find anything to replace... :(

 

 

Here below the code:

 

Thanks again so much !!!

 

<?php
/*
 $Id: advanced_search_result.php,v 1.72 2003/06/23 06:50:11 project3000 Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADVANCED_SEARCH);

 $error = false;

 if ( (isset($HTTP_GET_VARS['keywords']) && empty($HTTP_GET_VARS['keywords'])) &&
      (isset($HTTP_GET_VARS['dfrom']) && (empty($HTTP_GET_VARS['dfrom']) || ($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING))) &&
      (isset($HTTP_GET_VARS['dto']) && (empty($HTTP_GET_VARS['dto']) || ($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING))) &&
      (isset($HTTP_GET_VARS['pfrom']) && !is_numeric($HTTP_GET_VARS['pfrom'])) &&
      (isset($HTTP_GET_VARS['pto']) && !is_numeric($HTTP_GET_VARS['pto'])) ) {
   $error = true;

   $messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);
 } else {
   $dfrom = '';
   $dto = '';
   $pfrom = '';
   $pto = '';
   $keywords = '';

   if (isset($HTTP_GET_VARS['dfrom'])) {
     $dfrom = (($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dfrom']);
   }

   if (isset($HTTP_GET_VARS['dto'])) {
     $dto = (($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dto']);
   }

   if (isset($HTTP_GET_VARS['pfrom'])) {
     $pfrom = $HTTP_GET_VARS['pfrom'];
   }

   if (isset($HTTP_GET_VARS['pto'])) {
     $pto = $HTTP_GET_VARS['pto'];
   }

   if (isset($HTTP_GET_VARS['keywords'])) {
     $keywords = $HTTP_GET_VARS['keywords'];
   }

   $date_check_error = false;
   if (tep_not_null($dfrom)) {
     if (!tep_checkdate($dfrom, DOB_FORMAT_STRING, $dfrom_array)) {
       $error = true;
       $date_check_error = true;

       $messageStack->add_session('search', ERROR_INVALID_FROM_DATE);
     }
   }

   if (tep_not_null($dto)) {
     if (!tep_checkdate($dto, DOB_FORMAT_STRING, $dto_array)) {
       $error = true;
       $date_check_error = true;

       $messageStack->add_session('search', ERROR_INVALID_TO_DATE);
     }
   }

   if (($date_check_error == false) && tep_not_null($dfrom) && tep_not_null($dto)) {
     if (mktime(0, 0, 0, $dfrom_array[1], $dfrom_array[2], $dfrom_array[0]) > mktime(0, 0, 0, $dto_array[1], $dto_array[2], $dto_array[0])) {
       $error = true;

       $messageStack->add_session('search', ERROR_TO_DATE_LESS_THAN_FROM_DATE);
     }
   }

   $price_check_error = false;
   if (tep_not_null($pfrom)) {
     if (!settype($pfrom, 'double')) {
       $error = true;
       $price_check_error = true;

       $messageStack->add_session('search', ERROR_PRICE_FROM_MUST_BE_NUM);
     }
   }

   if (tep_not_null($pto)) {
     if (!settype($pto, 'double')) {
       $error = true;
       $price_check_error = true;

       $messageStack->add_session('search', ERROR_PRICE_TO_MUST_BE_NUM);
     }
   }

   if (($price_check_error == false) && is_float($pfrom) && is_float($pto)) {
     if ($pfrom >= $pto) {
       $error = true;

       $messageStack->add_session('search', ERROR_PRICE_TO_LESS_THAN_PRICE_FROM);
     }
   }

   if (tep_not_null($keywords)) {
     if (!tep_parse_search_string($keywords, $search_keywords)) {
       $error = true;

       $messageStack->add_session('search', ERROR_INVALID_KEYWORDS);
     }
   }
 }

 if (empty($dfrom) && empty($dto) && empty($pfrom) && empty($pto) && empty($keywords)) {
   $error = true;

   $messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);
 }

 if ($error == true) {
   tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false));
 }

 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, tep_get_all_get_params(), 'NONSSL', true, false));
?>
<!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; ?>">
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</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="0" cellpadding="0">
 <tr>
 	<td class="col_left">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</td>
<!-- body_text //-->
   <td width="100%" class="col_center"><table border="0" width="100%" cellspacing="0" cellpadding="0">







     <tr>
       <td>

<?php tep_draw_heading_top();?>

<?php
// 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;
 }

 $select_column_list = '';

 for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
   switch ($column_list[$i]) {
     case 'PRODUCT_LIST_MODEL':
       $select_column_list .= 'p.products_model, ';
       break;
     case 'PRODUCT_LIST_MANUFACTURER':
       $select_column_list .= 'm.manufacturers_name, ';
       break;
     case 'PRODUCT_LIST_QUANTITY':
       $select_column_list .= 'p.products_quantity, ';
       break;
     case 'PRODUCT_LIST_IMAGE':
       $select_column_list .= 'p.products_image, ';
       break;
     case 'PRODUCT_LIST_WEIGHT':
       $select_column_list .= 'p.products_weight, ';
       break;
   }
 }

 $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_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 ";

 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   $select_str .= ", SUM(tr.tax_rate) as tax_rate ";
 }

 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";

 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   if (!tep_session_is_registered('customer_country_id')) {
     $customer_country_id = STORE_COUNTRY;
     $customer_zone_id = STORE_ZONE;
   }
   $from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }

 $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";



 $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 if (isset($HTTP_GET_VARS['categories_id']) && tep_not_null($HTTP_GET_VARS['categories_id'])) {
   if (isset($HTTP_GET_VARS['inc_subcat']) && ($HTTP_GET_VARS['inc_subcat'] == '1')) {
     $subcategories_array = array();
     tep_get_subcategories($subcategories_array, $HTTP_GET_VARS['categories_id']);

     $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";

     for ($i=0, $n=sizeof($subcategories_array); $i<$n; $i++ ) {
       $where_str .= " or p2c.categories_id = '" . (int)$subcategories_array[$i] . "'";
     }

     $where_str .= ")";
   } else {
     $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";
   }
 }

 if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
   $where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
 }

 if (isset($search_keywords) && (sizeof($search_keywords) > 0)) {
   $where_str .= " and (";
   for ($i=0, $n=sizeof($search_keywords); $i<$n; $i++ ) {
     switch ($search_keywords[$i]) {
       case '(':
       case ')':
       case 'and':
       case 'or':
         $where_str .= " " . $search_keywords[$i] . " ";
         break;
       default:
         $keyword = tep_db_prepare_input($search_keywords[$i]);
         $where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.manufacturers_name like '%" . tep_db_input($keyword) . "%'";
         if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
         $where_str .= ')';
         break;
     }
   }
   $where_str .= " )";
 }

 if (tep_not_null($dfrom)) {
   $where_str .= " and p.products_date_added >= '" . tep_date_raw($dfrom) . "'";
 }

 if (tep_not_null($dto)) {
   $where_str .= " and p.products_date_added <= '" . tep_date_raw($dto) . "'";
 }

 if (tep_not_null($pfrom)) {
   if ($currencies->is_set($currency)) {
     $rate = $currencies->get_value($currency);

     $pfrom = $pfrom / $rate;
   }
 }

 if (tep_not_null($pto)) {
   if (isset($rate)) {
     $pto = $pto / $rate;
   }
 }

 if (DISPLAY_PRICE_WITH_TAX == 'true') {
   if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= " . (double)$pfrom . ")";
   if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= " . (double)$pto . ")";
 } else {
   if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) >= " . (double)$pfrom . ")";
   if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) <= " . (double)$pto . ")";
 }

 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   $where_str .= " group by p.products_id, tr.tax_priority";
 }

 if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
   for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
     if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
       $HTTP_GET_VARS['sort'] = $i+1 . 'a';
       $order_str = ' order by pd.products_name';
       break;
     }
   }
 } else {
   $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
   $sort_order = substr($HTTP_GET_VARS['sort'], 1);
   $order_str = ' order by ';
   switch ($column_list[$sort_col-1]) {
     case 'PRODUCT_LIST_MODEL':
       $order_str .= "p.products_model " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
       break;
     case 'PRODUCT_LIST_NAME':
       $order_str .= "pd.products_name " . ($sort_order == 'd' ? "desc" : "");
       break;
     case 'PRODUCT_LIST_MANUFACTURER':
       $order_str .= "m.manufacturers_name " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
       break;
     case 'PRODUCT_LIST_QUANTITY':
       $order_str .= "p.products_quantity " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
       break;
     case 'PRODUCT_LIST_IMAGE':
       $order_str .= "pd.products_name";
       break;
     case 'PRODUCT_LIST_WEIGHT':
       $order_str .= "p.products_weight " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
       break;
     case 'PRODUCT_LIST_PRICE':
       $order_str .= "final_price " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
       break;
   }
 }

 $listing_sql = $select_str . $from_str . $where_str . $order_str;

 require(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
?>

<br style="line-height:1px;"><br style="line-height:10px;">
		<table cellpadding="0" cellspacing="0" border="0" align="center">
			<tr><td align="right" width="100%"><?php echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(array('sort', 'page')), 'NONSSL', true, false) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
			<td><?php echo tep_draw_separator('spacer.gif', '10', '1'); ?></td>
			</tr>

		</table>
<br style="line-height:1px;"><br style="line-height:9px;">

<!-- body_text_eof //-->

<?php tep_draw_heading_bottom_3();?>

<?php tep_draw_heading_bottom();?>

	</table>
</form></td>

<!-- body_text_eof //-->
   <td class="col_right">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //--></body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

add the bits on this line

$select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_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 ";

you already made the other changes in product_listing.php if not, find includes/modules/product_listing.php and make the other changes there.

 

The variable in product_listing.php is $listing['products_status'] and $listing['products_quantity']

 

For your index file, paste it here and let me see.

Edited by Jonojamesmac
Link to comment
Share on other sites

thank you again.

 

So the only change in search result is pushing in those two =

 

$select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, p.products_status, p.products_quantity, pd.products_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 ";

 

Now it doesn't show that they are out of stock, see http://kosherdiscount.eu/advanced_search_r...p?keywords=test the product zero stock is my 0 stock test.

 

 

My homepage is temporarily http://kosherdiscount.eu/index3.php , as the regular homepage is a landings page for google adds, and i didn't want people on it before the opening.

 

PS: off course all links starting with ...icount.eu/index.php/.... will not work for the moment.

Link to comment
Share on other sites

in product_listing.php

change

if($products_new['products_quantity'] <= 0 || $products_new['products_status']==0) {

to

if($listing['products_quantity'] <= 0 || $listing['products_status']==0) {

 

This should change all your listings except possibly your front page, what are the products that appear on the frontpage? New? Upcoming? or random?

Link to comment
Share on other sites

Hi thanks, I updated it.

 

the frontpage didnt change yet.

 

The order on the homepage is NEW I think, but wouldn't mind random.

 

Maybe the search result changed, but it doesnt show any results, in other words, it doesnt say nothing found, but its just blank....

 

I've tried to copy the unedited search result back on the site, but it doesnt help.

 

I've uploaded my site (not sql), so that it might be much easier to see whatever the problem might be.

 

Its in a self extracting rar format

 

*** edited, will send the link to you in private message

 

thank you so so much

Edited by yesitshere
Link to comment
Share on other sites

May I ask in this thread? Since I've got the same problem.

 

This is my website: http://www.dollwhy.com/shop/

 

The "Add to Cart" button in product_info.php is not working. When I clicked 'add to cart', it brought me to empty cart (it worked fine with AppServ in my computer, but when I upload, it doesn't work. I don't know why).

Though in product_listing.php the 'buy now' button is working fine.

 

This is the code I added to product_info.php (with mod),

 

<!--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_out_of_stock.gif', 'Sold Out', IMAGE_BUTTON_SOLD_OUT);
 }
?>
               <td colspan="2" align="center"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . $submit_button; ?></td>
<!--End Sold Out--></td>

 

Could anyone help? Thank you in advance.

Edited by raykit
Link to comment
Share on other sites

May I ask in this thread? Since I've got the same problem.

 

This is my website: http://www.dollwhy.com/shop/

 

The "Add to Cart" button in product_info.php is not working. When I clicked 'add to cart', it brought me to empty cart (it worked fine with AppServ in my computer, but when I upload, it doesn't work. I don't know why).

Though in product_listing.php the 'buy now' button is working fine.

 

This is the code I added to product_info.php (with mod),

 

<!--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_out_of_stock.gif', 'Sold Out', IMAGE_BUTTON_SOLD_OUT);
 }
?>
               <td colspan="2" align="center"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . $submit_button; ?></td>
<!--End Sold Out--></td>

 

Could anyone help? Thank you in advance.

 

Try and replace

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . $submit_button; ?>

with

<a href="<? echo tep_href_link("products_info.php","action=buy_now&products_id=".$p_id).'">'.$submit_button; ?></a>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...