When I add or delete a product getting error in opencart version 2

Avatar
  • Answered
I deleted few fields from following files. I deleted like SKU, UPC,EAN,JAN,ISBN,MPN fields.

1 . /public_html/admin/view/template/catalog/product_form.tpl
2 . /public_html/admin/model/catalog/product.php
3 . /public_html/admin/controller/catalog

But I got error, So, I deleted 'vqcache' folder from vqmod. I got few errors. I replaced the above files with previous setup. But I couldn't replace the 'vqcache' folder. I replace 'vqcache' folder freshly. But again shows error.

When I upload I am getting the following error:

------------------


Fatal error: Uncaught exception 'ErrorException' with message 'Cannot modify header information - headers already sent by (output started at /home/malllk5/public_html/admin/model/catalog/product.php:2)' in /home/malllk5/public_html/system/library/response.php:12 Stack trace: #0 [internal function]: __lambda_func(2, 'Cannot modify h...', '/home/malllk5/p...', 12, Array) #1 /home/malllk5/public_html/system/library/response.php(12): header('Location: http:...', true, 302) #2 /home/malllk5/public_html/vqmod/vqcache/vq2-admin_controller_catalog_product.php(185): Response->redirect('http://www.mall...') #3 [internal function]: ControllerCatalogProduct->add(Array) #4 /home/malllk5/public_html/vqmod/vqcache/vq2-system_engine_action.php(46): call_user_func(Array, Array) #5 /home/malllk5/public_html/system/engine/front.php(34): Action->execute(Object(Registry)) #6 /home/malllk5/public_html/system/engine/front.php(29): Front->execute(Object(Action)) #7 /home/malllk5/public_html/admin/index.php(178): Front->dispatch(Object(Action), O in /home/malllk5/public_html/system/library/response.php on line 12

------------------

When I delete I am getting the following error:

-------------------------

Warning: Cannot modify header information - headers already sent by (output started at /home/malllk5/public_html/admin/model/catalog/product.php:2) in /home/malllk5/public_html/system/library/response.php on line 12

--------------------

Please solve the issue.
Avatar
Scott
Hello, Sorry to hear you are having issues with your OpenCart site since files were modified. It is common practice to make a copy of a file before changing it so you can copy it back over the modified file. That should be your first option. If you did not make a copy, then you will need to open the files and take a look to see where the issue is. The error you provided "Cannot modify header information - headers already sent by" means that the headers cannot be output on the screen because the output has already been started. This could be due to blank spaces in the files. Check to ensure that there is no white space before the portion. You should only have to check the files you modified since it worked prior to that. Kindest Regards, Scott M