Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 12 of 12

Thread: Delete test products before going live

  1. #1
    Geri Langlois is offline Junior Member
    Join Date
    Feb 2009
    Posts
    6

    Default Delete test products before going live

    How can I delete all test products and related entities, etc. before going live?
    Thanks.

  2. #2
    mbertulli is offline Senior Member
    Join Date
    Aug 2008
    Posts
    243

    Default

    This is normally something we do directly in SQL. Do you have access to this?

    The tables you want to remove data from are:

    Product
    ProductVariant
    ProductCategory
    ProductDepartment
    ProductSection

    We normally just execute the following type of delete statement on them:

    Delete From Product Where (condition for test products)

    A sample from the recent http://www.shopdetails.ca site would be:

    Delete From ProductDepartment Where ProductID IN
    (
    Select ProductId From Product Where Name like '%testing%'
    )
    Matthew Bertulli
    Demac Media
    mbertulli@demacmedia.com
    Custom Web Design & E-Commerce Development
    AspDotNetStoreFront Platinum DevNet Partner
    ----

    Custom Skinning & Design
    Web Services Integration
    Custom Reporting
    Salesforce.com eCommerce AspDotNetStoreFront Integration

  3. #3
    Geri Langlois is offline Junior Member
    Join Date
    Feb 2009
    Posts
    6

    Default Thank you

    Thanks, I do have direct access to the sql database I just wasn't sure of all of the affected tables -- thanks again for your quick reply

  4. #4
    MelanieA is offline Junior Member
    Join Date
    Sep 2008
    Posts
    313

    Default

    To do this, run the following SQL statements against your store database. This removes these products for good, there is no recovering them! Be sure you have a good backup first.

    DELETE FROM Product
    DELETE FROM ProductAffiliate
    DELETE FROM ProductCategory
    DELETE FROM ProductCustomerLevel
    DELETE FROM ProductDistributor
    DELETE FROM ProductGenre
    DELETE FROM ProductLocaleSetting
    DELETE FROM ProductManufacturer
    DELETE FROM ProductSection
    DELETE FROM ProductVariant
    DELETE FROM ProductVector
    DELETE FROM ShippingByProduct

    Check if this works for you

  5. #5
    jsimacek is offline Senior Member
    Join Date
    Dec 2008
    Location
    Phoenix, AZ
    Posts
    373

    Default

    Just to add to this, if you have already added products and just want to delete the ones from your test data, the test data product IDs are 1-202 so you can add a where clause to Melanie's queries: WHERE ProductID < 203
    Jan Simacek - Compunix, LLC
    AspDotNetStorefront trusted Devnet Partner and Reseller since 2005

    AspDotNetStorefront Mods and Add-Ons at http://www.ecommercecartmods.com/
    - Searching, Filtering and Sorting (like cSearch, Dealer Locator, Price Ranges, Blog)
    - Reports (like Cart Abandonment and Net Sales)
    - Customer Experience (like Question/Answers)
    - Site and Data Management (like Entity Product Mapper, Bulk Updaters, Make/Model/Year filters)

  6. #6
    iberniztok is offline Junior Member
    Join Date
    Mar 2009
    Posts
    23

    Default

    how would we reset the starting product id? The manual explains how to reset the order numbers but not the product id's. any help would be greatly appreciated! thanks!

  7. #7
    iberniztok is offline Junior Member
    Join Date
    Mar 2009
    Posts
    23

    Default

    whoops i have found the answer.

    dbcc checkident(OrderNumbers, reseed, 1)

    I thought OrderNumbers was a variable holding the count but I realized later that it is a table. So im assuming checkident checks and/or sets the autoincrementing primary key?


  8. #8
    StokesWebDevelopment is offline Junior Member
    Join Date
    Jul 2009
    Location
    Walnut Cove, NC
    Posts
    20

    Default

    What about the test customers and orders? What tables should be cleared and is it safe to delete all entries in those tables?
    Randall Moore | Web Developer
    Stokes Web Development
    www.stokesweb.com

  9. #9
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    The following are the tables needed to be cleared:

    For Customer:
    Customer

    For Order:
    OrderNumbers
    Orders
    Orders_CustomCart
    Orders_KitCart
    Orders_ShoppingCart

  10. #10
    JacobL is offline Junior Member
    Join Date
    Jul 2009
    Posts
    20

    Default

    Can you tell me what tables to clear for categories, I want to reset the ID # back to 1 for my categories and products.

    Thank you

  11. #11
    MelanieA is offline Junior Member
    Join Date
    Sep 2008
    Posts
    313

    Default

    Once you have deleted all your categories, run this query to reset back your CategoryID to 1:
    Code:
    dbcc checkident(Category, reseed, 0)
    Check if this works for you

  12. #12
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    Actually, using TRUNCATE TABLE tablename, both removes all data and resets the identity counter to the seed at the same time.

    It is faster than a delete statement which removes one row at a time, and the deletes are recorded in the transaction log.
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!