boxtel Posted May 22, 2005 Share Posted May 22, 2005 In the released version, the only way the box shows is if the client has product viewing history. So if he/she did a search, that search was recorded but not shown until a product info was viewed. That is not right. To correct, change the displaying condition to this : if ( (($viewed->count_viewed() > 0) or ($viewed->count_searches() > 0)) // we have content and ($viewed->on) // we want it and ($request_type != 'SSL') // we are not secure and ( (tep_session_is_registered('customer_id')) or // customer (ENABLE_PAGE_CACHE == 'false') // we do not cache at all ) ) { // displaying Quote Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted May 25, 2005 Author Share Posted May 25, 2005 In the released version, the only way the box shows is if the client has product viewing history. So if he/she did a search, that search was recorded but not shown until a product info was viewed. That is not right. To correct, change the displaying condition to this : if ( (($viewed->count_viewed() > 0) or ($viewed->count_searches() > 0)) // we have content and ($viewed->on) // we want it and ($request_type != 'SSL') // we are not secure and ( (tep_session_is_registered('customer_id')) or // customer (ENABLE_PAGE_CACHE == 'false') // we do not cache at all ) ) { // displaying <{POST_SNAPBACK}> if you are using the "product not found but..." contribution along with this one. in product_info.php just after this statement : if ($product_check['total'] < 1) { you add this : $valid_product = false; just after the final else : <?php } else { you add this statement : $valid_product = true; then in the application_bottom.php we extend the if statement for adding the product with : and ($valid_product) this will prevent blank entries in the recent history list due to a product that was requested but is not active. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
paq1200 Posted March 11, 2006 Share Posted March 11, 2006 I tried to insall but when I did the index.php page goes blank. If I remove the code added to application_top.php the index.php shows up again. Not sure what to look at. Any help will be appreciated Quote Link to comment Share on other sites More sharing options...
boxtel Posted March 11, 2006 Author Share Posted March 11, 2006 I tried to insall but when I did the index.php page goes blank. If I remove the code added to application_top.php the index.php shows up again. Not sure what to look at. Any help will be appreciated in application_top: after this: // include shopping cart class require(DIR_WS_CLASSES . 'shopping_cart.php'); add this: // include viewed products class require(DIR_WS_CLASSES . 'viewed_products.php'); after this: // include the language translations require(DIR_WS_LANGUAGES . $language . '.php'); add this: // VIEWED PRODUCTS if (!$spider_flag) { if (!tep_session_is_registered('viewed')) { tep_session_register('viewed'); $viewed = new viewed_products(10); } if (isset($_GET['action'])) { if ($_GET['action'] == 'viewed_remove') { $viewed->reset(); } elseif ($_GET['action'] == 'viewed_switch') { if ($viewed->on) { $viewed->on = false; } else { $viewed->on = true; } } } } Quote Treasurer MFC Link to comment Share on other sites More sharing options...
paq1200 Posted March 12, 2006 Share Posted March 12, 2006 thanks for the help now it shows up twice at the bottom of the page Quote Link to comment Share on other sites More sharing options...
paq1200 Posted March 12, 2006 Share Posted March 12, 2006 thanks for the help now it shows up twice at the bottom of the page I also noticed I have to refresh the page to get the items to show up Quote Link to comment Share on other sites More sharing options...
paq1200 Posted March 12, 2006 Share Posted March 12, 2006 thanks for the help now it shows up twice at the bottom of the page I figured this one out. I had it in the footer twice? DUH Is there a way to get the image that shows up in the "Do you remember me" section to make it smaller? Quote Link to comment Share on other sites More sharing options...
boxtel Posted March 12, 2006 Author Share Posted March 12, 2006 I also noticed I have to refresh the page to get the items to show up that is why it is called history. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
phoenixx Posted March 13, 2006 Share Posted March 13, 2006 Has anyone had any luck in getting Your Recent History to work w/ STS Plus? For the record I have the cache set to false and did make the recommended file change // include the language translations require(DIR_WS_LANGUAGES . $language . '.php'); Quote Link to comment Share on other sites More sharing options...
qiutian Posted May 14, 2006 Share Posted May 14, 2006 Did everything told in the package and here as well. but it says 'Call to undefined function tep_session_is_registered()' in application_top.php I am using STS and there is not any other contributes installed. Quote Link to comment Share on other sites More sharing options...
Foxtel Posted September 6, 2006 Share Posted September 6, 2006 Amanda, I been using some of your other contributions and I cant thank you enough for your excellent support and work. I just installed Your Recent History V2.0 and I have a few questions I hope you can help me with. This is what shows up after a few product clicks and a few keyword searches Your Recent History Disciples: Sacred Lands Microsoft Internet Keyboard PS/2 Hewlett Packard LaserJet 1100Xi Beloved The Wheel Of Time Matrox G400 32MB Speed 2: Cruise Control dog cat monkey Beloved tiger kick fu hey egg white y Do you remember this one? IMAGE Maxtrox G400 32MB Is there a way to prevent search keywords that are not in the DB from showing up in the Recent History? I'm able to type any keyword in the search and it will show up in the searches column. Is there a way to show the product images for the products column? Could the categories selected also show up in the recent history? Also, give the option to clear some of the history while keeping the other history? Example: In history we have Products, Catalog and Searches be able to clear any of the three while keeping the other two or any other combination. This will be a great addition to the shop. Thank you.Regards,Marizka Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 7, 2006 Author Share Posted September 7, 2006 Amanda, I been using some of your other contributions and I cant thank you enough for your excellent support and work. I just installed Your Recent History V2.0 and I have a few questions I hope you can help me with. This is what shows up after a few product clicks and a few keyword searches Your Recent History Disciples: Sacred Lands Microsoft Internet Keyboard PS/2 </a><a href="http://localhost/os_051113_v1/product_info.php?products_id=27&osCsid=2d2768eb89606e1a639b2c1998c4f5de" target="_blank">Hewlett Packard LaserJet 1100Xi Beloved </a><a href="http://localhost/os_051113_v1/product_info.php?products_id=23&osCsid=2d2768eb89606e1a639b2c1998c4f5de" target="_blank">The Wheel Of Time </a><a href="http://localhost/os_051113_v1/product_info.php?products_id=2&osCsid=2d2768eb89606e1a639b2c1998c4f5de" target="_blank">Matrox G400 32MB Speed 2: Cruise Control dog cat </a><a href="http://localhost/os_051113_v1/product_info.php?products_id=27&osCsid=2d2768eb89606e1a639b2c1998c4f5de" target="_blank">monkey Beloved </a><a href="http://localhost/os_051113_v1/product_info.php?products_id=23&osCsid=2d2768eb89606e1a639b2c1998c4f5de" target="_blank">tiger </a><a href="http://localhost/os_051113_v1/product_info.php?products_id=2&osCsid=2d2768eb89606e1a639b2c1998c4f5de" target="_blank">kick fu hey egg white y Do you remember this one? IMAGE Maxtrox G400 32MB Is there a way to prevent search keywords that are not in the DB from showing up in the Recent History? I'm able to type any keyword in the search and it will show up in the searches column. Is there a way to show the product images for the products column? Could the categories selected also show up in the recent history? Also, give the option to clear some of the history while keeping the other history? Example: In history we have Products, Catalog and Searches be able to clear any of the three while keeping the other two or any other combination. This will be a great addition to the shop. Thank you.Regards,Marizka well, yes to all as the current version I am using does exactly those things. I did remove the "remember me" thing as I only show the 4 latest products (with images the box will get rather long with more) and then remember me is kind of silly so I simply show the also purchased item and if there is none I show a random featured item. I will have to release it as a contrib though, maybe sometime this week as I need to re-normalize it for default stores. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Foxtel Posted September 7, 2006 Share Posted September 7, 2006 well, yes to all as the current version I am using does exactly those things.I did remove the "remember me" thing as I only show the 4 latest products (with images the box will get rather long with more) and then remember me is kind of silly so I simply show the also purchased item and if there is none I show a random featured item. I will have to release it as a contrib though, maybe sometime this week as I need to re-normalize it for default stores. Amanda, Thank you, a contribution release would be great. Regards, Marizka Quote Link to comment Share on other sites More sharing options...
Foxtel Posted September 11, 2006 Share Posted September 11, 2006 Amanda, On installation step 6 in the module product_listing.php right after : new contentBox($info_box_contents, '#ffffff'); we add: $products_found = true; and right after : $info_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); new contentBox($info_box_contents); we add: $products_found = false; I did a search on file \includes\modules\product_listing.php for new contentBox($info_box_contents, '#ffffff'); and $info_box_contents[0][] and no search result are found. I also tried to shortening the search to new contentBox and $info_box_contents but still on search results are found. I also tried to do an entire search on the project and the only instance return that match $info_box_contents[0][] was found in shopping_cart.php. I'm I over looking something? I also tried the same search on the stock version of product_listing.php but still no search results found. Regards, Marizka Quote Link to comment Share on other sites More sharing options...
JIM454 Posted September 11, 2006 Share Posted September 11, 2006 Amanda, On installation step 6 in the module product_listing.php right after : new contentBox($info_box_contents, '#ffffff'); we add: $products_found = true; and right after : $info_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); new contentBox($info_box_contents); we add: $products_found = false; I did a search on file \includes\modules\product_listing.php for new contentBox($info_box_contents, '#ffffff'); and $info_box_contents[0][] and no search result are found. I also tried to shortening the search to new contentBox and $info_box_contents but still on search results are found. I also tried to do an entire search on the project and the only instance return that match $info_box_contents[0][] was found in shopping_cart.php. I'm I over looking something? I also tried the same search on the stock version of product_listing.php but still no search results found. Regards, Marizka Like Marizka I did a search on file \includes\modules\product_listing.php for new contentBox($info_box_contents, '#ffffff'); and $info_box_contents[0][] and no search result are found. I also tried to shortening the search to new contentBox and $info_box_contents but still on search results are found. I also tried to do an entire search on the project and the only instance return that match $info_box_contents[0][] was found in shopping_cart.php. I'm I over looking something? I also tried the same search on the stock version of product_listing.php but still no search results found. Rick Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 12, 2006 Author Share Posted September 12, 2006 Amanda, On installation step 6 in the module product_listing.php right after : new contentBox($info_box_contents, '#ffffff'); we add: $products_found = true; and right after : $info_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); new contentBox($info_box_contents); we add: $products_found = false; I did a search on file \includes\modules\product_listing.php for new contentBox($info_box_contents, '#ffffff'); and $info_box_contents[0][] and no search result are found. I also tried to shortening the search to new contentBox and $info_box_contents but still on search results are found. I also tried to do an entire search on the project and the only instance return that match $info_box_contents[0][] was found in shopping_cart.php. I'm I over looking something? I also tried the same search on the stock version of product_listing.php but still no search results found. Regards, Marizka right, in the stock product_listing it looks like this: $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => 'class="productListing-data"', 'text' => $lc_text); } } new productListingBox($list_box_contents); $products_found = true; } else { $products_found = false; $list_box_contents = array(); $list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Foxtel Posted September 12, 2006 Share Posted September 12, 2006 right, in the stock product_listing it looks like this: Amanda, Thank You. On installation step 5 looks like you show two solutions one for none cache pages and another for cache pages. I used this code witch looks to be for none cache pages include(DIR_WS_MODULES . 'your_recent_history.php'); echo $yrh; without any issues. I would like to take advantage of being able to cache pages and use this code witch looks to be the one used for cache pages if (!stristr($PHP_SELF,'checkout')) { // not during checkout pages if ($we_cache) { // we cache this page echo '<%YRH%>'; // placeholder } else { include(DIR_WS_MODULES . 'your_recent_history.php'); // create the box echo $yrh; // display the box } } For the page cache contribution would it be this one? http://www.oscommerce.com/community/contributions,2561/ In the if ($we_cache) where is $we_cache initialized? I'm not familiar with this syntax <%YRH%> is that related to $yrh somehow? How is <%YRH%> initialized? echo '<%YRH%>'; // placeholder Is this how we output the box if we have a cache page? Thank you for your support, I appreciate your help. Regards, Marizka Quote Link to comment Share on other sites More sharing options...
jenso Posted September 12, 2006 Share Posted September 12, 2006 I installed the contrib according to the instruction, but nothing is showing. Of course I clicked on some products, made a search or two, but nothing is showing. So I started to remove one line in modules/your_recent_history.php // line 1 if (is_object($your_recent_history)) { I also removed the "}" at the end of the file... Now I get the following error message on my page: Fatal error: Call to a member function on a non-object in /homepages/..../shopping/includes/modules/your_recent_history.php on line 4 This line 4 has the following code: (($your_recent_history->count_viewed() > 0) || ($your_recent_history->count_searches() > 0) || ($your_recent_history->count_viewed_cats() > 0)) // we have content the functions are called in application top and also the variable should be set there, or am I wrong? So why it does not work? Even so I removed this one line in modules/your_recent_history.php, the contrib should work. Especially after I produced a history of click and search... So does anyone has a good idea of how I can get it to work, especially since some people are using this contrib already. the store is running on: My Server infoOperating System Linux infong 2.4 #1 SMP Thu Jan 13 08:59:31 CET 2005 i686 unknown Webserver Apache/1.3.37 (Unix) Php version 4.4.4 MySQL version 4.0.27-standard-log Can someone help or do you need more info? Cheers Rich Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 12, 2006 Author Share Posted September 12, 2006 Amanda, Thank You. On installation step 5 looks like you show two solutions one for none cache pages and another for cache pages. I used this code witch looks to be for none cache pages include(DIR_WS_MODULES . 'your_recent_history.php'); echo $yrh; without any issues. I would like to take advantage of being able to cache pages and use this code witch looks to be the one used for cache pages if (!stristr($PHP_SELF,'checkout')) { // not during checkout pages if ($we_cache) { // we cache this page echo '<%YRH%>'; // placeholder } else { include(DIR_WS_MODULES . 'your_recent_history.php'); // create the box echo $yrh; // display the box } } For the page cache contribution would it be this one? http://www.oscommerce.com/community/contributions,2561/ In the if ($we_cache) where is $we_cache initialized? I'm not familiar with this syntax <%YRH%> is that related to $yrh somehow? How is <%YRH%> initialized? echo '<%YRH%>'; // placeholder Is this how we output the box if we have a cache page? Thank you for your support, I appreciate your help. Regards, Marizka well, I think I am using an older version of page cache and I did not upgrade as it is highly modified. Still, the principle is the same and is actually used in the page cache contribution itself for the shopping cart box and the session id. $we_cache is a variable I set for the normal condition of caching or not. that condition is rather long and it is used in application_top, tep_href_link and all other places where you want to set a placeholder. As I do not want to have that long condition all over the place, I check it once and set a single variable I can use instead. <%YRH%> is just a chosen placeholder name. You can use whatever you like as long as it is a string which is unique (not normally occurring in your html output) as this string is replaced with the actual html for it. Because the "Your recent history" box is client specific, just like the shopping cart box and the session id, you cannot write them into a page cache file as that content is common for all. So you write placeholders instead and let the page cache class replace those placeholders with the actual specific content before the cached page is sent out. So in the page cache class you would have a construction like: 1) read the page file in $page_contents 2) include(DIR_WS_MODULES . 'your_recent_history.php'); // create the box in $yrh variable 3) $page_contents = str_replace ('<%YRH%>',$yrh,$page_contents) 4) send out $page_contents Quote Treasurer MFC Link to comment Share on other sites More sharing options...
kbking Posted September 12, 2006 Share Posted September 12, 2006 Hi! I had v.2.0 installed since before. Now I replaced it with v.3.0. But I can't make v.3.0 to work properly. Products and Categories works fine, but Searches doesn't show up. You may also appreciate... works fine, it shows up correct like this: mini-AEngel-p-245.html, but Customers who bought products in Your Recent History also purchased our... doesn't. The name of the product is wrong, it shows like this: -p-245.html. And there is only a place holder instead of the actual image. What am I doing wrong here? Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 12, 2006 Author Share Posted September 12, 2006 Hi!I had v.2.0 installed since before. Now I replaced it with v.3.0. But I can't make v.3.0 to work properly. Products and Categories works fine, but Searches doesn't show up. You may also appreciate... works fine, it shows up correct like this: mini-AEngel-p-245.html, but Customers who bought products in Your Recent History also purchased our... doesn't. The name of the product is wrong, it shows like this: -p-245.html. And there is only a place holder instead of the actual image. What am I doing wrong here? ah stupid, my mistake: this line: 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>' . should be : echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $ap['ap_id']) . '">' . tep_image(DIR_WS_IMAGES . $ap['products_image'], $ap['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $ap['products_name'] . '</a>' . wrong array name. with regard to the search, 1) you did have results on the search? 2) you did add the $products_found = true/false flags in product listing? Quote Treasurer MFC Link to comment Share on other sites More sharing options...
kbking Posted September 12, 2006 Share Posted September 12, 2006 ah stupid, my mistake: this line: 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>' . should be : echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $ap['ap_id']) . '">' . tep_image(DIR_WS_IMAGES . $ap['products_image'], $ap['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $ap['products_name'] . '</a>' . wrong array name. with regard to the search, 1) you did have results on the search? 2) you did add the $products_found = true/false flags in product listing? in the above, I also changed $ap['ap_id'] to $ap['products_id'] and now Customers who bought products in Your Recent History also purchased our... seems to work. Searches still not showing up though! 1) yes 2) yes My code in product_listing.php: $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; break; } $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => 'class="productListing-data"', 'text' => $lc_text); } } new productListingBox($list_box_contents); $products_found = true; } else { $products_found = false; $list_box_contents = array(); $list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); new productListingBox($list_box_contents); } Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 12, 2006 Author Share Posted September 12, 2006 in the above, I also changed $ap['ap_id'] to $ap['products_id'] and now Customers who bought products in Your Recent History also purchased our... seems to work. Searches still not showing up though! 1) yes 2) yes My code in product_listing.php: $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; break; } $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => 'class="productListing-data"', 'text' => $lc_text); } } new productListingBox($list_box_contents); $products_found = true; } else { $products_found = false; $list_box_contents = array(); $list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); new productListingBox($list_box_contents); } better change this: $ap_query = tep_db_query("select p.products_id, to this: $ap_query = tep_db_query("select p.products_id as ap_id, so the 2 queries return the same fields. what if you alter in application_bottom.php: this: if (stristr(basename($PHP_SELF),'advanced_search_result.php')) { if ($products_found) { $your_recent_history->add_search(trim(strtolower($_GET['keywords']))); } } to this: if (stristr(basename($PHP_SELF),'advanced_search_result.php')) { if ($products_found) { $your_recent_history->add_search(trim(strtolower($HTTP_GET_VARS['keywords']))); } } those $_GET and $HTTP_GET_VARS are not always the same. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
kbking Posted September 12, 2006 Share Posted September 12, 2006 Thanks, but it made no difference. Quote Link to comment Share on other sites More sharing options...
boxtel Posted September 12, 2006 Author Share Posted September 12, 2006 Thanks, but it made no difference. ok, well then we have some tracing to do. replace that section: if (stristr(basename($PHP_SELF),'advanced_search_result.php')) { if ($products_found) { $your_recent_history->add_search(trim(strtolower($HTTP_GET_VARS['keywords']))); } } with: 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); } } Quote Treasurer MFC 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.