Jump to content
medvid

Who's Online Enhancement 1.4

Recommended Posts

Matt,

 

I would suggest it's the eBay thing.  Whos Online doesn't do anything with a supercart class.

 

Any one have both contribs working together?

 

Ed

 

Awesome contribution, love it.

 

Did anyone ever find a work around for people not using mysql for their session files? I was told to not use mysql for sessions unless you had high traffic or it just slowed the site down (not a lot, but ever bit helps). So I don't use mysql for sessions.

 

Anyone figure it out?

Share this post


Link to post
Share on other sites

This forums seems to have quited down for it's hay day in December but I will still post and see if I get a response.

 

What does inactive/cart really mean.

 

I notice that I get customers for an ad that I have placed called /?ad=targeted.

 

They are usually listed as active cart at first then within a short amount of time turn to inacitve/cart.

 

So what does inactive and active cart mean.

 

Thank you.

 

Leon Sargent

Share this post


Link to post
Share on other sites

Leon,

 

The codes mean:

Active/Cart - Last Click < 3 minutes ago and user has something in their cart

Active/No Cart - Last Click < 3 minutes ago and nothing in cart

Inactive/Cart - Last Click > 3 minutes ago and user has something in their cart

Inactive/No Cart - Last Click > 3 minutes ago and nothing in cart

 

I think you're seeing a temporary, false positive. I get them occasionally myself. I released the last couple of WOE versions but I haven't touched the cart/no cart code so I can't say why it happens except to guess that the user is hitting the site (and hence, updating database tables) at the same time WOE refreshes.

 

ed


Answers to osCommerce's most persistent questions! Tips & Tricks | Configuration | Common Problems.

Seek and ye shall find Contributions.

My Contributions

My Blog

Share this post


Link to post
Share on other sites

