zzfritz Posted October 9, 2002 Posted October 9, 2002 We wanted boxes/manufacturers_info.php displayed in column_right.php when the shopper selects the manufacturer's name from the list in the left column. (In the current snapshot, it displays only when a product is selected.) This required only two simple changes. First, in column_right.php change line 15 to include a test for manufacturers_id: if (($HTTP_GET_VARS['products_id']) or ($HTTP_GET_VARS['manufacturers_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php'); Then, in boxes/manufacturers_info.php add this line at the beginning: if ($HTTP_GET_VARS['manufacturers_id']) $manufacturer_query = tep_db_query("select manufacturers_id, manufacturers_name, manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id= '" . $HTTP_GET_VARS['manufacturers_id'] . "'"); else Quote
Guest Posted April 25, 2003 Posted April 25, 2003 Ok, after an hour or so of fooling around here is what I have. I'm running MS1 with a manufacturer_info ver 1.10 2003/02/12 . The manufacturers_info.php box would NOT show up when I view by manufacutrer. I ended up duplicating the code that is used to create the info box with some changes. I had to change the suggested modified querry so that it would also pull the manufacturer url from the manufacturer_info table. ex: if (isset($HTTP_GET_VARS['manufacturers_id'])) { $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id) where m.manufacturers_id= '" . $HTTP_GET_VARS['manufacturers_id'] . "'"); if (tep_db_num_rows($manufacturer_query)) {..... this is all the same as the existing file, just duplicated..... ?php } } else { if (isset($HTTP_GET_VARS['products_id'])) {.... continue of the original code...... <!-- manufacturer_info_eof //--> <?php } } } ?> What I would like to know is if there is an easier way to do all this? Instead of duplicating all that code, isn't there a way to generate the box based on a condition? I couldnt get it to work that way, so I did the above just to get it running. sirkyle Quote
Guest Posted November 10, 2003 Posted November 10, 2003 In MS2, the shorter way would be to replace if (isset($HTTP_GET_VARS['products_id'])) { $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id"); with if (isset($HTTP_GET_VARS['products_id']) || isset($HTTP_GET_VARS['products_id'])) { if ($HTTP_GET_VARS['manufacturers_id']) { $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " where m.manufacturers_id= '" . $HTTP_GET_VARS['manufacturers_id'] . "' and m.manufacturers_id=mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'"); } else { $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id"); } This will switch based on if the manufacturers_id data is available. Hth, Matt Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.