Jump to content
b00

[Contribution] Recently Viewed Products(sales optimized)

Recommended Posts

The Recently Viewed Addon uses a session variable to store data. The box will disappear if session is lost. This is a serious problem with your store, since the customer's cart will also be lost if session is lost. Try adding something to the cart, without logging in, and see if the cart box disappears at the same time as the Recently Viewed box. If it does, the problem is loss of session. The usual cause of this is links that do not carry session, i.e. links that are not made with the osC tep_href_link() function.

 

Regards

Jim

 

No, I can add products that I viewed to my shopping not logged in, and they are not lost, but my Recently View box still disappears. As I click on other products, and add them to my shopping cart, the Recently View box will sometimes disappear, then reappear when view another product.

Share this post


Link to post
Share on other sites

Check that the code you added for Recently Viewed is not placing the box in a conditional statement that is not always on. The box is included catalog/includes/column_right.php.

 

If that is not the problem, you'll have to debug the session code. Start bt putting a print statement in the header to print out the session variable at the top of every page. If that variable comes up blank, that's where it's being lost.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Check that the code you added for Recently Viewed is not placing the box in a conditional statement that is not always on. The box is included catalog/includes/column_right.php.

 

If that is not the problem, you'll have to debug the session code. Start bt putting a print statement in the header to print out the session variable at the top of every page. If that variable comes up blank, that's where it's being lost.

 

Regards

Jim

 

http://addons.oscommerce.com/info/5520

 

Hi Jim,

 

I just came across this contribution and I'm going to install your v2.0. I was just wondering, are you still installing this in your own sites and if so, are there any code changes since the time you updated it a while back that you might recommend? There are some 'updates' for tax calculations, invalid HTML codes, and compatibility with 'show soldout items', but I can't tell from this forum whether those others are really necessary or not. I'm running 2.2RC2a with all the bug and security fixes for 2.3.

 

Thanks,

 

Nick

Share this post


Link to post
Share on other sites

I'm still running the same code on several stores, all of which are kept up to date. I have no idea if any of those other versions do anything useful, as I haven't tried any of them. Caveat emptor.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I'm still running the same code on several stores, all of which are kept up to date. I have no idea if any of those other versions do anything useful, as I haven't tried any of them. Caveat emptor.

 

Regards

Jim

 

 

Ok I'll give it a try. Thanks again Jim.

Share this post


Link to post
Share on other sites

The code we added depends on the existing product check query. The product check query code seems to be missing from your file, so we need to add it back in. Find this:

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

and add this after it:

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

Regards

Jim

 

Hey Jim,

 

After reading through the forum, I was able to get this to work. The confusion that I and maybe a couple of people back in early 2009 had was that this product check was taken out because of Spooks' Simple multi-image w/ FancyBox addon.

 

4. Open product_info.php

 

Find (17)

 

$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_check = tep_db_fetch_array($product_check_query);

 

Replace with:

 

// Simple multi image addon

$image_group = TINY_IMAGE_GROUP_SIZE; //Number of images to show per row/column

$vertical_format = (ADDITIONAL_IMAGE_FORMAT == 'vertical');

$max_title_length = 40; //Set the maximm length of popup titles before they are broken into multiple lines.

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_array, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

$products_image_array = unserialize($product_info['products_image_array']);

if (!is_array($products_image_array)) $products_image_array = array();

// EOF Simple multi image addon

 

Everything seems to work great now, but since Spooks has left the building, could I ask if you foresee any hidden problems with reintroducing this code into product_info.php? I know that I'm asking you to comment on someone else's add-on, and if you can't, I understand.

 

Just one more question... For the bottom box, where in includes/modules/recently_viewed.php would I edit to change the class? I just need to change the background color of the box.

 

Thanks again for updating this contribution. This really should be a must-install for most people.

Share this post


Link to post
Share on other sites

Adding that code back in won't cause any major problems. It might be a bit faster to use the query from Spooks' addon and just count the number of rows it returns. Probably not a big enough difference to be worth worrying about unless you have a major site speed problem.

 

The box uses the stock osCommerce Content Box. See catalog/includes/modules/recently_viewed.php, Line 244 in the stock file. Changing the CSS class of that will change all of the content (module) boxes in osCommerce. To change just this one, you need to create a new box class modeled on the existing contentBox, with a different CSS class for the contents.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Adding that code back in won't cause any major problems. It might be a bit faster to use the query from Spooks' addon and just count the number of rows it returns. Probably not a big enough difference to be worth worrying about unless you have a major site speed problem.

 

The box uses the stock osCommerce Content Box. See catalog/includes/modules/recently_viewed.php, Line 244 in the stock file. Changing the CSS class of that will change all of the content (module) boxes in osCommerce. To change just this one, you need to create a new box class modeled on the existing contentBox, with a different CSS class for the contents.

 

Regards

Jim

 

 

Got it... Thanks for all the help Jim. Everything works perfectly.

Share this post


Link to post
Share on other sites

Hi there,

 

Just looking for something to achieve a similar effect to the one used on this site and wondered if this would do the trick?

 

