Llangrannog Posted October 8, 2007 Share Posted October 8, 2007 Hello i have attempted to fir the viewed products contribution into the right column without success as it does not fit the rest of the boxes and looks out of place. Could someone code a simple list as a box rather than a module so it can fit in with other boxes in the right column Thanks Here is as far as i got it seems to work but is about 4 pixels to the left out of alignment. <?php /* $Id: viewed_products.php, v 1.8 2005/01/09 00:00:00 gjw Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ // if (((tep_session_is_registered('customer_id')) or (ENABLE_PAGE_CACHE == 'false')) and (!$spider_flag)){ // HQSQ added call to language define file for Viewed Items Mod START require_once(DIR_WS_LANGUAGES . $language . '/' . 'viewed_products.php'); // HQSQ added call to language define file for Viewed Items Mod END //******************************************************************************* DEFINE('HIST_ROWS',7); // number of rows per column on display DEFINE('HIST_MAX_ROWS',7); // max number of products on display //******************************************************************************* // register the array if not already done so if (tep_session_is_registered('viewed') && is_object($viewed)) { } else { tep_session_register('viewed'); $viewed = new viewed_products; $viewed->reset(); } // empty the array if requested by the user if (isset($HTTP_GET_VARS['action'])) { if ($HTTP_GET_VARS['action'] == 'viewed_remove') { $viewed->remove(); } } // display the box if we have history $items_ids_on_display = array(); if ($viewed->count_viewed() > 0) { // displaying if (HIST_MAX_ROWS <= HIST_ROWS) { $hist_width= '100%'; } else { $hist_width= '100%'; } echo '<table border="1" width="' . $hist_width . '" align="center" cellpadding="6" cellspacing="0" bgcolor="white">'; $row = 0; /* get the products array from the class containing all viewed products */ $items = $viewed->get_viewed_items(); $index = 1; /* determine the first and last record we want to display*/ $first = sizeof($items)- HIST_MAX_ROWS; $last = sizeof($items)-1; if (($last+1) < HIST_MAX_ROWS) {$disp = ($last+1);} else {$disp = HIST_MAX_ROWS;} if ($first < 0) {$first = 0;} /* only fetch the info for products on display */ for ($i=$last, $n=$first; $i>=$n; $i--) { $viewed_query = tep_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $items[$i] . "' and pd.language_id = '" . $languages_id . "' and pd.products_id = p.products_id"); if ($viewed_info = tep_db_fetch_array($viewed_query)) { $items_on_display[$i] = array('id' => $items[$i], 'name' => $viewed_info['products_name'], 'image' => $viewed_info['products_image']); $items_ids_on_display[]= $items[$i]; } } echo ' <tr class="infoBoxContents"> <td colspan="2" class="infoBoxHeading">' . BOX_HEADING_VIEWED_ITEMS . '</td> </tr>'; echo '<tr class="boxText"> <td valign="top" align="left" >'; for ($i=$last, $n=$first; $i>=$n; $i--) { echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $items_on_display[$i]['id']) . '">' . $items_on_display[$i]['name'] . '</a>'; $row ++; $index++; if ($row > HIST_ROWS - 1) { $row = 0; echo '</td>'; } } echo '</tr> </table>'; } // Displaying //if (isset($HTTP_GET_VARS['products_id']) and ($HTTP_GET_VARS['action'] != 'viewed_remove')) { //if (!in_array($HTTP_GET_VARS['products_id'], $items_ids_on_display)) { //$viewed->add_viewed($HTTP_GET_VARS['products_id']); //} //} // general condition ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.