Opencart的产品未定义的索引错误(Opencart Undefined index Error

2019-10-19 06:46发布

我使用Opencart的1.4.9和我最近处理的product.php未定义指数的错误,我怀疑它发生的每用户创建/输入仪表盘上的新产品的时间。

如何因为它使服务器资源过载,我的网站资源使用率最高达到91%,有时100%的cPanel的修正这些错误?

这里是模型文件。

这里是控制文件。

下面是我收到的错误:

PHP Notice: Undefined index: model in /home/xxx/public_html/admin/controller/catalog/product.php on line 651

PHP Notice: Undefined index: sku in /home/xxx/public_html/admin/controller/catalog/product.php on line 659

PHP Notice: Undefined index: location in /home/xxx/public_html/admin/controller/catalog/product.php on line 667

PHP Notice: Undefined index: keyword in /home/xxx/public_html/admin/controller/catalog/product.php on line 687

PHP Notice: Undefined index: image in /home/xxx/public_html/admin/controller/catalog/product.php on line 703

PHP Notice: Undefined index: image in /home/xxx/public_html/admin/controller/catalog/product.php on line 710

PHP Notice: Undefined index: manufacturer_id in /home/xxx/public_html/admin/controller/catalog/product.php on line 723

PHP Notice: Undefined index: shipping in /home/xxx/public_html/admin/controller/catalog/product.php on line 731

PHP Notice: Undefined index: date_available in /home/xxx/public_html/admin/controller/catalog/product.php on line 739

PHP Notice: Undefined index: quantity in /home/xxx/public_html/admin/controller/catalog/product.php on line 747

PHP Notice: Undefined index: minimum in /home/xxx/public_html/admin/controller/catalog/product.php on line 755

PHP Notice: Undefined index: subtract in /home/xxx/public_html/admin/controller/catalog/product.php on line 763

PHP Notice: Undefined index: sort_order in /home/xxx/public_html/admin/controller/catalog/product.php on line 771

PHP Notice: Undefined index: stock_status_id in /home/xxx/public_html/admin/controller/catalog/product.php on line 783

PHP Notice: Undefined index: price in /home/xxx/public_html/admin/controller/catalog/product.php on line 791

PHP Notice: Undefined index: cost in /home/xxx/public_html/admin/controller/catalog/product.php on line 799

PHP Notice: Undefined index: status in /home/xxx/public_html/admin/controller/catalog/product.php on line 807

PHP Notice: Undefined index: tax_class_id in /home/xxx/public_html/admin/controller/catalog/product.php on line 819

PHP Notice: Undefined index: weight in /home/xxx/public_html/admin/controller/catalog/product.php on line 827

PHP Notice: Undefined index: weight_class_id in /home/xxx/public_html/admin/controller/catalog/product.php on line 841

PHP Notice: Undefined index: length in /home/xxx/public_html/admin/controller/catalog/product.php on line 851

PHP Notice: Undefined index: width in /home/xxx/public_html/admin/controller/catalog/product.php on line 859

PHP Notice: Undefined index: height in /home/xxx/public_html/admin/controller/catalog/product.php on line 867

PHP Notice: Undefined index: length_class_id in /home/xxx/public_html/admin/controller/catalog/product.php on line 881

Answer 1:

以下是一些可能性:

  1. 字段(在你的错误中列出)不存在于数据库中。

  2. 可能有一些问题与您product_form.tpl模板文件。

  3. 检查是否值越来越正确地插入到产品表,同时增加了产品。

比较新鲜的未经编辑的Opencart的1.4.9管理产品文件管理产品文件将帮助您找出问题。



Answer 2:

当这些只是发生$product_info['variable mentioned in error is not specified']一个简单的,和完整的解决方法是编辑查询象下面这样:

 elseif (isset($product_info)) {
                        $this->data['location'] = $product_info['location'];
                }

成:

 elseif (isset($product_info['location'])) {
                        $this->data['location'] = $product_info['location'];
                }

而这样做的每一个的情况下,还可以为所有这样做$product_info[]数据,以避免类似的错误将来。



Answer 3:

在当只是一些指标的不确定的情况下,它的原因可能很简单:如果属性在管理面板(在我的案件的长度,重量和股票等)没有设置。



文章来源: Opencart Undefined index Errors in product