Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Javier Barrera 34 posts 85 karma points
    Nov 05, 2011 @ 22:22
    Javier Barrera
    0

    How do you clear test orders in uCommerce 2

    I'm looking for a way to delete all of the test orders, addresses, shipments, etc from our development site. We have over 100 products and about 15 categories setup, so I really don't want to have to import everything to a new database.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 08, 2011 @ 12:00
    Søren Spelling Lund
    1

    Hi Javier,

    Deleting Purchase Orders and Baskets from the Database in uCommerce works for 1.0.

    There's an update for the script for 2.0:

    BEGIN TRAN

    -- Delete reviews

    DELETE FROM uCommerce_ProductReviewComment

    DELETE FROM uCommerce_ProductReview

    -- Delete discounts

    DELETE FROM uCommerce_OrderLineDiscountRelation

    DELETE FROM uCommerce_Discount

    -- Remove shipment <-> order line link

    UPDATE uCommerce_OrderLine SET ShipmentId = NULL

     

    UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL

    DELETE FROM uCommerce_Shipment

    DELETE FROM uCommerce_OrderAddress

    DELETE FROM uCommerce_OrderProperty

    DELETE FROM uCommerce_OrderLine

    DELETE FROM uCommerce_Payment

    DELETE FROM uCommerce_OrderStatusAudit

    DELETE FROM uCommerce_PurchaseOrder

    DELETE FROM uCommerce_Address

    DELETE FROM uCommerce_Customer

    --COMMIT

  • Javier Barrera 34 posts 85 karma points
    Nov 10, 2011 @ 17:17
    Javier Barrera
    0

    Thank you Soren, that worked perfectly. How about a script to delete a product by ID or a store by ID?

  • Kåre Petersen 5 posts 26 karma points
    Oct 18, 2012 @ 10:48
    Kåre Petersen
    1

    When using Ucommerce v.3 change the script above to this:

    BEGIN TRAN

    -- Delete reviews

    DELETE FROM uCommerce_ProductReviewComment

    DELETE FROM uCommerce_ProductReview

    -- Delete discounts

    DELETE FROM uCommerce_OrderLineDiscountRelation

    DELETE FROM uCommerce_Discount

    -- Remove shipment <-> order line link

    UPDATE uCommerce_OrderLine SET ShipmentId = NULL

    UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL

    DELETE FROM uCommerce_Shipment

    DELETE FROM uCommerce_OrderAddress

    DELETE FROM uCommerce_OrderProperty

    DELETE FROM uCommerce_OrderLine

    DELETE FROM uCommerce_PaymentProperty

    DELETE FROM uCommerce_Payment

    DELETE FROM uCommerce_OrderStatusAudit

    DELETE FROM uCommerce_PurchaseOrder

    DELETE FROM uCommerce_Address

    DELETE FROM uCommerce_Customer

    --COMMIT

  • Kieran Harvey 22 posts 55 karma points
    Dec 07, 2012 @ 06:33
    Kieran Harvey
    0

    hey i get this

    Msg 547, Level 16, State 0, Line 13
    The DELETE statement conflicted with the REFERENCE constraint "FK_uCommerce_ShipmentDiscountRelation_uCommerce_Discount". The conflict occurred in database "schema.mydb", table "dbo.uCommerce_ShipmentDiscountRelation", column 'DiscountId'.

    thanks.
    KJ 

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 07, 2012 @ 21:29
    Søren Spelling Lund
    0

    Use this for version 3:

    BEGIN TRAN

    -- Delete reviews

    DELETE FROM uCommerce_ProductReviewComment

    DELETE FROM uCommerce_ProductReview

    -- Delete discounts

    DELETE FROM uCommerce_OrderLineDiscountRelation

    DELETE FROM uCommerce_ShipmentDiscountRelation

    DELETE FROM uCommerce_Discount

    -- Remove shipment <-> order line link

    UPDATE uCommerce_OrderLine SET ShipmentId = NULL

    UPDATE uCommerce_PurchaseOrder SET BillingAddressId = NULL

    DELETE FROM uCommerce_Shipment

    DELETE FROM uCommerce_OrderAddress

    DELETE FROM uCommerce_OrderProperty

    DELETE FROM uCommerce_OrderLine

    DELETE FROM uCommerce_PaymentProperty

    DELETE FROM uCommerce_Payment

    DELETE FROM uCommerce_OrderStatusAudit

    DELETE FROM uCommerce_PurchaseOrder

    DELETE FROM uCommerce_Address

    DELETE FROM uCommerce_Customer

    --COMMIT

  • Max 28 posts 80 karma points
    May 13, 2014 @ 14:36
    Max
    0

    This script thread is again long overdue.

Please Sign in or register to post replies

Write your reply to:

Draft