woodde Posted January 19, 2012 Posted January 19, 2012 Hello I created a page that shows a table based list of all products in my shop with some needed informations (prices, quantity, ...). Now i need to add also the attributes / options of the products to this list. <?php require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <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"> <?php require('static_preislisten.php'); ?> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <?php $tableheadermenu = ('<table border="0" width="" cellspacing="0" cellpadding="2" align="center"> <tr bgcolor="#ffcc00"> <!--- 1 ---><td valign="top" class="head">P.ID</td> <!--- 2 ---><td valign="top" class="head">Art. Nr</td> <!--- 8 ---><td valign="top" class="head">Art. Nr</td> <!--- 3 ---><td width="" valign="top" class="head">Bild</td> <!--- 4 ---><td valign="top" class="head">Name</td> <!--- 5 ---><td valign="top" class="head">m³</td> <!--- 6 ---><td valign="top" class="head">EK USD</td> <!--- 7 ---><td valign="top" class="head" id="ek_netto">EK Netto</td> <!--- 10 ---><td valign="top" class="head" id="">Transp. Pausch.</td> <!--- 11 ---><td valign="top" class="head" id="vk_brutto">VK Brutto</td> <!--- 15 ---><td valign="top" class="head" id="">Am Lager</td> </tr>'); ?> <!-- body //--> <table border="0" width="" cellspacing="0" cellpadding="0" class="" align=""> <tr> <!-- body_text //--> <td width="" valign="top" class="" rowspan="2"><table border="0" width="" cellspacing="0" cellpadding="0" class=""> <?php $products_new_array = array(); $products_new_query_raw = "select * from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.adb_hersteller = '3' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.adb_hersteller, p.products_model ASC"; $products_new_split = new splitPageResults($products_new_query_raw, '5000'); if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?> <tr> <td><table border="0" width="" cellspacing="0" cellpadding="5" class="shownproducts" align="center" bgcolor="#cccccc"> <tr> <td class="shownproducts" align="center"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> <tr> <td class="shownproducts" align="center"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td> </tr> </table><br><br></td> </tr> <?php } ?> <tr> <td> <?php echo $tableheadermenu; ?> <?php if ($products_new_split->number_of_rows > 0) { $products_new_query = tep_db_query($products_new_split->sql_query); while ($products_new = tep_db_fetch_array($products_new_query)) { ?> <tr <?php if (($products_new['adb_pricelist_2011']) == '0') {echo $inaktuellerpreisliste;} ?>> <!--- 1 ---> <td class="listtext" align="center" valign="middle"<?php if ( $products_new['products_status'] == 1 ) {echo $status_1;} else { echo $status_0; } ?>><?php echo ($products_new['products_id']); ?></td> <!--- 2 ---> <td valign="top" class="listtext"><?php echo ($products_new['products_model']); ?></td> <!--- 8 ---> <td valign="top" class="listtext"><?php echo ($products_new['vendors_prod_id']); ?></td> <!--- 3 ---> <td width="" valign="top" class="listtext"><?php echo tep_image(DIR_WS_IMAGES_THUMB . $products_new['products_image'], $products_new['products_name'], '100', '100', 'class=""'); ?></td> <!--- 4 ---> <td valign="top" class="listtext"><!--- <?php echo $products_new['products_name']; ?> ---><?php echo $products_new['adb_hersteller_artikelname']; ?></td> <!--- 5 ---> <td valign="middle" align="center" class="listtext" id=""><?php echo number_format( $products_new['adb_kubik'] , 2 , "," , "" ) ; ?> m³</td> <!--- 6 ---> <td valign="middle" align="center" class="listtext" id=""><?php echo number_format( $products_new['adb_ek_dollar'], 2 , "," , "" ); ?> USD</td> <!--- 7 ---> <td valign="middle" align="center" class="listtext" id="ek_netto"><?php echo number_format( $products_new['adb_ek_sum_euro'], 2 , "," , "" ); ?></strong> €</td> <!--- 10 ---> <td valign="middle" align="center" class="listtext" id=""><?php echo $products_new['adb_versand']; ?> €</td> <!--- 11 ---> <td valign="middle" align="center" class="listtext" <?php $vkpreis = (($products_new['products_price']*1.19)+0.01); $empfpreis = $products_new['adb_empf_vk_brutto']; if ( $empfpreis > $vkpreis ) {echo 'bgcolor=#ff0000';} else { echo 'id="vk_brutto"'; } ?>><?php $preis = ($products_new['products_price']*1.19); echo number_format( $preis , 2 , "," , "" ); ?></td> <!--- 15 ---> <td valign="middle" align="center" class="listtext" id=""><?php echo $products_new['adb_am_lager']; ?> Stk.</td> </tr> <?php } } else { ?> I've added this code to it to a new table field to get the options displayed in it <?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) { ?> Weitere Ausführungen ... <?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 . "'" . " order by pa.options_values_price, pa.products_attributes_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']); //here is the edited code if ($products_options['options_values_price'] != '0') { if ($products_options['price_prefix'] == '+'){ $real_price = ($product_info['products_price']) + ($products_options['options_values_price']); $products_options_array[sizeof($products_options_array)-1]['text']; }else{ $real_price = ($product_info['products_price']) - ($products_options['options_values_price']); $products_options_array[sizeof($products_options_array)-1]['text']; } } // end of code } 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; } ?> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" valign="top"><?php echo $products_options_name['products_options_name'] . ':'; ?> </td> <td class="main" valign="top"><?php echo tep_draw_pull_down_ebay('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br></td> </tr> </table> <?php } ?> but this returns with a Server Error 500 page only. This is how it should look like: to get the part shown here with the red border is what i'm unable to get working.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.