Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Listing products hroizontally in boxes


tharada

Recommended Posts

Posted

I'm trying to list the products, contained in the Bestsellers box, horizontally.

I have Bestsellers Image (+db) installed.

 

There doesn't seem to be any contribution that helps me with this problem.

 

Can anyone help me with the code which will convert a vertical list to horizontal one?

 

Thank you!

Posted

Just a code change?

 

$bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
  $rows++;
  $bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></td></tr>';
}
$bestsellers_list .= '</table>';

 

to

 

$bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1"><tr>';
while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
  $rows++;
  $bestsellers_list .= '<td class="infoBoxContents">' . tep_row_number_format($rows) . '. <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></td>';
}
$bestsellers_list .= '</tr></table>';

 

should do it.

Posted

Hi,

 

Thanks again for your help.

 

I assume that the code change is in bestsellers.php? (please forgive me for my utter ignorance...)

May be because I have installed BESTSELLERS IMAGE (+db), but my code is very different from yours.

 

<ine goes something like this...

<?php
/*
 $Id: best_sellers.php,v 1.19 2002/06/05 20:59:08 dgw_ Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2001 osCommerce

 Released under the GNU General Public License

 Bestsellers Images v.1

 Edit by V. Meurink - [email protected]
*/
?>
<!-- best_sellers //-->
<?php
 if ($cPath) {
   $best_sellers_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_ordered from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and (c.categories_id = '" . $current_category_id . "' OR c.parent_id = '" . $current_category_id . "') order by p.products_ordered DESC, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
 } else {
   $best_sellers_query = tep_db_query("select p.products_id, p.products_image, pd.products_name, p.products_ordered from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by p.products_ordered DESC, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
 }

 if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {
?>
         <tr>
           <td>
<?php
   $info_box_contents = array();
   $info_box_contents[] = array('align' => 'left',
                                'text'  => BOX_HEADING_BESTSELLERS
                               );
   new infoBoxHeading($info_box_contents, false, false);

   $rows = 0;
   $info_box_contents = array();
   while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
     $rows++;
     $info_box_contents[] = array('align' => 'center',
'text'  => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers["products_id"], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $best_sellers['products_image'], $best_sellers['products_name'], BESTSELLER_IMAGE_WIDTH, BESTSELLER_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id'], 'NONSSL') . '">' . $best_sellers['products_name'] . '</a>');								   
   }

   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<?php
 }
?>
<!-- best_sellers_eof //-->

 

Really sorry, but could you have a look to see where I should change in this version of the code?

 

I appreciate your help enormously. Thank you again.

Posted

Is there anybody savvy enough to decipher what needs to be done to get horizontal display?

 

Thanks again!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...