Attributi nel box novità

Questo forum è dedicato alle discussioni riguardanti le contribution per osCommerce

Moderatore: mod Generali

Rispondi
brains74
membro Junior
membro Junior
Messaggi: 4
Iscritto il: 15/04/2004, 0:00
Località: USA

Attributi nel box novità

Messaggio da brains74 »

Salve bella gente :lol: :D .
Avevo un quesito da porre.
Allora, avevo pensato di inserire nel box novità e nel box specials gli attributi del prodotto che viene scelto a caso e visualizzato dal sistema.
Partendo dal fatto che il codice di richiamo è questo:


$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']);

Avevo pensato che il problema fosse la stringa evidenziata ma a quanto pare non lo è.

C'è qualche anima buona che può darmi qualche consiglio?
Grazie anticipatamente ;)
Avatar utente
ciuski
membro Regular
membro Regular
Messaggi: 211
Iscritto il: 22/06/2005, 18:14
Località: www.tokimeki.it
Contatta:

Messaggio da ciuski »

il problema credo sia nella select precedente in quanto dovrebbe prendere anche il valore products_description dalla tabella products_description ma le mie reminiscenze di sql sono un po' vecchiotte
Immagine
Immagine
Avatar utente
ciuski
membro Regular
membro Regular
Messaggi: 211
Iscritto il: 22/06/2005, 18:14
Località: www.tokimeki.it
Contatta:

Messaggio da ciuski »

scusa ma che intendi per ATTRIBUTI del prodotto?

rispondi presto perchè in un modo ho risolto ma pensavo volessi far apparire la DESCRIZIONE nel box...quali sono gli attributi?
Immagine
Immagine
Avatar utente
ciuski
membro Regular
membro Regular
Messaggi: 211
Iscritto il: 22/06/2005, 18:14
Località: www.tokimeki.it
Contatta:

Messaggio da ciuski »

intanto ti dico quello che ho fatto per avere la descrizione nel box (anche se non so quanto possa servire...MA DIMMI QUALI SONO 'STI ATTRIBUTI!!!)

ho inserito nel file general.php nella cartella includes/functions la seguente parte di codice in fondo alla pagina

Codice: Seleziona tutto

//ROBA MIA
  function tep_get_products_description($product_id, $language = '') {
    global $languages_id;

    if (empty($language)) $language = $languages_id;

    $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'");
    $product = tep_db_fetch_array($product_query);

    return $product['products_description'];
  }
//FINE ROBA MIA
e nel file whats_new.php nella cartella includes/boxes ho modificato il codice in questo modo

Codice: Seleziona tutto

<?php
/*
  $Id: whats_new.php,v 1.31 2003/02/10 22:31:09 hpdl Exp $

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

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  if ($random_product = tep_random_select(" select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
?>
<!-- whats_new //-->
          <tr>
            <td>
<?php
    $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
    $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);
    $random_product['products_description'] = tep_get_products_description($random_product['products_id']);

    $info_box_contents = array();
    $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

    new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW));

	//TotalB2B start
    $random_product['products_price'] = tep_xppp_getproductprice($random_product['products_id']);
    //TotalB2B end

    if (tep_not_null($random_product['specials_new_products_price'])) {
	  
      //TotalB2B start
	  $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);
	  $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') {
		$whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price_nodiscount($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
	  } else {
		$whats_new_price = '<s>' . $currencies->display_price($random_product['products_id'], $random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
        $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price_nodiscount($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
	  }
      //TotalB2B end

    } else {
      $whats_new_price = $currencies->display_price($random_product['products_id'], $random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
    }

    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'center',
                                 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $random_product['products_description']. '</a><br>' . $whats_new_price);

    new infoBox($info_box_contents);
?>
            </td>
          </tr>
<!-- whats_new_eof //-->
<?php
  }
?>
ma voglio sapere tu cosa intendevi fare
Immagine
Immagine
Rispondi