I'm getting this error when viewing the file catalog/admin.whos_online.php and I can't work out what it is that would be causing it. (The old Who's Online worked without trouble).

 

I believe the error is actually a call from the file: catalog/admin.includes/classes/shopping_cart.php.

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/trublue/public_html/shop/admin/includes/functions/database.php on line 45

0 -

 

select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_weight, p.products_tax_class_id from products p, products_description pd where p.products_id= '452' and pd.products_id = p.products_id and pd.language_id = '1'

 

[TEP STOP]

Does anyone know what/why this would be?

Share this post


Link to post
Share on other sites

John,

 

Which version of WOL are you using? Can you post lines 445 - 455 from database.php and a couple lines before and after (and the line) from shopping_cart.php where you think the call is coming from?

 

Thanks,

Ed


Answers to osCommerce's most persistent questions! Tips & Tricks | Configuration | Common Problems.

Seek and ye shall find Contributions.

My Contributions

My Blog

Share this post


Link to post
Share on other sites
John,

 

Which version of WOL are you using?  Can you post lines 445 - 455 from database.php and a couple lines before and after (and the line) from shopping_cart.php where you think the call is coming from?

 

Thanks,

Ed

Ed

 

Thanks for your help.

 

I'm using 1.5b and I've checked it against 1.5 and can not find any differences that might cause this problem.

 

Below is the error lines from Database.php (I assume you meant 45 -55, because the file only goes upto 150 lines anyway. Below lines 40 - 55.

    if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
     if (!is_object($logger)) $logger = new logger;
     $logger->write($query, 'QUERY');
   }

// Line 45 below
   $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

   if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
     if (mysql_error()) $logger->write(mysql_error(), 'ERROR');
   }

   return $result;
 }

 function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {
   reset($data);

 

Below is Shopping_cart.php (my lines 256 - 263). Erroring on line $products_query = tep_db_query

      if (!is_array($this->contents)) return 0;
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
       $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id= '" . (int)tep_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
       if ($products = tep_db_fetch_array($products_query)) {
         $prid = $products['products_id'];
         $products_price = $products['products_price'];

Thanks Ed

 

John

Share this post


Link to post
Share on other sites

P.S. to the above notice.

This error only occurs when there is something in the shopping cart.

Active Carts and Inactive Carts. whether logged in or not.

Share this post


Link to post
Share on other sites

I found the error

 

On approximately line 408. A bracket around the wrong way.

      for ($i=$start_cart; $i<$length; $i++) {

        if ($session_data[$i] == '{') {

          if (isset($tag)) {

            $tag++;

          } else {

            $tag = 1;

          }

        } elseif ($session_data[$i] == '}') {

          $tag--;

        } elseif ( (isset($tag)) && ($tag < 1) ) {

          break;

        }

      }

Should Be like this:

      for ($i=$start_cart; $i<$length; $i++) {

        if ($session_data[$i] == '{') {

          if (isset($tag)) {

            $tag++;

          } else {

            $tag = 1;

          }

        } elseif ($session_data[$i] == '{') {

          $tag--;

        } elseif ( (isset($tag)) && ($tag < 1) ) {

          break;

        }

      }

Share this post


Link to post
Share on other sites

Ed

 

No, this error is in the contributions of at least 1.5 and 1.5b.

 

I'm going to add to the contributions in the next day or 2 with an update to the Admin/whos_online.php and the lauguage file.

With the correction and a tidy up of the display, some code, time and date stamp of last refresh, labelling of particular ISP's IP addresses.

 

Just taken some of your idea/s and expanded it a bit. I need to look at the spider session killer controls a little more first.

Share this post


Link to post
Share on other sites

John,

 

The "error" you fixed is in the whos_online.php from the MS2.2 base code. Are you sure that's an error? The code is trying to parse the cart days which is in pairs of { and }. You no longer detect the }.

 

Also, I noticed that your query is different from the base code. Your shopping_cart.php:

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id= '" . (int)tep_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

MS2.2 shopping_cart.php:

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

You no longer select p.products_image and your join is different. You use: p.products_id= '" . (int)tep_get_prid($products_id) .

 

I'm wondering if the error doesn't lie with this other code. Another thought, some people complain that WOL doesn't work when sessions are stored in files. Are your sessions stored in files or the database?

 

ed

Edited by medvid

Answers to osCommerce's most persistent questions! Tips & Tricks | Configuration | Common Problems.

Seek and ye shall find Contributions.

My Contributions

My Blog

Share this post


Link to post
Share on other sites
John,

 

The "error" you fixed is in the whos_online.php from the MS2.2 base code.  Are you sure that's an error?  The code is trying to parse the cart days which is in pairs of { and }.  You no longer detect the }.

 

Also,  I noticed that your query is different from the base code.  Your

You no longer select p.products_image and your join is different.  You use: p.products_id= '" . (int)tep_get_prid($products_id) .

 

I'm wondering if the error doesn't lie with this other code.  Another thought, some people complain that WOL doesn't work when sessions are stored in files.  Are your sessions stored in files or the database?

 

ed

Ed

 

Thanks for your input on this, it's great.

Re the error I fixed.

No, I'm not sure, in a sense of what it was did in reversing the bracket. All I know is that I stumbled on to it and comparing the lines above seemed to be possibly the right thing to do, so I tried it and the Who's Online then worked. So of course I was very happy. (I've really only started seriously started working with PHP for about 6 months and a long way to go yet).

 

Re the code Posted from Shopping_cart.php.

I may have led you a little astray there. That code I posted is from:

catalog/admin/includes/classes/shopping_cart.php

not

catalog/includes/classes/shopping_cart.php

where yours appears to have come from. Mine in this directory is the same as yours.

 

From what I can tell of my backups, I have not changed my Admin Classes file.

And yes I am using 2.2-MS2

 

Always open to suggestions. :D

Share this post


Link to post
Share on other sites

John,

 

I looked at the WOE 1.5c posted to contributions with the bracket turned around. Both versions worked on my site.

 

What version of PHP are you at?

Are you using mySQL or files for session data?

 

ed


Answers to osCommerce's most persistent questions! Tips & Tricks | Configuration | Common Problems.

Seek and ye shall find Contributions.

My Contributions

My Blog

Share this post


Link to post
Share on other sites
John,

 

I looked at the WOE 1.5c posted to contributions with the bracket turned around.? Both versions worked on my site.?

 

What version of PHP are you at??

Are you using mySQL or files for session data?

 

ed

Ed

I didn't post that Update, but I notice that the guy that did reversed the other bracket, the top one.

Where as I had reversed the bottom one.

 

Any idea what the actual difference/effect would/might make?

 

(I've flat out trying fix/find another problem with HTML emails with wishlist contrib)

 

John

Edited by Gob

Share this post


Link to post
Share on other sites
What version of PHP are you at?

Are you using mySQL or files for session data?

Ed sorry I missed the last couple of questions you asked.

 

I'm using PHP versi9on 4.3.10

and Mysql for session data.

Share this post


Link to post
Share on other sites

Thanks for the great contrib.

 

I'm having some problems and am not sure how to fix them. Overall, this contrib works great. Here are the 2 things wrong...

 

1) The blue/Red lights are never used. The only lights I ever see are green, orange, and white(no, it's not a colorblind issue :) ). So it is not detecting whether there is a cart or not.

 

2) The cart contents never show up for a user.

 

I am forcing cookie use. (it does the same thing when I don't)

 

define('HTTP_COOKIE_DOMAIN', 'domain.com');

define('HTTPS_COOKIE_DOMAIN', 'https://domain.com');

define('HTTP_COOKIE_PATH', '/store/');

define('HTTPS_COOKIE_PATH', '/store/');

....

define('STORE_SESSIONS', 'mysql');

 

thanks in advance for the help.

 

 

Jeff Daniels

Share this post


Link to post
Share on other sites
Thanks for the great contrib.

 

I'm having some problems and am not sure how to fix them. Overall, this contrib works great. Here are the 2 things wrong...

 

1) The blue/Red lights are never used. The only lights I ever see are green, orange, and white(no, it's not a colorblind issue :)  ). So it is not detecting whether there is a cart or not.

 

2) The cart contents never show up for a user.

 

I am forcing cookie use. (it does the same thing when I don't)

 

define('HTTP_COOKIE_DOMAIN', 'domain.com');

define('HTTPS_COOKIE_DOMAIN', 'https://domain.com');

define('HTTP_COOKIE_PATH', '/store/');

define('HTTPS_COOKIE_PATH', '/store/');

....

define('STORE_SESSIONS', 'mysql');

 

thanks in advance for the help.

Jeff Daniels

Jeff

I have to confess I can not say I have ever yet seen the Red one either but it is possible I've just not noticed, but the blue one I regulaly see.

 

Two things you cold try.

1. Make sure your "spiders.txt file is up to date.

2. Go back through this thread and try changing the brackets around as discussed above in some of my post's and "medvid's" posts.

 

See if that helps.

But if installed correctly it does work properly.

Share this post


Link to post
Share on other sites
Anybody having trouble seeing IP Addresses?

 

I'm on 1.5c, and I can't see any ip addresses whatsoever.

 

Deekins

The IP addressing does work.

It sounds like you may have something incorrectly installed. You may be better to go back to the version 1.5b and then go through this thread for the last page or to you if you have any troubles from there.

I know 1.5b works, I beleive there was basically only one change in 1.5c but this may not be the case.

 

John

Share this post


Link to post
Share on other sites

Hello,

I had been running the WOE 1.3 and just upgraded to 1.5b_2 (this is the most recent version posted in the contribs section with the bracket problem fixed).

It is generally running ok, but I seem to be having many of the same problems as jrdaniels0. I am only seeing Green and Yellow. I have a number of bots on my site but none show up as while. I have never seen red or blue (and in keeping with tradition of this thread so far, I should point out it is NOT a colorblindness issue :) ).

I am also not getting any shopping cart contents data.

 

Do I need to have the sessions stored in MySql in order to get the cart and NoCart features to work? What are the advantages/disadvantages to switching to storage of the sessions in the db? Will I massively grow my db size? I'm pretty close to my hosting limit now on overal storage.

 

Also, I just turned on the option that prevents spiders from getting sessions? Could this have been the reason I didn't see any white status lights? I have several bot sessions that were clearly created after I turned that option on and they are still getting yellow and green lights - no whites.

 

Thanks for any help you can offer - this is a really nice contrib for those of us who obsess over little things like this. I'd really like to get the cart feature working so I can really see my customers make purchases!

 

Scott

Share this post


Link to post
Share on other sites

Scott and others,

 

Some posters have complained that WOE is not working with session saved in files. I haven't tested that as I always use MySQL.

 

I am against the current "bracket fix". The code with the brackets was in teh original osCommerce MS2.2 code. It's intent is to find the end of the session data by counting brackets. It counts up $tag++ for { and down $tag-- for }. By changing those brackets, you're not counting correctly. Why breaking this part of the code fixes a db query, I don't know. But this isn't a true fix.

 

I would like to figure this out. To do this, we need more information, like:

Prevent Spider Sessions: On or Off?

Force Cookie Use: On or Off?

Cache: On or Off?

Brackets: Original or tweaked?

Environment: Windows/IIS or *nix/Apache?

Sessions: File or MySQL?

Force Cookie Use: On or Off?

That might help narrow the issue(s) down.

 

ed


Answers to osCommerce's most persistent questions! Tips & Tricks | Configuration | Common Problems.

Seek and ye shall find Contributions.

My Contributions

My Blog

Share this post


Link to post
Share on other sites

Here is how my system is set up:

 

Prevent Spider Sessions: On or Off? TRUE

Force Cookie Use: On or Off? FALSE

Cache: On or Off? FALSE

Brackets: Original or tweaked? TWEAKED

Environment: Windows/IIS or *nix/Apache? *NIX/APACHE

Sessions: File or MySQL? FILE

Force Cookie Use: On or Off? FALSE

Share this post


Link to post
Share on other sites

Scott,

 

Thanks for the info. Our setups are the same except the session storage. I've switched to file session storage. I immediately loss the view into a cart. I am not getting a database error like some. I'm now looking at the session data to see what's up.

 

ed


Answers to osCommerce's most persistent questions! Tips & Tricks | Configuration | Common Problems.

Seek and ye shall find Contributions.

My Contributions

My Blog

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

×