kbking Posted September 12, 2006 Share Posted September 12, 2006 No, still nothing. My application_bottom.php in its entirety: <?php /* $Id: application_bottom.php,v 1.14 2003/02/10 22:30:41 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // YOUR RECENT HISTORY RECORDING if ((tep_session_is_registered('your_recent_history')) and ($your_recent_history->on)) { if ((isset($HTTP_GET_VARS['products_id'])) and (stristr(basename($PHP_SELF),'product_info.php'))){ $your_recent_history->add_viewed($HTTP_GET_VARS['products_id']); } elseif ((isset($_GET['products_id'])) and (stristr(basename($PHP_SELF),'product_info.php'))){ $your_recent_history->add_viewed($_GET['products_id']); } if ((isset($_GET['cPath'])) and (stristr(basename($PHP_SELF),'index.php'))) { $your_recent_history->add_cat($_GET['cPath']); } echo 'starting search addition<br>'; if (stristr(basename($PHP_SELF),'advanced_search_result.php')) { echo 'on right page<br>'; if ($products_found) { echo 'product found is ok<br>'; echo 'keywords: '. trim(strtolower($HTTP_GET_VARS['keywords'])).'<br>'; $your_recent_history->add_search(trim(strtolower($HTTP_GET_VARS['keywords']))); print_r($your_recent_history->searches); } } } // close session (store variables) tep_session_close(); if (STORE_PAGE_PARSE_TIME == 'true') { $time_start = explode(' ', PAGE_PARSE_START_TIME); $time_end = explode(' ', microtime()); $parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3); error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' - ' . getenv('REQUEST_URI') . ' (' . $parse_time . 's)' . "\n", 3, STORE_PAGE_PARSE_TIME_LOG); if (DISPLAY_PAGE_PARSE_TIME == 'true') { echo '<span class="smallText">Parse Time: ' . $parse_time . 's</span>'; } } // DO NOT REMOVE echo '<!-- 3.15.16.25.18.9.7.8.20.3.12.5.13.5.14.20.14.9.3.15.12.1.5.19.3.21 -->'; if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded == true) && ($ini_zlib_output_compression < 1) ) { if ( (PHP_VERSION < '4.0.4') && (PHP_VERSION >= '4') ) { tep_gzip_output(GZIP_LEVEL); } } ?> Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 13, 2006 Author Share Posted September 13, 2006 what does it say? No, still nothing. My application_bottom.php in its entirety: <?php /* $Id: application_bottom.php,v 1.14 2003/02/10 22:30:41 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // YOUR RECENT HISTORY RECORDING if ((tep_session_is_registered('your_recent_history')) and ($your_recent_history->on)) { if ((isset($HTTP_GET_VARS['products_id'])) and (stristr(basename($PHP_SELF),'product_info.php'))){ $your_recent_history->add_viewed($HTTP_GET_VARS['products_id']); } elseif ((isset($_GET['products_id'])) and (stristr(basename($PHP_SELF),'product_info.php'))){ $your_recent_history->add_viewed($_GET['products_id']); } if ((isset($_GET['cPath'])) and (stristr(basename($PHP_SELF),'index.php'))) { $your_recent_history->add_cat($_GET['cPath']); } echo 'starting search addition<br>'; if (stristr(basename($PHP_SELF),'advanced_search_result.php')) { echo 'on right page<br>'; if ($products_found) { echo 'product found is ok<br>'; echo 'keywords: '. trim(strtolower($HTTP_GET_VARS['keywords'])).'<br>'; $your_recent_history->add_search(trim(strtolower($HTTP_GET_VARS['keywords']))); print_r($your_recent_history->searches); } } } // close session (store variables) tep_session_close(); if (STORE_PAGE_PARSE_TIME == 'true') { $time_start = explode(' ', PAGE_PARSE_START_TIME); $time_end = explode(' ', microtime()); $parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3); error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' - ' . getenv('REQUEST_URI') . ' (' . $parse_time . 's)' . "\n", 3, STORE_PAGE_PARSE_TIME_LOG); if (DISPLAY_PAGE_PARSE_TIME == 'true') { echo '<span class="smallText">Parse Time: ' . $parse_time . 's</span>'; } } // DO NOT REMOVE echo '<!-- 3.15.16.25.18.9.7.8.20.3.12.5.13.5.14.20.14.9.3.15.12.1.5.19.3.21 -->'; if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded == true) && ($ini_zlib_output_compression < 1) ) { if ( (PHP_VERSION < '4.0.4') && (PHP_VERSION >= '4') ) { tep_gzip_output(GZIP_LEVEL); } } ?> Quote Treasurer MFC Link to comment Share on other sites More sharing options...
kbking Posted September 13, 2006 Share Posted September 13, 2006 Sorry I didn't see the output yesterday. I was looking for it in the Your Recent History-box and there was nothing - from the search - the source code only shows this: <td class="tableHeading" width="25%" valign="top" align="left"></td>. The output shows in the lower left corner of the browser window and says: starting search addition on right page Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 14, 2006 Author Share Posted September 14, 2006 Sorry I didn't see the output yesterday. I was looking for it in the Your Recent History-box and there was nothing - from the search - the source code only shows this: <td class="tableHeading" width="25%" valign="top" align="left"></td>. The output shows in the lower left corner of the browser window and says: starting search addition on right page this means that $products_found = false which should be the case when your search does not result in any products found. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
kbking Posted September 14, 2006 Share Posted September 14, 2006 Yes I thought so too. Then I must have done something else wrong, because as I can see the search function gives me exactly what I have searched for. What files are in use? Maybe I can replace them with unaltered files and see if that helps!? Just a thought... Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 14, 2006 Author Share Posted September 14, 2006 Yes I thought so too. Then I must have done something else wrong, because as I can see the search function gives me exactly what I have searched for. What files are in use? Maybe I can replace them with unaltered files and see if that helps!? Just a thought... are you sure you altered the correct product_listing.php or are you using a different module to display your search results? Quote Treasurer MFC Link to comment Share on other sites More sharing options...
kbking Posted September 14, 2006 Share Posted September 14, 2006 are you sure you altered the correct product_listing.php or are you using a different module to display your search results? Great question! I'm using product_listing_col.php and totally forgot that. Now everything looks good and works beautifully, thanks again! Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2006 Share Posted November 18, 2006 Amanda, First of all many thanks for this great contribution! I have a couple of questions though: I would have liked that the recent history is shown to customers whenever they return to my site. eg. they visit for the 1st time, look through some products, closes off the pc, return the next day to my site and see the recently viewed products. Is that possible with this contri? Or does there have to be a new (cookie?) code included? If this doesn't work (or is to hard to implement) I would like that it is always shown to registered customers. Like the shoppingcart that is also remembering products for registered clients. Can you show me the way? Best regards Geeraard Quote Link to comment Share on other sites More sharing options...
schoent Posted November 24, 2006 Share Posted November 24, 2006 Great contribution, only i have one problem about 1 month ago it works fine but then it's not showing any last viewed categories anymore, the rest is working fine i have changed a lot in my shop in the last month, i can't figure where the error might be. i have also reinstalled the contribution maybe it's something with the cache or sessionid, or problems with some other contribution who can help me? Quote Link to comment Share on other sites More sharing options...
boxtel Posted November 24, 2006 Author Share Posted November 24, 2006 Great contribution,only i have one problem about 1 month ago it works fine but then it's not showing any last viewed categories anymore, the rest is working fine i have changed a lot in my shop in the last month, i can't figure where the error might be. i have also reinstalled the contribution maybe it's something with the cache or sessionid, or problems with some other contribution who can help me? the only condition for adding viewed categories is : if ((isset($_GET['cPath'])) and (stristr(basename($PHP_SELF),'index.php'))) { in application_bottom. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted November 24, 2006 Author Share Posted November 24, 2006 Amanda, First of all many thanks for this great contribution! I have a couple of questions though: I would have liked that the recent history is shown to customers whenever they return to my site. eg. they visit for the 1st time, look through some products, closes off the pc, return the next day to my site and see the recently viewed products. Is that possible with this contri? Or does there have to be a new (cookie?) code included? If this doesn't work (or is to hard to implement) I would like that it is always shown to registered customers. Like the shoppingcart that is also remembering products for registered clients. Can you show me the way? Best regards Geeraard the basket is using seperate tables for that. you can use cookies so in application_bottom after: if ((isset($HTTP_GET_VARS['products_id'])) and (stristr(basename($PHP_SELF),'product_info.php'))){ $viewed->add_viewed($HTTP_GET_VARS['products_id']); you add: // get items $vi = $viewed->get_viewed_items(); // create a string from them $vis = ''; for ($i = 0; $i < sizeof($vi); $i++) { if ($i > 0) $vis .= ':'; $vis .= $vi[$i]; } // store it in the cookie tep_setcookie('vp', $vis, time()+30*24*3600, $cookie_path, $cookie_domain); this will create a cookie value of products_id:products_id:products_id then in application_top after: if (!tep_session_is_registered('viewed')) { tep_session_register('viewed'); $viewed = new viewed_products(4,10,10); you add: if (isset($_COOKIE['vp']) && tep_not_null($_COOKIE['vp'])) $viewed->viewed_items = explode(':',$_COOKIE['vp']); for categories and searches its the same routine. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
schoent Posted November 24, 2006 Share Posted November 24, 2006 the only condition for adding viewed categories is : if ((isset($_GET['cPath'])) and (stristr(basename($PHP_SELF),'index.php'))) { in application_bottom. it's still there i use several contributions maybe there is one that conflict with that i have ultimate seo urls, this contributions don't use cpath, maybe that's the conflict Quote Link to comment Share on other sites More sharing options...
Guest Posted November 24, 2006 Share Posted November 24, 2006 the basket is using seperate tables for that. you can use cookies so in application_bottom after: if ((isset($HTTP_GET_VARS['products_id'])) and (stristr(basename($PHP_SELF),'product_info.php'))){ $viewed->add_viewed($HTTP_GET_VARS['products_id']); you add: // get items $vi = $viewed->get_viewed_items(); // create a string from them $vis = ''; for ($i = 0; $i < sizeof($vi); $i++) { if ($i > 0) $vis .= ':'; $vis .= $vi[$i]; } // store it in the cookie tep_setcookie('vp', $vis, time()+30*24*3600, $cookie_path, $cookie_domain); this will create a cookie value of products_id:products_id:products_id then in application_top after: if (!tep_session_is_registered('viewed')) { tep_session_register('viewed'); $viewed = new viewed_products(4,10,10); you add: if (isset($_COOKIE['vp']) && tep_not_null($_COOKIE['vp'])) $viewed->viewed_items = explode(':',$_COOKIE['vp']); for categories and searches its the same routine. Amanda, Many thanks for the above, I will try this first thing monday and will let you know how it goes :) Best regards Small Craft Quote Link to comment Share on other sites More sharing options...
boxtel Posted November 25, 2006 Author Share Posted November 25, 2006 Amanda, Many thanks for the above, I will try this first thing monday and will let you know how it goes :) Best regards Small Craft well, you can see the result on my site as I generally test it before I advice. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Guest Posted November 27, 2006 Share Posted November 27, 2006 the basket is using seperate tables for that. you can use cookies so in application_bottom after: if ((isset($HTTP_GET_VARS['products_id'])) and (stristr(basename($PHP_SELF),'product_info.php'))){ $viewed->add_viewed($HTTP_GET_VARS['products_id']); you add: // get items $vi = $viewed->get_viewed_items(); // create a string from them $vis = ''; for ($i = 0; $i < sizeof($vi); $i++) { if ($i > 0) $vis .= ':'; $vis .= $vi[$i]; } // store it in the cookie tep_setcookie('vp', $vis, time()+30*24*3600, $cookie_path, $cookie_domain); this will create a cookie value of products_id:products_id:products_id then in application_top after: if (!tep_session_is_registered('viewed')) { tep_session_register('viewed'); $viewed = new viewed_products(4,10,10); you add: if (isset($_COOKIE['vp']) && tep_not_null($_COOKIE['vp'])) $viewed->viewed_items = explode(':',$_COOKIE['vp']); for categories and searches its the same routine. Hi Amanda, I tried this fix as above, but it doesn't work. I have to say that I do not have the below code in catalog/includes/application_top: if (!tep_session_is_registered('viewed')) { tep_session_register('viewed'); $viewed = new viewed_products(4,10,10); I have it like this: if (!tep_session_is_registered('your_recent_history')) { tep_session_register('your_recent_history'); $your_recent_history = new recent_history(4,10,10); // max products, categories, searches if (isset($_COOKIE['vp']) && tep_not_null($_COOKIE['vp'])) $viewed->viewed_items = explode(':',$_COOKIE['vp']); Maybe that's where the problem is? Hope you can help me :) Best regards Small Craft Quote Link to comment Share on other sites More sharing options...
schoent Posted December 8, 2006 Share Posted December 8, 2006 i still can't find the problem maybe someone can look at my website and give me some advice (send me a meesage) Great contribution,only i have one problem about 1 month ago it works fine but then it's not showing any last viewed categories anymore, the rest is working fine i have changed a lot in my shop in the last month, i can't figure where the error might be. i have also reinstalled the contribution maybe it's something with the cache or sessionid, or problems with some other contribution who can help me? Quote Link to comment Share on other sites More sharing options...
boxtel Posted December 8, 2006 Author Share Posted December 8, 2006 Hi Amanda, I tried this fix as above, but it doesn't work. I have to say that I do not have the below code in catalog/includes/application_top: if (!tep_session_is_registered('viewed')) { tep_session_register('viewed'); $viewed = new viewed_products(4,10,10); I have it like this: if (!tep_session_is_registered('your_recent_history')) { tep_session_register('your_recent_history'); $your_recent_history = new recent_history(4,10,10); // max products, categories, searches if (isset($_COOKIE['vp']) && tep_not_null($_COOKIE['vp'])) $viewed->viewed_items = explode(':',$_COOKIE['vp']); Maybe that's where the problem is? Hope you can help me :) Best regards Small Craft yes ofcourse, I still have the old $viewed and you have the new $your_recent_history. So you would say : $your_recent_history->viewed_items = explode(':',$_COOKIE['vp']); Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Guest Posted March 28, 2007 Share Posted March 28, 2007 yes ofcourse, I still have the old $viewed and you have the new $your_recent_history. So you would say : $your_recent_history->viewed_items = explode(':',$_COOKIE['vp']); Dear Amanda, It seems that the above is still not working. Also, I noticed an other problem: When clicking on the "also purchased" products, the result is empty. Can you (or some-one else) help me - again - on this? :blush: Many thanks Best regards Geeraard Quote Link to comment Share on other sites More sharing options...
Floob Posted June 26, 2007 Share Posted June 26, 2007 Hi, When I add the code to my footer my site goes really slow - is this adding a lot of cpu time to the pages? It speeds up when I remove the footer code. Thanks Floob. Quote Link to comment Share on other sites More sharing options...
Floob Posted June 26, 2007 Share Posted June 26, 2007 Hi, When I add the code to my footer my site goes really slow - is this adding a lot of cpu time to the pages? It speeds up when I remove the footer code. Thanks Floob. Is it related to this? note: There are 2 also purchased queries in there, the original one (default) and one based on ap preselection. I added the original one and the query switch as I assume many do not have ap preselection installed. Because an attempt is made to find an also purchased product based on the order history of all products in your history making the hit rate much larger and the statement much more true, it is recommended to use the ap preselection (which is in itself more true than the original) rather than the original one. So if your system comes to a halt while using the original one, either disable it via DEFINE('SHOW_AP', false); // show also purchased product or install ap preselection and select that query via DEFINE('AP_PRE', true); // use ap preselection query Quote Link to comment Share on other sites More sharing options...
pafranklin Posted November 2, 2007 Share Posted November 2, 2007 Hello, I have installed the very useful "Your Recent History Contribution". I have made a couple of slight changes but because of my lack of skill with PHP, I am struggling with a small element. If at all possible I would like to limit the number of products displayed (from recently viewed) to 4 products but more importantly, if the number of recently viewed products is more than 2, for this colume to split into two columns. The recently visited categoires to stay on the left of the box. Here is the code of my page so far and please would someone point me in the right direction? <?phpif (is_object($your_recent_history)) { if ( (($your_recent_history->count_viewed() > 0) || ($your_recent_history->count_searches() > 0) || ($your_recent_history->count_viewed_cats() > 0)) // we have content and ($your_recent_history->on) // we want it and ($request_type != 'SSL') // we are not secure ) { // displaying //******************************************************************************* DEFINE('SHOW_ADD', false); // show the extra product DEFINE('SHOW_AP', false); // show also purchased product DEFINE('AP_PRE', false); // use ap preselection query //******************************************************************************* require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_YOUR_RECENT_HISTORY); // initialize variable $yrh=''; // start output buffer ob_start(); echo '<table border="0" width="100%" cellspacing="0" cellpadding="0" align="center"> <tr> <td> <table border="0" width="100%" cellpadding="0" align="center"> <tr> <td> <table style="border: 1px solid gray" width="100%" align="center" cellpadding="0"> <tr> <td> <table border="0" width="100%" cellpadding="2" >'; echo '<tr> <td nowrap colspan="40" class="infoBoxHeadingBig">' . YOUR_RECENT_HISTORY . '</td> <td class="boxtext" align="left"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','lng','currency')) . 'action=vr'). '"><img src="images/erase.gif" border="0" alt="' . ERASE_MY_RECENT_HISTORY . '" title="' . ERASE_MY_RECENT_HISTORY . '"></a> <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','lng','currency')) . 'action=vs'). '"><img src="images/erase2.gif" border="0" alt="' . DO_NOT_SHOW_ME_AGAIN . '" title="' . DO_NOT_SHOW_ME_AGAIN . '"></a></td> </tr><tr>'; $row = 0; // PRODUCTS DISPLAY START /* get the products array from the class containing all products */ $items = $your_recent_history->get_viewed_items(); $n=sizeof($items); $index = 0; /* fetch the info for products */ for ($i=0; $i<$n; $i++) { $viewed_query = tep_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p where p.products_id = '" . $items[$i] . "' and pd.products_id = p.products_id and p.products_status = 1 and pd.language_id = '" . $languages_id . "'"); if ($viewed_info = tep_db_fetch_array($viewed_query)) { $items_on_display[$i] = array('id' => $items[$i], 'image' => $viewed_info['products_image'], 'name' => $viewed_info['products_name']); } else { // in case a product is recorded which is not active, set the image in language file $items_on_display[$i] = array('id' => $items[$i], 'image' => UNAVAILABLE_IMAGE, 'name' => UNAVAILABLE); } } $col = 0; $pwidth = 50; echo '<td> </td><td class="tableHeading" width="'.$pwidth.'%" valign="top" align="left">'; if ($n > 0) { $col++; echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','lng','currency')) . 'action=cp'). '"><img src="images/erase.gif" border="0" alt="' . ERASE_MY_RECENT_HISTORY . _OF_PRODUCTS . '" title="' . ERASE_MY_RECENT_HISTORY . _OF_PRODUCTS . '"></a> '.VIEWED.PRODUCTS .'<br>' . tep_draw_separator('pixel_trans.gif', '100%', 2); echo '<table cellpadding="2">'; for ($i=0; $i<$n; $i++) { echo '<tr height="40px"><td valign="top" align="center">' . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $items_on_display[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $items_on_display[$i]['image'],$items_on_display[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; echo '</td><td class="main" valign="top">'; echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $items_on_display[$i]['id']) . '">' . $items_on_display[$i]['name'] . '</a>'; echo '</td></tr>'; } echo '</table>'; } echo '</td>'; // PRODUCTS DISPLY END // CATEGORIES DISPLAY START $cats = $your_recent_history->get_viewed_cats(); $m=sizeof($cats); $index = 0; for ($i=0; $i<$m; $i++) { $mcPath_array = tep_parse_category_path($cats[$i]); $mcPath = implode('_', $mcPath_array); $v_category_id = $mcPath_array[(sizeof($mcPath_array)-1)]; $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$v_category_id . "' and cd.categories_id = '" . (int)$v_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); $category = tep_db_fetch_array($category_query); $parent_id = $category['parent_id']; if ($parent_id > 0) { $category_parent_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category['parent_id'] . "' and language_id = '" . (int)$languages_id . "'"); $category_parent = tep_db_fetch_array($category_parent_query); $parent_name = $category_parent['categories_name']; $sep = ' ~ '; } else { $parent_name = ''; $sep = ''; } $cats_on_display[$i] = array('id' => $cats[$i],'name' => $parent_name . $sep . $category[categories_name]); } $cwidth = 33; echo '<td> </td><td class="tableHeading" width="'.$cwidth.'%" valign="top" align="right">'; if ($m > 0) { $col++; echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','lng','currency')) . 'action=cc'). '"><img src="images/erase.gif" border="0" alt="' . ERASE_MY_RECENT_HISTORY . _OF_CATEGORIES . '" title="' . ERASE_MY_RECENT_HISTORY . _OF_CATEGORIES . '"></a> '.VIEWED.CATEGORIES . '<br>' . tep_draw_separator('pixel_trans.gif', '100%', 2); echo '<table cellpadding="2" cellspacing="0">'; for ($i=0; $i<$m; $i++) { echo '<tr><td valign="right">' . tep_image(DIR_WS_IMAGES . 'ico_arrow.gif', CATEGORY); echo '</td><td class="main">'; echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cats_on_display[$i]['id']) . '">' . $cats_on_display[$i]['name'] . '</a>'; echo '</td></tr>'; } echo '</table>'; } echo '</td>'; // CATEGORIES DISPLAY END // SEARCHES DISPLY START // $searches = $your_recent_history->get_searches(); // $ss=sizeof($searches); // echo '<td> </td><td class="tableHeading" width="33%" valign="top" align="left">'; // if ($ss > 0) { // $col++; // echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','lng','currency')) . 'action=cs'). '"><img src="images/erase.gif" border="0" alt="' . ERASE_MY_RECENT_HISTORY . _OF_SEARCHES . '" title="' . ERASE_MY_RECENT_HISTORY . _OF_SEARCHES . '"></a> '.SUCCESSFUL.SEARCHES . '<br>' . tep_draw_separator('pixel_trans.gif', '100%', 4); // echo '<table cellpadding="2" cellspacing="0">'; // for ($i=0; $i<$ss; $i++) { // echo '<tr><td valign="middle">' . tep_image(DIR_WS_IMAGES . 'search_icon_s.gif', SEARCH); // echo '</td><td class="main">'; // echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $searches[$i] .'&inc_subcat=1&search_in_description=1') . '">' . $searches[$i] . '</a>'; // echo '</td></tr>'; // } // echo '</table>'; // } //echo '</td>'; // SEARCHES DISPLAY END /* try to find also purchased products based on all products in the history */ /* any other than currently on the product info page */ if (SHOW_AP) { $mtm = rand(); // Also Purchased query based on Also Purchased Preselection if (AP_PRE) { # First let's get all the orders for this product $ap_query = tep_db_query("select ap.ap_id, p.products_image, p.products_price, p.products_tax_class_id, pd.products_name from ap_preselection ap, products_description pd, products p where ap.products_id in ('" . implode("','", $items) . "') and p.products_id = ap.ap_id and pd.products_id = ap.ap_id and p.products_id != '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "' and p.products_quantity >= 0 and p.products_status = '1' order by rand($mtm) limit 1 "); } else { // The original also purchased query, use this if you have no ap preselection and hope for the best (performance-wise) $ap_query = tep_db_query("select p.products_id, p.products_price, p.products_tax_class_id, p.products_image, pd.products_name from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, " . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where opa.products_id in ('" . implode("','", $items) . "') and opa.orders_id = opb.orders_id and opb.products_id != '" . (int)$HTTP_GET_VARS['products_id'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' group by p.products_id order by rand($mtm) limit 1 "); } /* if we find results, display the also purchased product */ $ap_found = false; $fwidth = ceil(100/($col+1)); if ($ap = tep_db_fetch_array($ap_query)) { $ap_found = true; $ap['special_price'] = tep_get_products_special_price($ap['products_id']); if (tep_not_null($ap['special_price'])) { $ap_price = '<s>' . $currencies->display_price($ap['products_price'], tep_get_tax_rate($ap['products_tax_class_id'])) . '</s><br>'; $ap_price .= '<span class="productSpecialPrice">' . $currencies->display_price($ap['special_price'], tep_get_tax_rate($ap['products_tax_class_id'])) . '</span>'; } else { $ap_price = $currencies->display_price($ap['products_price'], tep_get_tax_rate($ap['products_tax_class_id'])); } echo '<td width="'.$fwidth.'%" colspan="2" align="right" valign="top"> <table width="100%" align="center" border="0"> <tr> <td align="center" class="main">'; echo CUSTOMERS_HISTORY_ALSO_PURCHASED . '<br>'; echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $orders['ap_id']) . '">' . tep_image(DIR_WS_IMAGES . $ap['products_image'], $ap['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $ap['products_name'] . '</a>' . '<br>' . $ap_price; echo ' </td> </tr> </table> </td>'; } } /* if there are no also purchased results we display a random product */ /* any other than in the history or on the product info page */ if (((!SHOW_AP) && (SHOW_ADD)) || ((SHOW_AP) && (SHOW_ADD) && (!$ap_found))) { $mtm= rand(); $add_query = tep_db_query("select p.products_id, pd.products_name, p.products_image, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id not in ('" . implode("','", $items) . "') and p.products_id != '" . $HTTP_GET_VARS['products_id'] . "' and p.products_status = 1 and pd.language_id ='" . (int)$languages_id . "' order by rand($mtm) limit 1"); if ($add_info = tep_db_fetch_array($add_query)) { $add_info['special_price'] = tep_get_products_special_price($add_info['products_id']); if (tep_not_null($add_info['special_price'])) { $add_price = '<s>' . $currencies->display_price($add_info['products_price'], tep_get_tax_rate($add_info['products_tax_class_id'])) . '</s><br>'; $add_price .= '<span class="productSpecialPrice">' . $currencies->display_price($add_info['special_price'], tep_get_tax_rate($add_info['products_tax_class_id'])) . '</span>'; } else { $add_price = $currencies->display_price($add_info['products_price'], tep_get_tax_rate($add_info['products_tax_class_id'])); } echo '<td width="'.$fwidth.'%" colspan="2" valign="top" align="right"> <table align="center" border="0"> <tr> <td align="center" class="main">'; echo YOU_MAY_ALSO_APPRECIATE . '<br>'; echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $add_info['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $add_info['products_image'], $add_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $add_info['products_name'] . '</a>' . '<br>' . $add_price; echo ' </td> </tr> </table> </td>'; } } echo ' </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table>'; // put output buffer in the variable for later use $yrh = ob_get_clean(); } // Displaying } // object check ?> Thank you so much!!! Paul Quote You will never learn if you don't try. And boy am I trying....! Link to comment Share on other sites More sharing options...
Guest Posted November 19, 2008 Share Posted November 19, 2008 Dear Amanda, It seems that the above is still not working. Also, I noticed an other problem: When clicking on the "also purchased" products, the result is empty. Can you (or some-one else) help me - again - on this? :blush: Many thanks Best regards Geeraard Hi all, Amanda, It has been quite a while since I worked on this problem (I first had to tackle a few other things ;) ) However, now its time to look into this again. Does any-one have an idea why the "also purchased" result is empty (when clicking on it) Also I still need to get the Cookie thing working <_< Thanks all! Best regards Small Craft Quote Link to comment Share on other sites More sharing options...
Guest Posted November 25, 2008 Share Posted November 25, 2008 Hi all, Amanda, It has been quite a while since I worked on this problem (I first had to tackle a few other things ;) ) However, now its time to look into this again. Does any-one have an idea why the "also purchased" result is empty (when clicking on it) Also I still need to get the Cookie thing working <_< Thanks all! Best regards Small Craft Is there any-one who has had the same problem and found a solution? Best regards Small Craft Quote Link to comment Share on other sites More sharing options...
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.