Problema richiamo valore dalla tabella product nel file...

Postate qui discussioni di carattere generale riguardo a problemi di installazione e configurazione di osCommerce

Moderatore: mod Generali

Rispondi
sbronzo
membro Junior
membro Junior
Messaggi: 16
Iscritto il: 27/01/2006, 22:52

Problema richiamo valore dalla tabella product nel file...

Messaggio da sbronzo »

Ciao a tutti,
ho modificato il negozio in vodo da visualizzare il prezzo di listino dei prodotti e il prezzo fatto dal mio negozio, ho sistemato la vetrina e la pagina delle offerte, ma non riesco a sistemare il file product_listing.php .

Codice: Seleziona tutto

<?php
/*
  $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

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

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

  if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
    <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
  </tr>
</table>
<?php
  }

  $list_box_contents = array();

  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
    switch ($column_list[$col]) {
      case 'PRODUCT_LIST_MODEL':
        $lc_text = TABLE_HEADING_MODEL;
        $lc_align = '';
        break;
      case 'PRODUCT_LIST_NAME':
        $lc_text = TABLE_HEADING_PRODUCTS;
        $lc_align = '';
        break;
      case 'PRODUCT_LIST_MANUFACTURER':
        $lc_text = TABLE_HEADING_MANUFACTURER;
        $lc_align = '';
        break;
      case 'PRODUCT_LIST_PRICE':
        $lc_text = TABLE_HEADING_PRICE;
        $lc_align = 'right';
        break;
      case 'PRODUCT_LIST_QUANTITY':
        $lc_text = TABLE_HEADING_QUANTITY;
        $lc_align = 'right';
        break;
      case 'PRODUCT_LIST_WEIGHT':
        $lc_text = TABLE_HEADING_WEIGHT;
        $lc_align = 'right';
        break;
      case 'PRODUCT_LIST_IMAGE':
        $lc_text = TABLE_HEADING_IMAGE;
        $lc_align = 'center';
        break;
      case 'PRODUCT_LIST_BUY_NOW':
        $lc_text = TABLE_HEADING_BUY_NOW;
        $lc_align = 'center';
        break;
    }

    if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
      $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
    }

    $list_box_contents[0][] = array('align' => $lc_align,
                                    'params' => 'class="productListing-heading"',
                                    'text' => ' ' . $lc_text . ' ');
  }
  echo '
                             <table width="100%" cellspacing=0 cellpadding=0 style="border-left: 1px solid; border-right: 1px solid; border-top: 1px solid; border-bottom: 0px solid; border-color: #000000; text-align:center;">
                               <tr>
                                <td class="productListing-heading">Prodotti</td>
                               </tr>
                               </table>
';
   if (!isset($customer_id)) $customer_id = 0;
   $customer_group = tep_get_customers_groups_id();
  if ($listing_split->number_of_rows > 0) {
    $rows = 0;
    $counter = 0;
    $listing_query = tep_db_query($listing_split->sql_query);
    while ($listing = tep_db_fetch_array($listing_query)) {
    $product_contents = array();
      $rows++;

      if (($rows/2) == floor($rows/2)) {
        $list_box_contents[] = array('params' => 'class="productListing-even"');
      } else {
        $list_box_contents[] = array('params' => 'class="productListing-odd"');
      }

      $cur_row = sizeof($list_box_contents) - 1;

      for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
        $lc_align = '';

        switch ($column_list[$col]) {
          case 'PRODUCT_LIST_MODEL':
            $lc_align = '';
            $lc_text = ' ' . $listing['products_model'] . ' ';
            break;
         case 'PRODUCT_LIST_NAME':
            $lc_align = '';
            if (isset($HTTP_GET_VARS['manufacturers_id'])) {
              $lc_text = '<a class="M1" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
            } else {
              $lc_text = ' <a class="M1" href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
            }
            break;
          case 'PRODUCT_LIST_MANUFACTURER':
            $lc_align = '';
            $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
            break;
          case 'PRODUCT_LIST_PRICE':
            $lc_align = 'right';
			   
			//TotalB2B start
		    $listing['products_price'] = tep_xppp_getproductprice($listing['products_id']);
            //TotalB2B end

			//TotalB2B start
		    if ($new_price = tep_get_products_special_price($listing['products_id'])) {
              $listing['specials_new_products_price'] = $new_price;
			  $query_special_prices_hide = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key = 'SPECIAL_PRICES_HIDE'");
              $query_special_prices_hide_result = tep_db_fetch_array($query_special_prices_hide); 
              if ($query_special_prices_hide_result['configuration_value'] == 'true') {
			    $lc_text = '  <font color="red">' . $currencies->display_price_nodiscount($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</font> ';
	          } else {
			    $lc_text = ' <s><font color="red">' .  $currencies->display_price($listing['products_id'], $listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) .  $currencies->display_price($listing['products_id'], $listing['products_price_listing'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</font></s><br><span class="M1">' . $currencies->display_price_nodiscount($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
	    	          }
			//TotalB2B end
              
			} else {
              $lc_text = ' ' . $currencies->display_price($listing['products_id'], $listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
            }
            break;


           case 'PRODUCT_LIST_QUANTITY':
            $lc_align = 'center';
                                                 $prod_quantity = $listing['products_quantity'];
                                          $minus = ($prod_quantity <= 0);
                                                 $red = ($prod_quantity == NULL);
                                                 $yellow = ($prod_quantity <= QUANTITA_GIALLA);
                                                 $green =  ($prod_quantity > QUANTITA_GIALLA);
                                                 
                                                 switch ($prod_quantity) { 
                                                 case $minu: 
                            $img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ; 
                            break;  
                            case $red: 
                            $img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ; 
                            break; 
                            case $yellow : 
                            $img = tep_image(DIR_WS_ICONS . 'icon_status_yellow.gif', TEXT_FEW_QTY).'<br>'.TEXT_FEW_QTY ; 
                            break;
                                                 case $green : 
                            $img = tep_image(DIR_WS_ICONS . 'icon_status_green.gif', TEXT_BIG_QTY).'<br>'.TEXT_BIG_QTY ; 
                            break; 
                                                        } 
                                          $lc_text =  $img ;
            break;
          case 'PRODUCT_LIST_WEIGHT':
            $lc_align = 'right';
            $lc_text = ' ' . $listing['products_weight'] . ' ';
            break;
          case 'PRODUCT_LIST_IMAGE':
            $lc_align = 'center';
            if (isset($HTTP_GET_VARS['manufacturers_id'])) {
              $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
            } else {
              $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
            }
            break;
          case 'PRODUCT_LIST_BUY_NOW':
            $lc_align = 'center';
        if (tep_has_product_attributes($listing['products_id'])) {
          $lc_text = TEXT_HAVE_PRODUCTS;
	 } else {
           $lc_text = tep_draw_form('buy_now' . $listing['products_id'], tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']), 'POST') . TEXT_QTY . tep_draw_input_field('list_quantity', '1', 'SIZE=2 maxlength=2') .'   '. tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</form> ';
            }            
			break;
        }

        $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                               'params' => 'class="productListing-data"',
                                               'text'  => $lc_text);
          $product_contents[] = $lc_text;       
      }


if($counter==0){

echo '
                               <table width="100%" cellspacing=0 cellpadding=0 style="border-left: 1px solid; border-right: 1px solid; border-top: 1px solid; border-bottom: 1px solid; border-color: #000000;">
                               <td width="100" valign="absmiddle" align="center">
                                    <table cellspacing=3 cellpadding=0>
                                    <tr><td valign="absmiddle" align="center">'.$product_contents[0].'</td></tr>
                                    </table>
                                    </td>
                                <td >
                                    <table width="100%" cellspacing=3 cellpadding=0>
                                     <tr><td class="M1" align="center">'.$product_contents[1].'</td></tr>
                                    </table>
                                    <table cellspacing=3 cellpadding=0>
                                     <tr>
                                     <td class="M3" align="center" width="150">'.$product_contents[2].'</td>
                                     <td class="M2" align="right" width="200">'. 'Scalaridotta.com: ' . ' '.$currencies->display_price($listing['products_id'], $listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</font><br><span class="M2">' .'</td>
 									 <td class="M2" align="right" width="200">'. 'Prezzo di Listino: ' . ' '.$currencies->display_price($listing['products_id'], $listing['products_price_listing'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</font><br><span class="M2">' .'</td>
                                    </tr>
                                    </table>     
                   </td></tr>
                  </table>
         ';

	 } else {

echo '
                               <table width="100%" cellspacing=0 cellpadding=0 style="border-left: 1px solid; border-right: 1px solid; border-top: 0px solid; border-bottom: 1px solid; border-color: #000000;">
                               <td width="100" valign="absmiddle" align="center">
                                    <table cellspacing=3 cellpadding=0>
                                    <tr><td valign="absmiddle" align="center">'.$product_contents[0].'</td></tr>
                                    </table>
                                    </td>
                                <td >
                                    <table width="100%" cellspacing=3 cellpadding=0>
                                     <tr><td class="M1" align="center">'.$product_contents[1].'</td></tr>
                                    </table>
                                    <table cellspacing=3 cellpadding=0>
                                     <tr>
                                     <td class="M3" align="center" width="150">'.$product_contents[2].'</td>
                                     <td class="M2" align="right" width="200">'. 'Scalaridotta.com: ' . '  '.$currencies->display_price($listing['products_id'], $listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</font><br><span class="M2">' .'</td>
 									 <td class="M2" align="right" width="200">'. 'Prezzo di Listino: ' . ' '.$currencies->display_price($listing['products_id'], $listing['products_price_listing'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</font><br><span class="M2">' .'</td>
                                    </tr>
                                    </table>     
                   </td></tr>
                  </table>
         ';
    }
  $counter++;
    }

    //new productListingBox($list_box_contents);
  } else {
    $list_box_contents = array();

    $list_box_contents[0] = array('params' => 'class="productListing-odd"');
    $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                   'text' => TEXT_NO_PRODUCTS);

    new productListingBox($list_box_contents);
  }

  if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
    <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
  </tr>
</table>
<?php
  }
?>
con il codice cosi corretto mi si visualizzano i due prezzi, quello fatto dal negozio è ok, nentre quello di listino mi esce sempre il valore €0.00
il mio dubbio è che manca qualcosa che va a leggere dalla tabella...
qualcuno riesce ad aiutarmi...

GRAZIE

P.S.

www.scalaridotta.com/catalog (qui ci sono i due prezzi corretti)
http://www.scalaridotta.com/catalog/ind ... Path=30_40 (qui uno solo va bene)
Rispondi