Jump to content

Archived

This topic is now archived and is closed to further replies.

cheta

Categories and products deleted

Recommended Posts

Hi all:

 

I was configuring my store and i was creating my categories, but i added one category by error, and then i removed it. When i removed it it appeared the following warning:

 

"Warning: set_time_limit(): Cannot set time limit in safe mode in /home/virtual/site1/fst/var/www/html/rcn/admin/includes/functions/general.php on line 733

 

Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/rcn/admin/includes/functions/general.php:733) in /home/virtual/site1/fst/var/www/html/rcn/admin/includes/functions/general.php on line 18"

 

 

 

I clicked Back on the browser, clicked Refresh and the category had been deleted. So i continued to add the categories.

 

But when i was deleting another category, it appeared the same error, but when i clicked back and refreshed the browser, the categories and the products desepeared.

 

Can someone explain me what am i doing wrong? Is it something i have to configure?

 

In the warning, i did not understand the message :"Warning: set_time_limit(): Cannot set time limit in safe mode (...) "

 

Can someone help me? :(

 

Cheers and merry christmas to all of you!!

Share this post


Link to post
Share on other sites

first off, do you have a backup copy of your database prior to you making changes? one thing i do, every time i work on a database, is to do a backup. then, if something does happen, i can restore it and then see if the same thing happens. if the same thing happens, then something is corrupted in the database (however with mysql, not easy to get a corrupted database) the other thing it could be is the server itself having problems. very tough to troubleshoot something like that unless able to duplicate it and then follow the logs. you can also turn on query logging in the admin section (careful, if you are limited on server space, this file grows very quickly).

so, look at the server error and access logs, and once the query logging is turned on, look at those. one thing you can do is when making modifications, turn the query logging on, once done and satisfied, turn query logging off.

remember, backup, backup, backup


John Oligario

 

Knowledge Base Contributions

Share this post


Link to post
Share on other sites

Hi John, and thank you for your quick answer.

 

Yes. Fortunately i remember to do backup all the time.

 

About the error: I realy don't know what has happened. I view all the server logs and i didn't find anything unusual. I wasn't thinking about the database being corrupted, but it could be it.. I was thinking about any misconfiguration in the "application".

 

I will double check tose logs.

 

If anybody had the same error, please let me know if you found anything that corrupted the db or the "application".

 

 

Cheers.

Share this post


Link to post
Share on other sites
Hi John, and thank you for your quick answer.

 

Yes. Fortunately i remember to do backup all the time.

 

About the error: I realy don't know what has happened. I view all the server logs and i didn't find anything unusual. I wasn't thinking about the database being corrupted, but it could be it.. I was thinking about any misconfiguration in the "application".

 

I will double check tose logs.

 

If anybody had the same error, please let me know if you found anything that corrupted the db or the "application".

 

 

Cheers.

Last night I reproduced the problem you described. All products and categories disappeared. From what I could tell, the problem occurs when going back to the previous page (The delete confirmation page) and reclicking the delete button. (Maybe just refreshing the page too?) After trying to repeat the problem with debug and logging turned on, I found that the first SQL delete query now has parent_id = 0 in the WHERE clause. (In the previous SELECT statement before the DELETE statement, the WHERE clause includes category_id = 0) All of the top level categories have parent_ids of 0. I think what happens is all of the top level categories are selected for deletion, then the code deletes everything under each top level category.... resulting in a catalog with no categories or products!

 

I imagine the fix for this would be to have a clause where the initial category_id should never be equal to 0. If I can fix it, I'll follow up with the changes I made.

Share this post


Link to post
Share on other sites

Finding a fix wasn't too difficult! Everyone should add this code to prevent the possible category/product mass delete when backing up to the confirmation for deleting a category. I'd feel better if one brave volunteer would confirm this fix by trying it. :) Back up your database first!

 

 

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 it 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!

Share this post


Link to post
Share on other sites

×