If, when installing a module or modification on OpenCart, the error "Fatal error: Cannot redeclare ..." occurs, this means that a function or class in PHP with the same name already exists. To fix this problem, you need to leave only one function or class with that name. To do this, you need to find the problematic file (usually a controller or model that was modified using ocmod) indicated in the error, and check whether it contains functions or classes with the same names.
If functions or classes are completely duplicated, you need to remove one of them. If they are different, then you need to rename one of the functions or classes and correct all references to it.
For example, if you get the error " Fatal error: Cannot redeclare ModelCatalogProduct::delete_image() in /home/public_html/system/storage/modification/admin/model/catalog/product.php ", you need to open the file /home/public_html/ system/storage/modification/admin/model/catalog/product.php and find two functions called " delete_image ". Then you need to determine whether they are the same or different, and find in which modifier the duplicate function is added. Next, you need to remove this operation from the modifier if the functions were the same, or rename one of them and correct the chain of calls to it in the module if they are different.
If such an error occurs in the system/modification/ folder or in system/storage/modification/, then you need to find the module modifier (file with *.ocmod.xml extension or install.xml file) in which the duplicate function is added, delete the old modifier in admin and install a new, edited one.














































Comments