http://www dot dirtbikexpress dot co dot uk

 

Checkout the small red box on the left

 

any thoughts?

 

Dave

Share this post


Link to post
Share on other sites

That site is using a Javascript popup box for their recently viewed addon. This one uses a plain old osCommerce 2.2x column box. I suppose you could convert it to Javascript.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I would like to place a link in one of my left hand boxes and not showing the other boxes on the site (was thinking about putting it in my Categories box or Information Box) - But I would like that link only to appear once the customer has "Recently Viewed" something. Has anyone done this and if so would you mind sharing the code?

Share this post


Link to post
Share on other sites

Jim,

 

Thanks for your support on this great add-on. I am just wondering out loud.

 

Currently my shopping_cart session is extended to 7 days. However, recently viewed should be extended to 14 days.

 

Wouldn't it better if the data for recently viewed was stored in cookie rather than session? What is your opinion on that?

Share this post


Link to post
Share on other sites

Session is maintained by the cookie if a cookie exists. If the customer does not accept cookies the session is maintained by the osCsid. Using cookies alone would mean that some customers would not see the Recently Viewed items. It's up to you if you want that restriction.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I can't take credit for this one. I just added onto other people's work.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Hy Jim,

 

I use version 2.2RC2a OSC. and then we implemented Recently Viewed 2.0 but not know why I do not display any one product, price.

 

Any idea what could be?

 

Thanks a lot.

 

PS: Sorry for my English

Share this post


Link to post
Share on other sites

Hi Everyone here,

 

I've installed the mod and run smoothly but one thing still make me wandering. I thought the mod doesn't memorize the recently viewed record until that I found other site which installed the same mod has the function to recall the record even I shut down the computer and surf their web page (no Login though).

 

I realize that was my own problem. I found that my web site doesn't memory the recently viewed record even I'd only close the browser and reopen a new browser. Is there something wrong I missed or done wrong?

 

I just know a little php knowledge but not enough to figure it out, please anyone can help me out from this?

 

thanks

 

Jay

 

p.s. I wish this mod has the function, I mean a button to let the site viewer able to reset their recently viewed record to 0 (clear the history).

Edited by ezbiker

Share this post


Link to post
Share on other sites

You can always ask. Remember that the forum doesn't always tell me that someone has posted (it didn't this time) or I may be away from the computer, so have some patience.

 

This Addon stores the data in the server Session, so it needs a cookie or a SID to store the session data. A different browser won't have that cookie so the data will not be available there. If your browser is set to delete cookies when you shut down, then the data is lost when you shut down. I don't know any way to overcome this. Well, not without hacking your computer, which I refuse to do.

 

It should be possible to code a button that clears the data. It just needs to destroy the session variable. Let me think about this a bit.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

You can always ask. Remember that the forum doesn't always tell me that someone has posted (it didn't this time) or I may be away from the computer, so have some patience.

 

This Addon stores the data in the server Session, so it needs a cookie or a SID to store the session data. A different browser won't have that cookie so the data will not be available there. If your browser is set to delete cookies when you shut down, then the data is lost when you shut down. I don't know any way to overcome this. Well, not without hacking your computer, which I refuse to do.

 

It should be possible to code a button that clears the data. It just needs to destroy the session variable. Let me think about this a bit.

 

Regards

Jim

 

Jim, you are such pro and kind... many thanks!

 

I have been to a site (own by one of the member of this forum). The viewed data will show each time I back to their site even I reboot the computer. According to your clue, can I think that the problem were probably to my server? If so, what should I do?

 

Thanks,

Jay

Share this post


Link to post
Share on other sites

Can you add multiple items to a cart and check out? Can you still do that if you reboot in the middle of that process?

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Can you add multiple items to a cart and check out? Can you still do that if you reboot in the middle of that process?

 

Regards

Jim

 

Jim, yes I can add multiple items to a cart and check out for sure (just confirmed) and reboot in the middle of that process (just tried in checkout_shipping and checkout_payment).

 

 

p.s. I pm you the website address...sorry for pm, because the site still underconstruction now.

Edited by ezbiker

Share this post


Link to post
Share on other sites

The Recently Viewed data is stored in the same place as the shopping cart data. If you can check out after a reboot/browser restart, then the Recently Viewed box should work as well. I just tried it and it worked for me. Maybe it's something in your browser?

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

The Recently Viewed data is stored in the same place as the shopping cart data. If you can check out after a reboot/browser restart, then the Recently Viewed box should work as well. I just tried it and it worked for me. Maybe it's something in your browser?

 

Regards

Jim

Hi Jim,

 

I did tried different computer by office and home, but still in same result..oh, I forgot to tell, I just test my site as guest and put something in to the cart. Then close the browser reopen it..cart is empty! But it's okay if I login as memeber to put something in the cart everything data may store but the recently viewed.

 

Sorry for wasting your time to this issue. Can you point me to some files or code that I can check if any mistake around?

 

best,

Jay

 

p.s. Please let me know if you need my server login name and password, as easy to run through...thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×