rafaelcr Posted December 4, 2006 Posted December 4, 2006 I need to make the following one: to appear the name of manufactures in account_history_info.php The code below presents the code (ID) of manufactures, through the number of order. For the number of order it searchs the number of the product and for the number of the product it searchs manufactures corresponding, direct in the table manufactures. He happens that I do not know the code so that on the contrary of it to present the number of the supplier, it to present the name of the supplier. He sees if he obtains to decide this. <?php /* $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); // the following cPath references come from application_top.php $category_depth = 'top'; if (isset($cPath) && tep_not_null($cPath)) { $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $cateqories_products = tep_db_fetch_array($categories_products_query); if ($cateqories_products['total'] > 0) { $category_depth = 'products'; // display products } else { $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'"); $category_parent = tep_db_fetch_array($category_parent_query); if ($category_parent['total'] > 0) { $category_depth = 'nested'; // navigate through the categories } else { $category_depth = 'products'; // category has no products, but display the 'no products' message } } } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT); ?> <?php $current_category_id = 62; $listing_sql = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, p.products_quantity, s.manufacturers_id, r.orders_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS_INFO . " s, " . TABLE_ORDERS_PRODUCTS . " r where r.orders_id='$order_id' and r.products_id = p.products_id and p.products_status = '1' and p.manufacturers_id = s.manufacturers_id and pd.language_id = '" . (int)$languages_id . "' LIMIT 1"; $listing_sql1 = "select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, 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 from products_description pd, products p left join manufacturers m on '" . $manufacturers_id . "' = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '62' order by pd.products_name LIMIT 4"; $new_products_query = tep_db_query($listing_sql); $new_products_query1 = tep_db_query($listing_sql1); echo ' <table cellspacing=0 cellpadding=0> <tr><td background=images/m27.gif width=160 height=36 colspan=10 class=bc><b> Aproveite!</b></td></tr> <tr><td colspan=10 height=8 bgcolor=#EFF3F3></td></tr> <tr> '; while ($new_products1 = tep_db_fetch_array($new_products_query1)) { $new_products1['manufacturers_id'] = tep_get_products_name($new_products1['manufacturers_id']); echo ' <td valign=top bgcolor=#EFF3F3> <table cellspacing=0 cellpadding=0 align=center width=140> <tr><td valign=top width=52><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_description '], 52, 64, ' class=br') . '</a></td> <td width=10></td>' . $new_products['manufacturers_id'] . ' <td valign=top width=78> <table cellspacing=0 cellpadding=0> <tr><td><b><a class=th9 style="text-decoration:underline" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b><br><br class=px2></td></tr> <tr><td height=46 valign=bottom>'.$price.'</td></tr> </table> </td></tr> <tr><td colspan=10 height=31 bgcolor=#EFF3F3 align=center><hr size=1 style="color:#DBD6D6"></td></tr> </table> </td> </tr> <tr> '; } while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); if (tep_not_null($new_products['specials_new_products_price'])) { $price = '<span style="font-size:9px"><s>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s></span><br><br style="font-size:2px"><span class=bc1>' . $currencies->display_price($new_products['specials_new_products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>'; } else { $price = '<span class=bc1>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>'; } echo ' <td valign=top bgcolor=#EFF3F3> <table cellspacing=0 cellpadding=0 align=center width=140> <tr><td valign=top width=52><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_description '], 52, 64, ' class=br') . '</a></td> <td width=10></td>' . $new_products['manufacturers_id'] . ' <td valign=top width=78> <table cellspacing=0 cellpadding=0> <tr><td><b><a class=th9 style="text-decoration:underline" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b><br><br class=px2></td></tr> <tr><td height=46 valign=bottom>'.$price.'</td></tr> </table> </td></tr> <tr><td colspan=10 height=31 bgcolor=#EFF3F3 align=center><hr size=1 style="color:#DBD6D6"></td></tr> </table> </td> </tr> <tr> '; } echo ' </tr> </table> '; ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.