seCret steVe Posted September 15, 2002 Share Posted September 15, 2002 Im sure we have all seen it. But when i begin a site i want to place all the manufatures in first. But as you prolly can see they show up on the main page: www.nstial.com/catalog/ It would be a greater idea that if there is no products turned on for that manufature that they will not show up in the manufaturer area. This would make it nicer for the customers that when they see a manufature they like and there is no products in there that they are not disappointed. Best idea would be to make it so that it there is no products that are turned on for it that it does not appear on the main page or through out the pages. Another idea by Steven Link to comment Share on other sites More sharing options...
Ajeh Posted September 16, 2002 Share Posted September 16, 2002 In /boxes/manufacturers.php change the code: // BOF: WebMakers.com Added: Show Manufacturers with products only // $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); $manufacturers_query = tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p where m.manufacturers_id=p.manufacturers_id order by manufacturers_name"); // EOF: WebMakers.com Added: Show Manufacturers with products only Link to comment Share on other sites More sharing options...
seCret steVe Posted September 16, 2002 Author Share Posted September 16, 2002 doest work....or where in the code should it be placed??? steve Link to comment Share on other sites More sharing options...
♥interfaSys Posted September 16, 2002 Share Posted September 16, 2002 I was about to say :"Why not turn off the manufacturer in admin?" A quick check of the default admin teached me that it was not implemented in the CVS version. Real easy to do, copy the flag switch and the extra status column from categories.php and paste them in manufacturers.php. Duplicate a couple of functions in general.php and you're done. As an extra feature, you can add a function to deactivate every product of a manufacturer that you disable. Olivier interfaSys s?rl ----------------------- You'll love to use our solutions! Rich Internet Applications and Usability Link to comment Share on other sites More sharing options...
Ajeh Posted September 16, 2002 Share Posted September 16, 2002 doest work....or where in the code should it be placed??? I have this on two sites so you can see the difference. The code for /includes/boxes/manufactures.php is changed to: <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => BOX_HEADING_MANUFACTURERS); new infoBoxHeading($info_box_contents, false, false); // BOF: WebMakers.com Added: Show Manufacturers with products only // Original Code: $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); $manufacturers_query = tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p where m.manufacturers_id=p.manufacturers_id order by manufacturers_name"); // EOF: WebMakers.com Added: Show Manufacturers with products only // SELECT distinct manufacturers.manufacturers_id FROM manufacturers,products where manufacturers.manufacturers_id=products.manufacturers_id if (tep_db_num_rows($manufacturers_query) <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) { // Display a list $manufacturers_list = ''; while ($manufacturers_values = tep_db_fetch_array($manufacturers_query)) { $manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers_values['manufacturers_id'], 'NONSSL') . '">' . substr($manufacturers_values['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '</a><br>'; } This URL shows two manufacturers with no products: http://www.thewebmakerscorner.com/freecall/ This URL shows the two manufactures as not being there as they have no products: http://www.thewebmakerscorner.com/working/ NOTE: manufacturers.php version is: $Id: manufacturers.php,v 1.16 2002/05/27 13:25:51 hpdl Exp $ Link to comment Share on other sites More sharing options...
seCret steVe Posted September 16, 2002 Author Share Posted September 16, 2002 this is what i have: <?php /* $Id: manufacturers.php,v 1.16 2002/05/27 13:25:51 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2001 osCommerce Released under the GNU General Public License */ ?> <!-- manufacturers //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => BOX_HEADING_MANUFACTURERS); new infoBoxHeading($info_box_contents, true, true); // BOF: WebMakers.com Added: Show Manufacturers with products only // Original Code: $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); $manufacturers_query = tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p where m.manufacturers_id=p.manufacturers_id order by manufacturers_name"); // EOF: WebMakers.com Added: Show Manufacturers with products only // SELECT distinct manufacturers.manufacturers_id FROM manufacturers,products where manufacturers.manufacturers_id=products.manufacturers_id if (tep_db_num_rows($manufacturers_query) <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) { // Display a list $manufacturers_list = ''; while ($manufacturers_values = tep_db_fetch_array($manufacturers_query)) { $manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers_values['manufacturers_id'], 'NONSSL') . '">' . substr($manufacturers_values['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '</a><br>'; } // Display a drop-down $select_box = '<select name="manufacturers_id" onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%">'; if (MAX_MANUFACTURERS_LIST < 2) { $select_box .= '<option value="">' . PULL_DOWN_DEFAULT . '</option>'; } while ($manufacturers_values = tep_db_fetch_array($manufacturers_query)) { $select_box .= '<option value="' . $manufacturers_values['manufacturers_id'] . '"'; if ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers_values['manufacturers_id']) $select_box .= ' SELECTED'; $select_box .= '>' . substr($manufacturers_values['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '</option>'; } $select_box .= "</select>"; $select_box .= tep_hide_session_id(); $info_box_contents = array(); $info_box_contents[] = array('form' => '<form name="manufacturers" method="get" action="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false) . '">', 'align' => 'left', 'text' => $select_box); } new infoBox($info_box_contents); ?> </td> </tr> <!-- manufacturers_eof //--> and it still dont work..... Link to comment Share on other sites More sharing options...
krugeros Posted October 17, 2010 Share Posted October 17, 2010 the query should be like this: $manufacturers_query = tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p where m.manufacturers_id=p.manufacturers_id and p.products_status = '1' order by manufacturers_name"); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.