julianpuje Posted September 17, 2004 Share Posted September 17, 2004 BACK UP, BACK UP, AND BACK UP SOME MORE. This may have been posted before, but i didn't see it. So chances are, some of you won't have either. I lost ALL my products last week when i deleted an item in my Admin. Thankfully, i had a back up (although a week old) and managed to put everything back. Yesterday, i was looking through the contributions for something else, and came accross a fix for this happening. The contribution is a text as follows. USE IT read this first remember to back up!!!! use at own risk. ==============================================Fix "delete all products and categories" issue ============================================== History: Byron Weiss <[email protected]> Jan.14.2004 Version v1.0 (Submitted to contributions on Sep.10.2004) ============================================== Please refer to this forum topic: http://www.oscommerce.com/forums/index.php?showtopic=71455&st=0 ============================================== Problem: All categories and products are deleted after deleting a category or product. Cause: This problem was found when the browser's BACK button is used to return to the product list after deleting a product or category. After backing up pages, "categories_id" is set to 0 which is the catalog's root location. Fix: I wrote a simple check to make sure you can never delete the entire catalog in one action. ($categories_id can never equal 0) ** FILE: catalog/admin/categories.php ** FIND code beginning with... case 'delete_category_confirm': if (isset($HTTP_POST_VARS['categories_id'])) { $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']); ** ADD immediately AFTER with this code... // BEGIN Prevent categories_id = 0 if($categories_id == 0) { tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id)); break; } // END Prevent categories_id = 0 ** SAVE the file and you are finished! Julian :D A little knowledge is dangerous, I SHOULD KNOW. If Life Begins At 40, What ends???? Link to comment Share on other sites More sharing options...
DrForrester Posted September 19, 2004 Share Posted September 19, 2004 Hmmmm. Added the code and the page won't even load. Parse error right where the new code begins. Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2004 Share Posted September 19, 2004 there are many warnings about using the back button in the admin area. so your host does not have / make a backup of the server daily for you? one thing i do for all my people is a triple backup daily, two to tape and one live to another system. Hmmmm. Added the code and the page won't even load. Parse error right where the new code begins. <{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
DrForrester Posted September 19, 2004 Share Posted September 19, 2004 Are you addressing me or the original post? You quoted my post, but it looks like you are responding to the original post. I myself back up very often out of the sheer fear that I don't know what I am doing, of which there is solid evidence. Anyway, I just removed the new code and everything is fine. I was just wondering if anyone else had the same result I did when attempting to use this code. As an aside, I guess the first lesson I will teach my client about the admin tool is to never use the back button. Doc Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.