Manually Manipulating the osCommerce Database
Filed in: osCommerce Tips and Tricks

As we know, osCommerce has a powerful web-based admin backend, which lets you do most things you need to do as a store owner with relative ease.

Sometimes however, there are things you need to do which aren't allowed for within the osCommerce admin and hardly seem worth the effort of coding up formally because they are "one-off" requirements, or something you only need to do very infrequently.

This is where knowing how to use such a tool such as phpmyadmin (usually available within your hosting control panel) is extremely useful.

Say, for instance, that you decide you need to increase the price of all you products by 10%. If, like many store owners, you have hundreds of products, the prospect of editing the price of each of them individually is somewhat offputting to say the least.

In the above example a simple MySQL query entered through the "SQL" box in phpmyadmin can take care of the job for you :

update products set products_price = products_price * 1.1

Another such example is where you want to reset the viewing statistics for the products (that you can view in admin) to zero:

update products_description set products_viewed=0

Or if you want to reset your bestsellers so that they can rebuild to reflect the current hot items, rather that those since you first opened your store:

update products set products_ordered = 0

Obviously, as well as these blanket types of database changes, you may also carry out operations where careful targetting of specific records is required. For instance, if you wanted to move all products from one category to another category, you could do it as follows:

update products_to_categories set categories_id = x where categories_id = y

where x is new the categories_id and y is the old categories_id

There are 0 comments on this post.
Post a New Comment