osCmax v2.5 User Manual
Results 1 to 10 of 10

Is there a way to purge order statistics?

This is a discussion on Is there a way to purge order statistics? within the osCMax v2 Features Discussion forums, part of the osCmax v2.0 Forums category; Hi - I'm new to the forum, but have had pretty good experience so far installing osCMax, customizing it to ...

      
  1. #1
    Member
    Join Date
    Aug 2009
    Posts
    65
    Rep Power
    3


    Default Is there a way to purge order statistics?

    Hi - I'm new to the forum, but have had pretty good experience so far installing osCMax, customizing it to my liking, populating the catalog and getting the payment module properly linked to PayPal. So far everything appears to be working properly.

    But in the process of testing with PayPal a number of test orders were created in osCMax and payment "executed" in PayPal's Sandbox. I have since deleted these orders in osCMax, but the shopping cart is still ranking "BestSellers" even though all the test orders have been deleted.

    Is there a way to purge ALL the test transaction activity before taking the shopping cart live? I'd like to be able to report only "real" activity.

    Thanks...

  2. #2
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: Is there a way to purge order statistics?

    Yes! Just remove the data from the database.

    This is from an oscommerce contribution enter through MySQL.

    WARNING - DO NOT SIMPLY CUT AND PASTE - THIS WILL EMPTY YOUR STORE OF PRODUCTS, ATTRIBUTES, CUSTOMERS, MANUFACTURERS, ETC.

    Backup your database before you use - and think it through before wiping your data.

    Code:
    TRUNCATE `address_book`;
    TRUNCATE `categories`;
    TRUNCATE `categories_description`;
    TRUNCATE `customers`;
    TRUNCATE `customers_basket`;
    TRUNCATE `customers_basket_attributes`;
    TRUNCATE `customers_info`;
    TRUNCATE `manufacturers`;
    TRUNCATE `manufacturers_info`;
    TRUNCATE `orders`;
    TRUNCATE `orders_products`;
    TRUNCATE `orders_products_attributes`;
    TRUNCATE `orders_products_download`;
    TRUNCATE `orders_total`;
    TRUNCATE `products`;
    TRUNCATE `products_attributes`;
    TRUNCATE `products_attributes_download`;
    TRUNCATE `products_description`;
    TRUNCATE `products_notifications`;
    TRUNCATE `products_options`;
    TRUNCATE `products_options_values`;
    TRUNCATE `products_options_values_to_products_options`;
    TRUNCATE `products_to_categories`;
    TRUNCATE `reviews`;
    TRUNCATE `reviews_description`;
    TRUNCATE `specials`;
    There are probably a few more tables that need to be TRUNCATE for osCmax but this should do most of your data ... be warned that it will wipe your products.

    GPMaina - More specifically for you I would start with TRUNCATE of the orders tables (eg. TRUNCATE `orders_products`; TRUNCATE `orders_products_attributes`; TRUNCATE `orders_products_download`; TRUNCATE `orders_total`;) and customers eg. (TRUNCATE `customers`;
    TRUNCATE `customers_basket`; TRUNCATE `customers_basket_attributes`; TRUNCATE `customers_info`;)

    Backup before you start and be careful.

    Regards,
    pgmarshall
    _______________________________

  3. #3
    Member
    Join Date
    Aug 2009
    Posts
    65
    Rep Power
    3


    Default Re: Is there a way to purge order statistics?

    Thanks, pgmarshall:

    Could I accomplish the same thing by deleting the records manually using phpadmin in the following tables?

    `orders`
    `orders_products`
    `orders_products_attributes`
    `orders_products_download`
    `orders_total`

    I really don't want to lose the customer, product, mfg, etc. records, just the test orders and statistics.

    Also, is the data in these 'orders' tables in any way related to some of the other tables such that the latter might crash if the records in the 'orders' tables are deleted manually?

    Or do I have to completely purge EVERYTHING to be safe?

    Thanks, again.

  4. #4
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Wink Re: Is there a way to purge order statistics?

    Having not done this myself - I am guessing - so it might be worth waiting for someone who has done this to confirm the TRUNCATE method.

    I can think of no reason why you couldn't just delete the rows using myPhpAdmin or why this would cause it to crash later. TRUNCATE also reset the auto-numbering in the table back to 1.

    I would back everything up and try the following SQL - if the wheels fall off and your site bombs then you can simply restore the dbase.

    Code:
     
    TRUNCATE `address_book`;
    TRUNCATE `orders_products`;
    TRUNCATE `orders_products_attributes`;
    TRUNCATE `orders_products_download`;
    TRUNCATE `orders_total`;
    TRUNCATE `customers`;
    TRUNCATE `customers_basket`;
    TRUNCATE `customers_basket_attributes`;
    TRUNCATE `customers_info`;
    Regards,
    pgmarshall
    _______________________________

  5. #5
    jpf
    jpf is offline
    osCMax Testing Team
    jpf's Avatar
    Join Date
    Sep 2003
    Location
    Manitoba, Canada
    Posts
    2,699
    Rep Power
    22


    Default Re: Is there a way to purge order statistics?

    Quote Originally Posted by GPMaina View Post
    Thanks, pgmarshall:

    Could I accomplish the same thing by deleting the records manually using phpadmin in the following tables?

    `orders`
    `orders_products`
    `orders_products_attributes`
    `orders_products_download`
    `orders_total`

    I really don't want to lose the customer, product, mfg, etc. records, just the test orders and statistics.

    Also, is the data in these 'orders' tables in any way related to some of the other tables such that the latter might crash if the records in the 'orders' tables are deleted manually?

    Or do I have to completely purge EVERYTHING to be safe?

    Thanks, again.
    Yes RUN the full SQL COMMANDS as above in phpmyadmin on your database.....
    ie:
    Code:
    TRUNCATE `address_book`;
    TRUNCATE `orders_products`;
    TRUNCATE `orders_products_attributes`;
    TRUNCATE `orders_products_download`;
    TRUNCATE `orders_total`;
    TRUNCATE `customers`;
    TRUNCATE `customers_basket`;
    TRUNCATE `customers_basket_attributes`;
    TRUNCATE `customers_info`;
    JPF - osCMax Fourm Moderator - To contact, post on the forum or click here
    Try out our osCMax at: Live Catalog Demo
    Limited access Admin: Live Admin Demo
    Feel free to add products they way you want and then purchase them -=+=- Sorry nothing will be billed or shipped!

  6. #6
    Member
    Join Date
    Aug 2009
    Posts
    65
    Rep Power
    3


    Default Re: Is there a way to purge order statistics?

    To pgmarshall and jpf:

    What you instructed worked quite well... and thanks for the advice to backup the database first. I was able to restore it a number of times to double check what was going on.

    Actually, I did a little rooting around the database using phpMyAdmin and found that the database didn't show any real orders at all. I am wondering of osCMax uses the PalPal "SandBox" setting as a switch not to record the test orders? Is that possible?

    The second thing I found is that by going into the "products" table in phpMyAdmin I could edit the "products_quantity" and "products_ordered" fields to reset them to 0. And by going into the "products_description" table, I could edit the "products_viewed" fields to 0 as well. This gave me the results I wanted by resetting the Best Selling Products and Number of Times Viewed back to zero before letting the shopping cart go live.

    Of course the "products_quantity" could have been edited in the Catalog Admin right in osCMax... there does not appear to be a way to edit the "products_ordered" nor the "products_viewed" except directly in the database.

    Thanks again for leading me to the right area to investigate.

  7. #7
    Member
    Join Date
    Aug 2009
    Posts
    65
    Rep Power
    3


    Default Re: Is there a way to purge order statistics?

    One last (I hope) question on this topic... after all my order processing testing, I was able to purge all the test order information and reset the products ordered and products viewed fields to zero. But the OrderID field continue to increment from the last test order #. Can you tell me exactly which table contains the Order ID increment field so I can reset that to zero as well and start with a new Order #1?

    Thanks...

  8. #8
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: Is there a way to purge order statistics?

    Open your dbase in myPhpAdmin or similar and run the following SQL.

    Code:
    ALTER TABLE orders AUTO_INCREMENT = 1
    This will reset the auto_increment to the lowest free available number.

    I am not sure, but it may be worth doing this for all of the orders_ tables ie. orders_products, orders_products_attributes, etc.

    Hope this works - I have not tried it or tested it - so make sure you BACKUP!

    Regards,
    pgmarshall
    _______________________________

  9. #9
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Lightbulb Re: Is there a way to purge order statistics?

    Consider this:
    Do you really want your 1st 'live' customer to know that they are order number one?
    "Oh no, what have I done, is this site legit, or have I just become a guinea pig?"
    Would a starting order of, say, 500 or 1000 not instil a bit more confidence?
    Hosting plans with installation, configuration, contributions, support and maintenance.

  10. #10
    Member
    Join Date
    Aug 2009
    Posts
    65
    Rep Power
    3


    Default Re: Is there a way to purge order statistics?

    Excellent point - thanks.

    George

Similar Threads

  1. Turnover statistics
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 02-18-2009, 09:12 AM
  2. Store Statistics
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 02-04-2009, 12:00 PM
  3. Turnover statistics
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 02-04-2009, 10:50 AM
  4. Store Statistics
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 01-23-2009, 10:00 AM
  5. Store Statistics
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 01-13-2009, 12:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •