mattifinn Posted December 14, 2002 Posted December 14, 2002 I am looking for an old contribution made by *one of the developers* that changed product listing to columns - any help? I know about Ian C. Wilson's contrib.... not the one I am looking for Quote
mattifinn Posted December 15, 2002 Author Posted December 15, 2002 well..... after searching all day...... because the BB search engine cannot manage to find 'product listing', I found reference to the old hack here: http://www.oscommerce.com/forums/viewtopic.php...=productlisting It was done by David Garcia Watkins, but unfortunately is unreadable in this BB..... Anyone know where i can find a clean copy.... it used to be in contribs, but has disappeared...... Quote
cfuller Posted January 14, 2003 Posted January 14, 2003 I had the same problem (frustrating) but knew it could be done because I'd seen http://paulharris.paulharris.com/catalog/default.php. I couln't find an answer so I've started hacking something together in product_listing.php. It basically uses code from new_products.php. This hasn't been fully tested for pagination yet but the basics are here. Note that this version displays 6 columns of products but this can easily by changed by editing line 54 (if ($col > 5)) and changing td width on line 51 (in the params for the $info_box_contents_array). HTH! :D <?php /* $Id: product_listing.php,v 1.40 2002/11/23 02:08:11 thomasamoulton Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ ?> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <?php $listing_numrows_sql = $listing_sql; $listing_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $listing_sql, $listing_numrows); // fix counted products $listing_numrows = tep_db_query($listing_numrows_sql); $listing_numrows = tep_db_num_rows($listing_numrows); if ($listing_numrows > 0 && (PREV_NEXT_BAR_LOCATION == '1' || PREV_NEXT_BAR_LOCATION == '3')) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"> <?php echo $listing_split->display_count($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> </td> <td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator(); ?></td> </tr> <?php } ?> <tr> <td> <? $info_box_contents = array(); $row = 0; $col = 0; if ($listing_numrows > 0) { $number_of_products = '0'; $listing = tep_db_query($listing_sql); while ($listing_values = tep_db_fetch_array($listing)) { $listing_values['products_name'] = tep_get_products_name($listing_values['products_id']); $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="16%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . $listing_values['products_name'] . '</a><br>' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id']))); $col ++; if ($col > 5) { $col = 0; $row ++; } } new contentBox($info_box_contents); echo ' </td>' . "n"; echo ' </tr>' . "n"; } else { ?> <tr class="productListing-odd"> <td class="smallText"> <?php echo ($HTTP_GET_VARS['manufacturers_id'] ? TEXT_NO_PRODUCTS2 : TEXT_NO_PRODUCTS); ?> </td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator(); ?></td> </tr> <?php if ($listing_numrows > 0 && (PREV_NEXT_BAR_LOCATION == '2' || PREV_NEXT_BAR_LOCATION == '3')) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"> <?php echo $listing_split->display_count($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> </td> <td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td> </tr> </table></td> </tr> <?php } ?> </table> Quote
Guest Posted June 5, 2003 Posted June 5, 2003 found here: http://www.oscommerce.com/community/contributions,825 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.