dylan_baxter Posted September 3, 2006 Posted September 3, 2006 I cannot seem to penetrate the layers of abstraction present in osCommerce and I am quite frustrated. :angry: It would appear that my PHP knowledge lacks to the point that I do not understand much of the processing that is occuring between the database calls and final content output. The problem (other than my ignorance): My site has these generic, vanilla boxes all over the damn place and I cant figure out how to leave out the boxes but output the content! For instance, I want to embed the manufacturers drop-down into a section of the header whilst leaving out the box that surrounds it. I cant seem to figure out how to manually include functions such as this in other parts of my site. Is there any easy way to leave out all the flack? Here, have some code: <?php $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); if ($number_of_rows = tep_db_num_rows($manufacturers_query)) { ?> <!-- manufacturers //--> <tr> <td> <?php // Display a drop-down $manufacturers_array = array(); if (MAX_MANUFACTURERS_LIST < 2) { $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT); } while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']); $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers_name); } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'), 'text' => tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id()); new infoBox($info_box_contents); ?> </td> </tr> <!-- manufacturers_eof //--> <?php } ?>
dylan_baxter Posted September 3, 2006 Author Posted September 3, 2006 Nevermind. Another look today and I had it figured in ten minutes. Here, have some code: <?php $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); if ($number_of_rows = tep_db_num_rows($manufacturers_query)) { ?> <!-- Drop-Down List Begin //--> <tr> <td> <?php $manufacturers_array = array(); if (MAX_MANUFACTURERS_LIST < 2) { $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT); } while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']); $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers_name); } $content = tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'); $content .= tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id(); echo $content; ?> </td> </tr> <!-- Drop-Down List End //--> <?php } ?> 'Hope it helps someone else.
RelentlessSkateshop Posted September 4, 2006 Posted September 4, 2006 I pasted that into my includes/header.php and I got the drop down box spanning the entire page. Furthermore the results from the drop down gave a dead end (It showed no matches to the search criteria). warning: I know NOTHING innately concerning php except what I can look up at w3schools.com! If you say you can't do it, you're only fooling yourself.
dylan_baxter Posted September 4, 2006 Author Posted September 4, 2006 Yer right. I left some HTML in there. Here's the file I'm using. Save it in includes/boxes and include whereever you want (I put mine in the header.php). <?php $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); if ($number_of_rows = tep_db_num_rows($manufacturers_query)) { $manufacturers_array = array(); if (MAX_MANUFACTURERS_LIST < 2) { $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT); } while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']); $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers_name); } $content = tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'); $content .= tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 200"') . tep_hide_session_id(); echo $content; } ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.