Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product listing- column


mattifinn

Recommended Posts

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......

Link to comment
Share on other sites

  • 5 weeks later...

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>

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...