Aiuto Libreria on-lin
Inviato: 28/02/2006, 1:42
da pedroxx
Salve a tutti,
da circa un paio di mesi sto sviluppando questo sito
www.editoriaindipendente.it
Trattasi di una libreria on-line.
Dovendo aggiungere tabelle e ricerche relative ad Autori, Collane e Editori, ho moltiplicato con la contrib 2nd Manufacturer i campi che mi interessavano.
Ora il mio problema è richiamare nella pagina product_info le informazioni sul libro in modo che l'utente, cliccano sull'autore possa vedere tutti i libri scritti da quell'autore o pubblicati da quell'editore o inseriti in una determinata collana.
Qualcuno mi può aiutare?
paolo
Re: Aiuto Libreria on-lin
Inviato: 28/02/2006, 2:53
da marcus
pedroxx ha scritto:Salve a tutti,
da circa un paio di mesi sto sviluppando questo sito
www.editoriaindipendente.it
Trattasi di una libreria on-line.
Dovendo aggiungere tabelle e ricerche relative ad Autori, Collane e Editori, ho moltiplicato con la contrib 2nd Manufacturer i campi che mi interessavano.
Ora il mio problema è richiamare nella pagina product_info le informazioni sul libro in modo che l'utente, cliccano sull'autore possa vedere tutti i libri scritti da quell'autore o pubblicati da quell'editore o inseriti in una determinata collana.
Qualcuno mi può aiutare?
paolo
Puoi scrivere delle semplici queries che listino tutti i libri scritti da un autore o pubblicati da un editore o inseriti in una collana, in base ai vari autore_id, collana_id etc etc associati al prodotto.
Marcus
Aiuto Libreria on-lin
Inviato: 28/02/2006, 9:59
da pedroxx
Il mio codice è questo. Vorrei creare una quary che eseguisse una ricerca nel db, tra autori e editori e collane e che mi desse come output la pagina avanced_search_results.php . Presumo che la cosa si possa fare postando la variabile authors_id e linkando FILENAME_ADVANCED_SEARCH_RESULTS ma non riesco a scrivere il codice.
Mi puoi dare una mano?
<?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="<?php echo CELLPADDING_SUB;?>">
<?php
if ($product_check['total'] < 1) {
?>
<tr>
<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="0" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<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_template_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_description.products_name, products_description.products_description, products.products_model, products.products_quantity, products.products_image, products_description.products_url, products.products_price, products.products_tax_class_id, products.products_date_added, products.products_date_available, products.manufacturers_id, manufacturers.manufacturers_name, authors.authors_name, collection.collection_name FROM products LEFT JOIN manufacturers ON products.manufacturers_id = manufacturers.manufacturers_id LEFT JOIN authors ON products.authors_id = authors.authors_id LEFT JOIN collection ON products.collection_id = collection.collection_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 = 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 = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}
if (tep_not_null($product_info['products_model'])) {
} else {
$products_name = $product_info['products_name'] . '<br></br><span class="smallText">Autore: ' . $product_info['authors_name'] . '</span>' . '<br><span class="smallText">Editore: ' . $product_info['manufacturers_name'] . '<br><span class="smallText">Collana: ' . $product_info['collection_name'] . '</span>';
}
?>
<?php
// BOF: WebMakers.com Added: Show Featured Products
if (SHOW_HEADING_TITLE_ORIGINAL=='yes') {
$header_text = ' ';
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}else{
$header_text = $products_name .'</td><td background="' . DIR_WS_TEMPLATES . TEMPLATE_NAME . '/images/infobox/background.gif" align="right" class="productlisting-headingPrice">' . tep_draw_separator('pixel_trans.gif', '100%', '4') . $products_price;
}
?>
<?php
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_top(false, false, $header_text);
}
// EOF: Lango Added for template MOD
?>
<tr>
<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
<table border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td align="center" class="smallText">
<!-- // BOF MaxiDVD: Modified For Ultimate Images Pack! //-->
<?php
if ($product_info['products_image_med']!='') {
$new_image = $product_info['products_image_med'];
$image_width = MEDIUM_IMAGE_WIDTH;
$image_height = MEDIUM_IMAGE_HEIGHT;
} else {
$new_image = $product_info['products_image'];
$image_width = SMALL_IMAGE_WIDTH;
$image_height = SMALL_IMAGE_HEIGHT;}?>
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'] . '&image=0') . '\\\')">' . tep_image(DIR_WS_IMAGES . $new_image, addslashes($product_info['products_name']), $image_width, $image_height, 'hspace="5" vspace="5"') . '<br>' . tep_template_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'; ?>');
//--></script>
<!-- // EOF MaxiDVD: Modified For Ultimate Images Pack! //-->
</td>
</tr>
</table>
<?php
}
// START: Extra Fields Contribution
$extra_fields_query = tep_db_query("
SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value
FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef
LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf
ON ptf.products_extra_fields_id=pef.products_extra_fields_id
WHERE ptf.products_id=".$products_id." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')
ORDER BY products_extra_fields_order");
while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
echo '<b>'.$extra_fields['name'].': </b>';
echo $extra_fields['value'].'<BR>';
}
// END: Extra Fields Contribution
?>
<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_sort_order");
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 . "' order by pa.products_options_sort_order");
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
// BOF MaxiDVD: Modified For Ultimate Images Pack!
if (ULTIMATE_ADDITIONAL_IMAGES == 'enable') { include(DIR_WS_MODULES . 'additional_images.php'); }
// BOF MaxiDVD: Modified For Ultimate Images Pack!
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
?>
<tr>
<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
if (tep_not_null($product_info['products_url'])) {
?>
<tr>
<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
<tr>
<td align="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
}
?>
<?php
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_bottom();
}
// EOF: Lango Added for template MOD
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_template_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_template_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form></td>
<!-- Begin Wishlist Code -->
<td align="right" class="main"><?php if (tep_session_is_registered('customer_id')) echo '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' . tep_image_button('button_add_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td>
<!-- End Wishlist Code -->
<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
//Commented for x-sell
// if ((USE_CACHE == 'true') && empty($SID)) {
// echo tep_cache_also_purchased(3600);
// } else {
// include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
// }
// }
//Added for x sell
if ( (USE_CACHE == 'true') && !SID) {
echo tep_cache_also_purchased(3600);
include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);
} else {
include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS_BUYNOW);
echo tep_draw_separator('pixel_trans.gif', '100%', '10');
include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
}
?>
</td>
</tr>
</table>
risolto
Inviato: 01/03/2006, 17:52
da pedroxx
Grazie lo stesso.
Ho risolto in maniera egregia duplicando il box manufacturer_info.
Adesso il sito è praticamente completo.
Grazie a tutti
www.editoriaindipendente.it