My OpenCart version 1.5.6 and I'm not using vQmod. So recently I added one custom product field. This tutorial helped me to do that http://forum.opencart.com/viewtopic.php?f=22&t=36625#p181916 Now, when I'm trying to add a new product to store this error appears:
Fatal error: Call to undefined method ModelCatalogCategory::getAllCategories() in C:\apache\localhost\www\webshop.kg\admin\controller\catalog\product.php on line 1018
If I'm trying to edit already existing product these two errors appear:
Notice: Undefined index: seo_title in C:\apache\localhost\www\webshop.kg\admin\model\catalog\product.php on line 456Notice: Undefined index: seo_h1 in C:\apache\localhost\www\webshop.kg\admin\model\catalog\product.php on line 457
Fatal error: Call to undefined method ModelCatalogCategory::getAllCategories() in C:\apache\localhost\www\webshop.kg\admin\controller\catalog\product.php on line 1018
What possible reason could create such a behavior?
Thank you for your attention.
The problem is within your controller as the model in admin/model/catalog/category.php
does not contain a method getAllCategories()
(unless you added it there which is not a case because of the fatal error) - it contains only the method getCategories()
.
Furthermore your Undefined index notices are saying that within your product model (lines 456
and 457
) you are relying on the presence of the indexes seo_title
and seo_h1
but they are not set.
I do not know the code you have modified in admin/model/catalog/product.php
but you should use something like this:
if(isset($data['seo_title'])) { /* do setting of seo title */ } /* else { do not set this } */
if(isset($data['seo_h1'])) { /* do setting of seo h1 */ } /* else { do not set this } */
Maybe posting the method reliable for storing new or updating existing product code would be more helpful...
The model in admin/model/catalog/category.php does not contain a method getAllCategories(). So you need to define it in category model.
public function getAllCateories() {
$query = "WRITE YOUR QUERY";
}