Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Reset product view counts


JoeyDino

Recommended Posts

Has anyone ever wanted to reset the view counts on the products?

 

We are done with the testing and would like to reset the "best viewed products". What am I not seeing? How do I do that?

 

Found at admin\reports\products-viewed, or stats_products_viewed.php.

 

I'm either blind or searching for the wrong keywords.

Link to comment
Share on other sites

There is a field in the database called products_viewed in the products_description table - self explantory from here :)

 

Set those to zero and thats it.

 

Thanks for the response. I must be particularly obtuse because that's the point I seem to have trouble getting to.

 

I've been up and down the ftp tree and the program's file manager and the languages, et cetera and so on, and I can't find any "products_description". I find references to it in various files but that's about it. I have product description showing on the site so I must have that data somewhere. (The only files dated newer than install are images and the cache, and php files I edited.)

 

define('TABLE_PRODUCTS_DESCRIPTION', 'products_description');

("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'")

 

Where is that bastard?

Link to comment
Share on other sites

You need to go into phpmyadmin or equivalent and find the field in the database "products_description".

 

Once you find it you just have to manually edit the rows and set them to "0".

 

If you have a particularly large amount of products you could fashion a simple php script to do this. Unless there's a way in phpmyadmin to update every row in that table. Which off the top of my head I don't think there is.

 

Hope this helps,

Nick

Link to comment
Share on other sites

What fresh hell hath I been sent to? I dl'd my phpmyadmin and ul'd it to server, played with that for some time, and even used the provided mysql on the actual domain server where the site is. What is all that about? Just to reset the product views?

 

How am I supposed to tell the prog where the table/database is when I don't know? I can create the table. I can import a text file. I made the account, put in the table name; all means nothing. Query? Query this.

 

I don't understand. Where is the damn data stored!?

 

Maybe someday I'll bother to figure all that crap out but for now that was ridiculous. Screw the view counts. The last thing I want to do right now is learn yet another language.

 

Thanks anyway.

 

And thanks to osCOmmerce for making that part easy. <_<

Link to comment
Share on other sites

What fresh hell hath I been sent to? I dl'd my phpmyadmin and ul'd it to server, played with that for some time, and even used the provided mysql on the actual domain server where the site is. What is all that about? Just to reset the product views?

 

How am I supposed to tell the prog where the table/database is when I don't know? I can create the table. I can import a text file. I made the account, put in the table name; all means nothing. Query? Query this.

 

I don't understand. Where is the damn data stored!?

 

Maybe someday I'll bother to figure all that crap out but for now that was ridiculous. Screw the view counts. The last thing I want to do right now is learn yet another language.

 

Thanks anyway.

 

And thanks to osCOmmerce for making that part easy. <_<

 

i think you made things a little more complex than they needed to be. somewhere in your host's control panel there should be some way to access your database, this is usually done via phpmyadmin (maybe that's what you meant when you were talking about the provided mysql on the domain server). phpmyadmin should be provided by your host as part of your hosting package. i've never installed it myself and you're right that would be a lot of work if you just wanted to reset the counts.

 

the table and database information are stored in the includes/configuration.php file, near the bottom - which was set up when you installed oscommerce.

 

the data resides within the database, and using phpmyadmin is the easiest way to make changes to it. once in phpmyadmin, click on an sql tab and enter the following command:

update products_description set products_viewed=0;

 

that will set everything to 0. backup your data first, in case you make a mistake along the way.

Link to comment
Share on other sites

the table and database information are stored in the includes/configuration.php file, near the bottom - which was set up when you installed oscommerce.

 

the data resides within the database, and using phpmyadmin is the easiest way to make changes to it. once in phpmyadmin, click on an sql tab and enter the following command:

update products_description set products_viewed=0;

 

that will set everything to 0. backup your data first, in case you make a mistake along the way.

 

