close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Recently Viewed items

Thread began 10/02/2009 2:22 am by Suggs | Last modified 10/08/2009 2:21 am by Suggs | 2938 views | 6 replies |

Suggs

Recently Viewed items

Hi Folks,

Im looking for some help in setting up a recently viewed items facility on my site and was wondering what the best (and easiest way) this can be achieved.

Im wanting to have the visitor see a small thumb of the item they have just viewed and the item name...simple as that.

Thanks

Sign in to reply to this post

Eric Mittman

One way you could to this would be to store the id for the current item in a session variable on the detail page. If you only set this value on the detail page it will always be set to the last viewed item.

You can then use this session variable to filter a recordset on any page to display the details about that item. Is this the type of thing you are looking for? If so just post back with any questions you might have about the specifics and we will help you out.

If you were looking for something different let us know.

Sign in to reply to this post

Suggs

Hi Eric,
This is spot on....I just need a little help in knowing how to create the session variable and setting this up to work on the site.

Thanks

Sign in to reply to this post

Eric Mittman

The session variable would be set on the detail page, you can do it at the top. Just go to the Server Behaviors tab of the application panel and go to eCart > General > Set Session Variable. In here you can use before page load as the trigger, then for the variable just enter the name of your URL parameter for the id like this:

php:
(isset($_GET["itemID"]))?$_GET["itemID"]:""



You will need to make sure that yours matches the name of the URL parameter you use for the item id.

Once you have got this part working you will be storing the id for the current item in a session variable. Now you can just add a recordset and filter on this session variable value on any page to get details about the last viewed item. To set the recordset just create a new one, select the items table and all columns. In the filter section just select the itemID column, then select 'equals' then select 'session variable' and enter the name of your session variable. That should be all there is to it, if you have any further questions or need any help getting this working let us know.

Sign in to reply to this post

Suggs

Hi Eric,

This works great...many thanks for this.
Is there a way i can display the last 3 recently viewed items, with the newest items replacing the oldest.?

Also, the detail pages are effectively a template so when you go to view a new product, the last viewed item gets replaced with the current product you are looking at, at product level. is there a way round this? Id like the new product page to still show the last products viewed and only when i leave this page to go to another product page, does the last viewed item show.

Thanks

Sign in to reply to this post

Eric Mittman

To get item displaying correctly you should make sure that your last viewed item display code is on the pages you would like this information to appear. For the current item taking place of the last item you should move your code that sets the session variable to the very bottom of the page after all of the display stuff. This way the first time you are viewing an item there is no previous item to display, then when you view another it will display the last and also update the code to store the current one.

As for updating this to retain the last three items it is definitely possible but will require a little bit of custom coding. I think the best way to do this would be to use an array, and just add the current item to the end of this array. You should then get rid of all but the last three elements of the array, then display them in descending order.

Sign in to reply to this post

Suggs

Hi eric,

Worked a treat... Thanks for all your help with this.. You guys rock!!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...