magnusj Posted October 5, 2006 Posted October 5, 2006 Hi all! I have a product box that, when a category is chosen, displays links to the products in that category. Like this: Prod 1 Prod 2 Prod 3 Prod 4 Prod 5 Prod 6 But if I assign say prod 1 and 2 to manufacturer 1, and prod 3, 4 and 5 to manufacterer 2, etc I want the list to show that. So what I would like to display is this: Manufacturer 1 Prod 1 Prod 2 Manufacturer 2 Prod 3 Prod 4 Prod 5 Manufacturer 3 Prod 6 Could someone please help me with this? Thanks! Magnus J Below is what my product box looks like now: function tep_products_infobox() { global $HTTP_GET_VARS, $cPath, $languages_id, $current_category_id; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $products_query = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.manufacturers_id = '" . $HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name"); } else if (isset($current_category_id)) { $products_query = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name"); } else return; if ($number_of_rows = tep_db_num_rows($products_query)) { ?> <!-- products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left','text' => BOX_HEADING_PRODUCTS); new infoBoxHeading($info_box_contents, false, false); if ($number_of_rows <= MAX_DISPLAY_PRODUCTS_IN_A_LIST) { // Display a list while ($products = tep_db_fetch_array($products_query)) { $products_name = ((strlen($products['products_name']) > MAX_DISPLAY_PRODUCT_NAME_LEN) ? substr($products['products_name'], 0, MAX_DISPLAY_PRODUCT_NAME_LEN) . '..' : $products['products_name']); if (isset($HTTP_GET_VARS['products_id']) && ($HTTP_GET_VARS['products_id'] == $products['products_id'])) $products_name = '<b>' . $products_name .'</b>'; $products_list .= '<span class="menucat2"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, (isset($HTTP_GET_VARS['manufacturers_id'])? 'manufacturers_id=' .$HTTP_GET_VARS['manufacturers_id'] :'cPath=' . $cPath) .'&products_id=' . $products['products_id']) . '">' . $products_name . '</a></span><br>'; } $products_list = substr($products_list, 0, -4); $info_box_contents = array(); $info_box_contents[] = array('text' => $products_list); } else { // Display a drop-down $products_array[] = array('id' => '', 'text' => BOX_PRODUCTS_ALL); while ($products = tep_db_fetch_array($products_query)) { $products_name = ((strlen($products['products_name']) > MAX_DISPLAY_PRODUCT_NAME_LEN) ? substr($products['products_name'], 0, MAX_DISPLAY_PRODUCT_NAME_LEN) . '..' : $products['products_name']); $products_array[] = array('id' => $products['products_id'], 'text' => $products_name); } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('products', tep_href_link(FILENAME_PRODUCT_INFO, '', 'NONSSL', false), 'get'), 'text' => (isset($HTTP_GET_VARS['manufacturers_id'])? tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']):'') . tep_draw_pull_down_menu('products_id', $products_array, (isset($HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : ''), 'onChange="if (this.selectedIndex==0)window.location=\'' . tep_href_link(FILENAME_DEFAULT, (isset($HTTP_GET_VARS['manufacturers_id'])? 'manufacturers_id=' .$HTTP_GET_VARS['manufacturers_id'] :'cPath=' . $cPath)). '\'; else this.form.submit();" size="' . MAX_PRODUCTS_LIST . '" style="width: 100%"') . tep_hide_session_id()); } new infoBox($info_box_contents); ?> <!-- products_eof //--> <?php } } tep_products_infobox(); ?>
magnusj Posted October 8, 2006 Author Posted October 8, 2006 Forgot to say... I really need this a.s.a.p. Client breathing down my neck! Any help is greatly appreciated!
XCCreations Posted October 8, 2006 Posted October 8, 2006 When making products you can fill in the manufactores so what you could do "I have not done thsi but it should work" is create your own Manfucators buttons so you could do shop by Manufactors. I did this on my site but with categories 'http://xccreations.com) sorry if anythings out of place on my site im editing it.
magnusj Posted October 8, 2006 Author Posted October 8, 2006 Hi XCCreations. Thanx for your reply. Categories by manufacturer on http://www.xccreations.com? Where??? Can?t find it. The important thing is the listing display itself. It has to be as described above...
XCCreations Posted October 8, 2006 Posted October 8, 2006 Ok i didnt look over the whole post but i get your idea and you want products with this manufactorer to go to that manufacor on there own page So what you should do is install the maufactors drop down list and then get the links to the manufacotrers once this is done asaign the products to there manufactors and create your own catagorie box or do what i did on my site create your own tabs only with manufactors and then your customers will be able to choose there manufactorer. Hope this made sense
magnusj Posted October 8, 2006 Author Posted October 8, 2006 Hmm... I see I have not been entirely clear. I don?t want to link the manufacturer lines or show a product page by manufacturer. I simply want the manufacturers as headlines in the product box. Like this: Manufacturer 1 (headline) Prod 1 (link) Prod 2 (link) Manufacturer 2 (headline) Prod 3 (link) Prod 4 (link) Prod 5 (link) Manufacturer 3 (headline) Prod 6 (link) See what I mean?
XCCreations Posted October 8, 2006 Posted October 8, 2006 Ahh then just create your own Categorie box. Thats what i would do ;)
magnusj Posted October 8, 2006 Author Posted October 8, 2006 Hehe yeah, that?s what I?m trying to do... But I need some help with the coding. This is why I posted in the first place. I need som actual hands on concrete code to get the results that I want.
magnusj Posted October 8, 2006 Author Posted October 8, 2006 As you can see I posted the code from my current categories (or rather products) box. Need help to tweek it.
XCCreations Posted October 8, 2006 Posted October 8, 2006 just make it by coding your self like make a manufactor logo put it on there php the product link all that good stuff if u need and example ill make one for ya let me know.
XCCreations Posted October 8, 2006 Posted October 8, 2006 Alright make the info box: Then make a manufactor logo in Photoshop to match your site then your going to PHP it in to the info box then belowe it PHP in your products.
magnusj Posted October 8, 2006 Author Posted October 8, 2006 Yeah, but wouldn?t that just result in a manufactor logo below EVERY product link? I want it to display as I showed U before. You need some sort of an array, don?t you?
XCCreations Posted October 8, 2006 Posted October 8, 2006 ill make one tommorow and ill pm u about it
magnusj Posted October 8, 2006 Author Posted October 8, 2006 Shoutout to enigma1! I have been blessed with your help before, so I thought I would ask. U seem to be in total control of all php an database stuff, so anything U could do...
magnusj Posted October 11, 2006 Author Posted October 11, 2006 Is there anyone else who could contribute to my dilemma? Please, I really need this. MJ
jdrivie Posted October 12, 2006 Posted October 12, 2006 Is there anyone else who could contribute to my dilemma? Please, I really need this. MJ I don't know if this will help but this is what I did to list employees by division; I created a query for each division I needed with a corresponding heading <--------Division 1 -----------> <tr class="dataTableRow"> <td class="dataTableContent" align="left"> <?php echo 'Division: 1'; ?>? </td> </tr> <?php if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] > 1)) $rows = $HTTP_GET_VARS['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS; $customers_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, division, admin from " . TABLE_CUSTOMERS . " where division= '1' order by customers_lastname"); // fix counted customers while ($customers = tep_db_fetch_array($customers_query)) { $rows++; if (strlen($rows) < 2) { $rows = '0' . $rows; } ?> <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'cID=' . $customers['customers_id'], 'NONSSL'); ?>'"> <td class="dataTableContent"><?php echo $rows; ?>.</td> <td class="dataTableContent" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'cID=' . $customers['customers_id'], 'NONSSL') . '">' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . '</a>'; ?></td> </tr> <?php } ?> <--Division 2 -----------> <tr class="dataTableRow"> <td class="dataTableContent" align="left"> <?php echo 'Division: 2'; ?>? </td> </tr> <?php if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] > 1)) $rows2 = $HTTP_GET_VARS['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS; $customers_query2 = tep_db_query("select customers_id, customers_firstname, customers_lastname, division, admin from " . TABLE_CUSTOMERS . " where division = '2' order by customers_lastname"); // fix counted customers while ($customers2 = tep_db_fetch_array($customers_query2)) { $rows2++; if (strlen($rows2) < 2) { $rows2 = '0' . $rows2; } ?> <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'cID=' . $customers2['customers_id'], 'NONSSL'); ?>'"> <td class="dataTableContent"><?php echo $rows2; ?>.</td> <td class="dataTableContent" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'cID=' . $customers2['customers_id'], 'NONSSL') . '">' . $customers2['customers_firstname'] . ' ' . $customers2['customers_lastname'] . '</a>'; ?></td> </tr> <?php } ?> This is the results; http://www.jacroson.com/test/scr1.jpg You would not need the row count on the left but by limiting each section to a particular manufacturer you should get the reuslts you want
magnusj Posted October 12, 2006 Author Posted October 12, 2006 Thanks for your reply! Looks like U have to hard code the headlines ('Division: 2')? Is that right? My client must be able to add new manufacturers (or divisions, or departments, or whatever you want to use instead of manufacturers) in osC admin and assign products to them. This would then be displayed without me having to code manually.
jdrivie Posted October 12, 2006 Posted October 12, 2006 Thanks for your reply! Looks like U have to hard code the headlines ('Division: 2')? Is that right? My client must be able to add new manufacturers (or divisions, or departments, or whatever you want to use instead of manufacturers) in osC admin and assign products to them. This would then be displayed without me having to code manually. I don't know how to do that automatically my php skills aren't there yet. Maybe you could modify a categories box to display manufacturers and products.
magnusj Posted October 12, 2006 Author Posted October 12, 2006 Yea, that?s my goal. I just don?t know how? Hoping that some kind (and php savvy) soul on this forum would help...
jdrivie Posted October 12, 2006 Posted October 12, 2006 Yea, that?s my goal. I just don?t know how? Hoping that some kind (and php savvy) soul on this forum would help... Have you tried adding the manufactor names as the category and then add products, it should display the way you want.
magnusj Posted October 12, 2006 Author Posted October 12, 2006 Hmm... problably harder than it sounds. I?ll give it yet another try tomorrow. Have to be at work 05:55am. ?Bout 22:10pm now in Sweden :-( Thanks!
jdrivie Posted October 12, 2006 Posted October 12, 2006 Hmm... problably harder than it sounds. I?ll give it yet another try tomorrow. Have to be at work 05:55am. ?Bout 22:10pm now in Sweden :-( Thanks! It shouldn't be too hard to try, in the admin create a category "Manufacturer A" then either add or copy products into that new "Category" and see if they display the way you want. Good Luck and Good Night From Joe in Florida
Recommended Posts
Archived
This topic is now archived and is closed to further replies.