pafranklin Posted June 30, 2007 Posted June 30, 2007 Hi there, I am using an allmanufacturers.php page which shows every manufacturer loaded in the admin side of my OSC site. If possible I would like to change it slightly so that it only shows the manufacturer if there is an active / live product linked to this manufacturer. Is this possible and please could someone suggest how I do this? Here is my current page......... <?php /* $Id: allmanufacturers.php,v 1.0 2003/11/25 10:12:10 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 - 2003 osCommerce All Manufacturers by Alex Kaiser [email protected] www.pooliestudios.com Edited by Roman Gruhn [email protected] Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ALLMANUFACTURERS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ALLMANUFACTURERS)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <?php // BOF: WebMakers.com Changed: Header Tag Controller v2.5.2 // Replaced by header_tags.php if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) { require(DIR_WS_INCLUDES . 'header_tags.php'); } else { ?> <title><?php echo TITLE; ?></title> <?php } // EOF: WebMakers.com Changed: Header Tag Controller v2.5.2 ?> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table width="100%" border="0" align="center" cellspacing="3" cellpadding="3"> <td width="1" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="3"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%"><table width="100%" border="0" align="left" cellpadding="3" cellspacing="3"> <tr> <td><table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="left"> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '05'); ?></td> </tr> <tr> <td><br><table width="100%" border="0" align="left" cellpadding="5" cellspacing="5"> <tr> <td class="main"> <!-- all manufacturers begin //--> <?php $row = 1; $manufacturers_query = tep_db_query("select manufacturers_name, manufacturers_id, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name" ); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $row++; echo '<td align="center" valign="middle" width="25%" class="smallText">'; echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '=' . $manufacturers['manufacturers_name'], 'NONSSL', false) . '">' . tep_image(DIR_WS_IMAGES . $manufacturers['manufacturers_image'], $manufacturers['manufacturers_name']) . "</a><br><br>\n"; echo '</td>'; if ((($row /4) == floor($row / 4))) { ?> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <?php } } ?> <!-- all manufacturers end //--> </td> </tr> </table></td> </tr> <tr> <td align="right" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> </tr> </table> <!-- body_text_eof //--> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table> <p><!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> </p> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> You will never learn if you don't try. And boy am I trying....!
pafranklin Posted June 30, 2007 Author Posted June 30, 2007 Hi there, I am using an allmanufacturers.php page which shows every manufacturer loaded in the admin side of my OSC site. If possible I would like to change it slightly so that it only shows the manufacturer if there is an active / live product linked to this manufacturer. Is this possible and please could someone suggest how I do this? Here is my current page......... <?php /* $Id: allmanufacturers.php,v 1.0 2003/11/25 10:12:10 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 - 2003 osCommerce All Manufacturers by Alex Kaiser [email protected] www.pooliestudios.com Edited by Roman Gruhn [email protected] Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ALLMANUFACTURERS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ALLMANUFACTURERS)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <?php // BOF: WebMakers.com Changed: Header Tag Controller v2.5.2 // Replaced by header_tags.php if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) { require(DIR_WS_INCLUDES . 'header_tags.php'); } else { ?> <title><?php echo TITLE; ?></title> <?php } // EOF: WebMakers.com Changed: Header Tag Controller v2.5.2 ?> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table width="100%" border="0" align="center" cellspacing="3" cellpadding="3"> <td width="1" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="3"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%"><table width="100%" border="0" align="left" cellpadding="3" cellspacing="3"> <tr> <td><table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="left"> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '05'); ?></td> </tr> <tr> <td><br><table width="100%" border="0" align="left" cellpadding="5" cellspacing="5"> <tr> <td class="main"> <!-- all manufacturers begin //--> <?php $row = 1; $manufacturers_query = tep_db_query("select manufacturers_name, manufacturers_id, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name" ); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $row++; echo '<td align="center" valign="middle" width="25%" class="smallText">'; echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '=' . $manufacturers['manufacturers_name'], 'NONSSL', false) . '">' . tep_image(DIR_WS_IMAGES . $manufacturers['manufacturers_image'], $manufacturers['manufacturers_name']) . "</a><br><br>\n"; echo '</td>'; if ((($row /4) == floor($row / 4))) { ?> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <?php } } ?> <!-- all manufacturers end //--> </td> </tr> </table></td> </tr> <tr> <td align="right" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> </tr> </table> <!-- body_text_eof //--> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table> <p><!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> </p> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Bump.... Please can anyone help with this??? You will never learn if you don't try. And boy am I trying....!
pafranklin Posted June 30, 2007 Author Posted June 30, 2007 Bump.... Please can anyone help with this??? Anyone with a suggestion as to how to filter these? I am not very good with PHP yet so would really be grateful for a pointer as to what query to write and how? Thank you...... You will never learn if you don't try. And boy am I trying....!
pafranklin Posted July 13, 2007 Author Posted July 13, 2007 Hi there, I am using an allmanufacturers.php page which shows every manufacturer loaded in the admin side of my OSC site. If possible I would like to change it slightly so that it only shows the manufacturer if there is an active / live product linked to this manufacturer. Is this possible and please could someone suggest how I do this? Here is my current page......... <?php /* $Id: allmanufacturers.php,v 1.0 2003/11/25 10:12:10 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 - 2003 osCommerce All Manufacturers by Alex Kaiser [email protected] www.pooliestudios.com Edited by Roman Gruhn [email protected] Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ALLMANUFACTURERS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ALLMANUFACTURERS)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <?php // BOF: WebMakers.com Changed: Header Tag Controller v2.5.2 // Replaced by header_tags.php if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) { require(DIR_WS_INCLUDES . 'header_tags.php'); } else { ?> <title><?php echo TITLE; ?></title> <?php } // EOF: WebMakers.com Changed: Header Tag Controller v2.5.2 ?> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table width="100%" border="0" align="center" cellspacing="3" cellpadding="3"> <td width="1" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="3"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%"><table width="100%" border="0" align="left" cellpadding="3" cellspacing="3"> <tr> <td><table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="left"> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '05'); ?></td> </tr> <tr> <td><br><table width="100%" border="0" align="left" cellpadding="5" cellspacing="5"> <tr> <td class="main"> <!-- all manufacturers begin //--> <?php $row = 1; $manufacturers_query = tep_db_query("select manufacturers_name, manufacturers_id, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name" ); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $row++; echo '<td align="center" valign="middle" width="25%" class="smallText">'; echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '=' . $manufacturers['manufacturers_name'], 'NONSSL', false) . '">' . tep_image(DIR_WS_IMAGES . $manufacturers['manufacturers_image'], $manufacturers['manufacturers_name']) . "</a><br><br>\n"; echo '</td>'; if ((($row /4) == floor($row / 4))) { ?> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <?php } } ?> <!-- all manufacturers end //--> </td> </tr> </table></td> </tr> <tr> <td align="right" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> </tr> </table> <!-- body_text_eof //--> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table> <p><!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> </p> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Really sorry to raise this again, but can anyone suggest where I start with this. I just want to leave out manufactureres where there are no active products? Thank you. You will never learn if you don't try. And boy am I trying....!
♥Monika in Germany Posted July 13, 2007 Posted July 13, 2007 Really sorry to raise this again, but can anyone suggest where I start with this. I just want to leave out manufactureres where there are no active products? Thank you. Hi, make sure you have uploaded images for all your manufacturers....and use this query: $manufacturers_query = tep_db_query("select distinct manufacturers_name, m.manufacturers_id, manufacturers_image from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p where m.manufacturers_id = p.manufacturers_id and p.products_status = 1 order by manufacturers_name" ); :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
pafranklin Posted July 14, 2007 Author Posted July 14, 2007 Really sorry to raise this again, but can anyone suggest where I start with this. I just want to leave out manufactureres where there are no active products? Thank you. Monika, You are superb - As always!!! :thumbsup: I have been attempting the code for this query for so long and was determined to get there but couldn't. Thank you so much. It worked a treat. So, for anyone else looking to have an "All Manufacturers Page showing only manufacturers with active products the code is............. <?php /* $Id: allmanufacturers.php,v 1.0 2003/11/25 10:12:10 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 - 2003 osCommerce All Manufacturers by Alex Kaiser [email protected] www.pooliestudios.com Edited by Roman Gruhn [email protected] Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ALLMANUFACTURERS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ALLMANUFACTURERS)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <?php // BOF: WebMakers.com Changed: Header Tag Controller v2.5.2 // Replaced by header_tags.php if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) { require(DIR_WS_INCLUDES . 'header_tags.php'); } else { ?> <title><?php echo TITLE; ?></title> <?php } // EOF: WebMakers.com Changed: Header Tag Controller v2.5.2 ?> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table width="100%" border="0" align="center" cellspacing="3" cellpadding="3"> <td width="1" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="3"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%"><table width="100%" border="0" align="left" cellpadding="3" cellspacing="3"> <tr> <td><table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="left"> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '05'); ?></td> </tr> <tr> <td><br><table width="100%" border="0" align="left" cellpadding="5" cellspacing="5"> <tr> <td class="main"> <!-- all manufacturers begin //--> <?php $manufacturers_query = tep_db_query("select distinct manufacturers_name, m.manufacturers_id, manufacturers_image from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p where m.manufacturers_id = p.manufacturers_id and p.products_status = 1 order by manufacturers_name" ); $row = 1; $manufacturers_query = tep_db_query("select manufacturers_name, manufacturers_id, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name" ); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $row++; echo '<td align="center" valign="middle" width="25%" class="smallText">'; echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '=' . $manufacturers['manufacturers_name'], 'NONSSL', false) . '">' . tep_image(DIR_WS_IMAGES . $manufacturers['manufacturers_image'], $manufacturers['manufacturers_name']) . "</a><br><br>\n"; echo '</td>'; if ((($row /4) == floor($row / 4))) { ?> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <?php } } ?> <!-- all manufacturers end //--> </td> </tr> </table></td> </tr> <tr> <td align="right" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> </tr> </table> <!-- body_text_eof //--> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table> <p><!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> </p> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> You will never learn if you don't try. And boy am I trying....!
♥Monika in Germany Posted July 14, 2007 Posted July 14, 2007 Paul, you forgot the old query in ... you need to comment out that one. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.