Piemol Posted December 25, 2009 Share Posted December 25, 2009 (edited) navigationHistory remembering x number of pages v1.0 Author: Piemol Date: 25-12-2009 === Forum: http://www.oscommerce.com/forums/topic/351149-contribution-navigationhistory-remembering-x-number-of-pages-v10/ Contribution: http://addons.oscommerce.com/info/7176 === What this is: This enhanced navigationHistory class, remembers the last x number of pages you visited. The original osCommerce class works like this: - If you visit product A, then product B, it only remembers product B. - If you visit category C, then category D, it only remembers category D. - If you visit category C, then several products/non-category pages, then category D, it only remembers category D and the products and other pages are gone!. - Some pages will be remembered forever, if you visit the contact page, then hundreds of products, the contact page is still in the history! So this is not my vision of a 'history', and not very conistent in my opinion. That's why I created my version, that just remembers all of the visited pages (default to a maximum of six, just change the number to something more suitable for you), except when you refreshed or visit the same page over and over again. And because of its consistency, you can easily use this class to go back one or two or six pages in history. While the original class sometimes erases a lot of pages from its memory (the third case in how the original class works), this one can just jump back to the last page where you really were. === How to install (after backups!): - If you didn't modify "catalog/includes/classes/navigation_history.php" you can just back it up and replace it with mine. - If you did modify it, you can replace the whole function add_current_page with mine, if you modified the function you'll have to check what I made. Not too difficult to see I hope. === See the changes yourself: Place this code somewhere in the footer before and after you 'installed' this class to see the differences while you browse your shop: <?php print_r($navigation); ?> === Hope you like this contribution ! Please give me some feedback about this contribution, it's my first one! Edited December 25, 2009 by Piemol Quote Link to comment Share on other sites More sharing options...
russischblauekatze Posted December 25, 2009 Share Posted December 25, 2009 Hello Piemol, Thank you for your great new navigation_history.php. It solves my problem with returning to the right page number from the categories list after clicking the continue shopping button! But there's still a problem: You get stuck in the shopping cart after refreshing it if you have changed the quantity of an item or removed it. Merry Christmas to you. Birgit Quote Link to comment Share on other sites More sharing options...
Piemol Posted December 25, 2009 Author Share Posted December 25, 2009 Hello Piemol, Thank you for your great new navigation_history.php. It solves my problem with returning to the right page number from the categories list after clicking the continue shopping button! But there's still a problem: You get stuck in the shopping cart after refreshing it if you have changed the quantity of an item or removed it. Merry Christmas to you. Birgit With 'get stuck' you mean, if you press the continue shopping button after updating, and still are in the shopping cart? Maybe i can make a work around for that, but there is also a other solution for that: http://www.oscommerce.com/forums/topic/340127-continue-shopping/page__p__1425102__hl__continue%20shopping__fromsearch__1entry1425102 Merry Christmas to you too :) Quote Link to comment Share on other sites More sharing options...
russischblauekatze Posted December 25, 2009 Share Posted December 25, 2009 With 'get stuck' you mean, if you press the continue shopping button after updating, and still are in the shopping cart? Yes, that's what I mean. :) When you press "update" and after that "continue shopping" you stay in the shopping_cart instead of returning to the place you came from. I'm sorry but it seems to be a bug in your contrib, because it doesn't happen with the default navigation_history.php. And I'd really like to use it , because it's the first one that solves the problem in the categories with the return to the result page (e.g. page 3) instead of always returning to page 1. And after testing your contrib, I saw the solution is in the navigation_history - and nowhere else...! Quote Link to comment Share on other sites More sharing options...
Piemol Posted December 26, 2009 Author Share Posted December 26, 2009 Oké, then I'll look if I can make a fix for the shoppingcart :) hope its the only page that needs a workaround else my new class isn't well designed :) Thank you very much for your feedback! Quote Link to comment Share on other sites More sharing options...
Piemol Posted December 28, 2009 Author Share Posted December 28, 2009 Heya, I've updated this contribution. Now the shopping_cart problem is fixed. New in v1.01:Added an array of pages that won't be added to the navigationhistory if it's the same php file but different cause of the GET-variables. So for example the shopping cart won't be added again to the history if you update the cart with the button present on that page. If you have more pages like this, then add them to the array $pages_to_exclude. You can also reverse this feature. You make the if-statement to only compare if the last page is the same as one in the array, for example index.php and products_info.php. Only those pages may be compared and added to the array, all other pages with the same filename but different GET-variables will be added to the navigationhistory. Hope this is an idea, maybe the idea to reverse this method is a lot better? So you'll get an array like: $pages_to_include = array{'index.php', 'products_info.php'); But I have like 8 or 9 pages like that, so the array will be a lot larger then the one with files to exclude, if you know what I mean. Quote Link to comment Share on other sites More sharing options...
Onnootje Posted December 28, 2009 Share Posted December 28, 2009 Anyone who has made this into a sort of history-crumb? I would like to make a addition at the bottom of my site saying "Last pages you have visited: productA | category1 | productB | productC | ..." where there are never duplicates in the array. It is important to have the real category and product titles, so it is understandable to the customer... Quote Link to comment Share on other sites More sharing options...
Piemol Posted December 28, 2009 Author Share Posted December 28, 2009 Anyone who has made this into a sort of history-crumb? I would like to make a addition at the bottom of my site saying "Last pages you have visited: productA | category1 | productB | productC | ..." where there are never duplicates in the array. It is important to have the real category and product titles, so it is understandable to the customer... Well as you can see this contribution is kinda 'young'. There allready is a contribution named "your recent history" that 'remembers' the last products and searches (http://addons.oscommerce.com/info/3204), maybe you can use that (add the categories to it)? You can also rewrite this one so it also remembers pagetitles, and add a function to make the history-crumbs. Then it would be a new contrib. But what benefit will it be over the back button in your browser then? Quote Link to comment Share on other sites More sharing options...
Onnootje Posted December 29, 2009 Share Posted December 29, 2009 I've tried to strip down the recent history contribution to just a single line that lists the last 5 products that are viewed. It kept giving errors though, my php skills aren`t that great... Maybe I will give it a try using yours as the startingpoint these days... I think it would be a nice addition, it's more then just a back button. 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.