Do you mean /oscommerce/catalog/includes/ ? Not that it matters because there is no configuration.php anywhere I can look. The best I can find is config.php and that sure ain't it. Am I supposed to make the ftp show me hidden directories or some such windows type stuff? Don't even tell me that, I would have to shoot myself.

 

The thing is (other than my ignorance) is that I'm the third person to be working on the site. I did not install the oscommerce nor the parent site. The mysql would appear to allow me to change the password to the databases I see listed, but I can never log in/access these databases. I guess that's where I need to focus my energy.

 

Thanks to all who are helping.

 

"the data resides within the database" :) I would assume such a thing but this "database", I am accustomed to an actual file that has actual data written in code on a disk, and that information would have to reside someplace within my domain and therefore be accessible to copy, edit, delete and all the good fun stuff we do with pc's. Even if I couldn't use SQL and had to use edlin.

Link to comment
Share on other sites

Do you mean /oscommerce/catalog/includes/ ? Not that it matters because there is no configuration.php anywhere I can look. The best I can find is config.php and that sure ain't it. Am I supposed to make the ftp show me hidden directories or some such windows type stuff? Don't even tell me that, I would have to shoot myself.

 

yes...if oscommerce/catalog is where oscommerce was installed, there should be a oscommerce/catalog/includes/ directory. and this directory should contain a configure.php file. i don't see a 'config.php' in my file list. it's not a hidden directory or hidden file. what are the files found in this directory? you should see things like application_top.php, column_left.php and column_right.php, etc. maybe the person who installed osc previously renamed the file??

 

The thing is (other than my ignorance) is that I'm the third person to be working on the site. I did not install the oscommerce nor the parent site. The mysql would appear to allow me to change the password to the databases I see listed, but I can never log in/access these databases. I guess that's where I need to focus my energy.

 

mysql does allow you to change passwords, etc. but as i'm sure you can understand, you need to connect to the mysql database first. this requires knowing where it is....and that configure.php file *should* have the information for that. well, once we find it anyway.

 

"the data resides within the database" :) I would assume such a thing but this "database", I am accustomed to an actual file that has actual data written in code on a disk, and that information would have to reside someplace within my domain and therefore be accessible to copy, edit, delete and all the good fun stuff we do with pc's. Even if I couldn't use SQL and had to use edlin.

 

ew...edlin. :)

 

sorry if 'the data resides within the database' statement sounds flippant. but i'm not sure how else to put it. mysql does absolutely write the data to a file somewhere. but even if that's on the same machine, it's very likely located in a directory that you don't have access to. if it's linix, your web hosting files are probably somewhere off $HOME/html or something, and mysql would be running as a daemon and storing its data much further down the chain. and it's also possible that mysql is running on another machine - many hosts set things up like that. but even if you could get at the data, using edlin to look at it or even make changes is probably not going to be productive. i've never bothered to look at the raw mysql files, but my guess is that they are not human readable.

 

so first step is to locate that configuration file. look in the aforementioned oscommerce/catalog/includes/ directory. if there is an application_top.php, look in it. somewhere near the top (about line 18) you might see something like:

 

// include server parameters
 require('includes/configure.php');

 

this is where your configuration file lives. look in the file and near the bottom you'll see something like:

  define('DB_SERVER', ''); // eg, localhost - should not be empty for productive servers
 define('DB_SERVER_USERNAME', '');
 define('DB_SERVER_PASSWORD', '');
 define('DB_DATABASE', 'osCommerce');

 

this is the database information. if you're still having problems, try getting in touch with your hosting company. the must know which databases are associated with your account. do you have access to phpmyadmin? it's usually available from somewhere within your host's control panel.

Link to comment
Share on other sites

What fresh hell hath I been sent to?

Thank you for that, I really enjoyed it.

 

OK, there is a contribution called Run_SQL_v1.0 that you can install in osc. Install it, put the query

update products_description set products_viewed=0;

into a file ending in .sql on your pc, use the installed contrib to browse for the file and upload. Magically, the query is run, and the products viewed are all zero.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...