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 16 of 16

Thread: undelete a product

  1. #1
    caraj is offline Member
    Join Date
    Dec 2009
    Posts
    79

    Default undelete a product

    I wanted to remove a product from my featured products list so I soft deleted it. Anyone know How I can undelete this?

    Thanks

  2. #2
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    There are two ways to do that:
    1. In the product manager's page where you deleted that product, there's an 'Undelete' link there you can click.
    2. Or, you can run an update sql command and set deleted=0 directly against your DB (e.g. update product set deleted=0 where productid=theproductid)

    **Make a full DB backup before running the script, just in case.

  3. #3
    caraj is offline Member
    Join Date
    Dec 2009
    Posts
    79

    Default

    the original product was created in category4 but was also mapped to category1

    click--categories-category1
    click on "products" tab"
    click on "products for category" tab

    Should I be looking somewhere else?
    I only see the products in this featured category. There is no undelete link

    Thanks

  4. #4
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    Undeleting through the Product Manager page is actually a feature of ML9, which'll be out real soon. For the moment, you'll need to just run a SQL query like the one Alfred mentioned:

    UPDATE Product SET DELETED=0 WHERE ProductId=theidoftheproductyouwantrestored

  5. #5
    caraj is offline Member
    Join Date
    Dec 2009
    Posts
    79

    Default

    OK thanks
    Where do I find the product ID of the product I deleted?

  6. #6
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    You'll just have to find it in the Product table. Either open the table in SQL Studio Management Studio and find it, or something like

    SELECT ProductID FROM Product WHERE Name='the name of the product you deleted'

  7. #7
    caraj is offline Member
    Join Date
    Dec 2009
    Posts
    79

    Default

    Thanks again for your help. I could not find the product in the table ..although I am not even sure if I even looked in the correct table as there are millions of them!

    Anyway I have backups so would you suggest I do an entire backup or is there a specific folder I should only backup to recover the lost product? The reason I need to recover it is I spent alot of time on wording the description and forgot what I wrote. That is really the only thing I need back.

    Thanks

    Quote Originally Posted by AspDotNetStorefront Staff - Scott View Post
    You'll just have to find it in the Product table. Either open the table in SQL Studio Management Studio and find it, or something like

    SELECT ProductID FROM Product WHERE Name='the name of the product you deleted'

  8. #8
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    A full backup is definitely we recommend. You can try finding that product by names, say for example, SELECT PRODUCTID,DELETED, * FROM PRODUCT WHERE NAME LIKE '%KEYWORD%' and DELETED=1 - When this is ran, it returns all rows that contains the keyword you specified there. Once you found the ProductID, run the query given by Scott.

    ** KEYWORD = at least one word you can remember for that particular product.

  9. #9
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    Have you deleted more than one product? If not just update product set isdeleted=0 where isdeleted = 1

  10. #10
    caraj is offline Member
    Join Date
    Dec 2009
    Posts
    79

    Default

    Quote Originally Posted by ssgumby View Post
    Have you deleted more than one product? If not just update product set isdeleted=0 where isdeleted = 1
    I only deleted 1 product.

    I want to make sure I do this right.

    In SQL Server management express:
    Expand Databases
    Right click my aspdnsf_db
    Click new Querry
    type in exactly: update product set isdeleted=0 where isdeleted = 1
    Execute

    I get this error:
    Msg 207, Level 16, State 1, Line 1
    Invalid column name 'isdeleted'.

    Thanks for your help!

  11. #11
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    In the upper left of your management tool there is a dropdown .. does it say "master"? If so change that to aspdnsf_db

  12. #12
    caraj is offline Member
    Join Date
    Dec 2009
    Posts
    79

    Default

    Thanks SS,
    I dont have a tab like that maybe becasue I am using express?

    Here is my structure

    Servername
    Databases
    system databases
    master
    model
    msddb
    tempdb
    aspdnsf_db
    database diagrams
    tables
    views
    synomyns
    programmability
    security

    I can right click aspdnsf_db and enter a new querry but that is where I get the error.

  13. #13
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    My bad, or our bad

    the column is just deleted not isdeleted

    **** YOU DID MAKE A BACKUP CORRECT?

  14. #14
    caraj is offline Member
    Join Date
    Dec 2009
    Posts
    79

    Default

    Quote Originally Posted by ssgumby View Post
    My bad, or our bad

    the column is just deleted not isdeleted

    **** YOU DID MAKE A BACKUP CORRECT?
    Umm YEAH! The famous words. No I didn't actually but if my whole store gets wiped out not a big deal. I have a few hours into it anyway just setting up a few products and categories. I do have 10 days full backups though.

    I am going to try the deleted command now. Thanks very much for helping me here.

  15. #15
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    Let me know how it goes.

    Also a backup is quite simple to do, right-click on the db and under Tasks select full backup (dont remember the exact verbage) ... probably not a big deal for this current issue but in the future you may want to do this before any big changes

  16. #16
    caraj is offline Member
    Join Date
    Dec 2009
    Posts
    79

    Default

    Thanks again.
    This time I executed that command (deleted) it showed "3 rows" undeleted or something like that. But there was no error.

    But sadly the product is not back..
    Not sure what 3 rows came back but I dont see any difference..yet.
    Also I did do a search in the admin for this product and it shows up.
    When I click on it it gives an error in admin..

    if this message helps here is part of the error.

    Thanks for your help. Not a big deal I will rebuild that product.

    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:


    Line 1931: protected void SetVariantButtons()
    Line 1932: {
    Line 1933: string temp = ("<a target=\"entityBody\" href=\"entityProductVariantsOverview.aspx?ProductI D=" + pID + "&entityname=" + eSpecs.m_EntityName + "&EntityID=" + eID.ToString() + "\">Show/Edit/Add Variants</a>");
    Line 1934:
    Line 1935: ltVariantsLinks.Text = temp;