Opencart 代码错误

发布于 2024-11-28 09:55:17 字数 1094 浏览 0 评论 0原文

当我的客户尝试更新 opencart 1.4.9.3 中的产品时,我收到此错误:

2011-08-06 13:54:29 - PHP Notice:  Undefined index: quantity in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198
2011-08-06 13:54:29 - PHP Notice:  Undefined index: subtract in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198
2011-08-06 13:54:29 - PHP Notice:  Undefined index: price in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198
2011-08-06 13:54:29 - PHP Notice:  Undefined index: price_full in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198
2011-08-06 13:54:29 - PHP Notice:  Undefined index: prefix in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198

这是模型文件: http://pastebin.com/VHL4BTLN

这是控制器文件: http://pastebin.com/GT6YsFqt

我知道表单项正在通过控制器进入模型,但是它不会将所有选项信息保存到数据库中。

I am getting this error when my client tries to update a product in opencart 1.4.9.3:

2011-08-06 13:54:29 - PHP Notice:  Undefined index: quantity in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198
2011-08-06 13:54:29 - PHP Notice:  Undefined index: subtract in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198
2011-08-06 13:54:29 - PHP Notice:  Undefined index: price in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198
2011-08-06 13:54:29 - PHP Notice:  Undefined index: price_full in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198
2011-08-06 13:54:29 - PHP Notice:  Undefined index: prefix in /home/adesignlink/innovativetrailers4less.com/admin/model/catalog/product.php on line 198

Here is the model file:
http://pastebin.com/VHL4BTLN

Here is the controller file:
http://pastebin.com/GT6YsFqt

I know that the form items ARE getting through the controller and into the model but it is not saving all the option info into the db.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔一刀 2024-12-05 09:55:17

这两个类都没有问题!这就是正在发生的事情。
您的控制器从 Model 类调用 editProduct 方法,并传递来自模板页面的产品 ID 和 POST 数据。 Controller 类中的第 81 行:

$this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);

因此,无论问题是什么,都与您的 POST 请求有关。
所有错误消息都来自该行中的 $product_option_value,它是 $product_option['product_option_value'] 的子数组,$product_option 来自 $data['product_option'],即 $this->request->post。
检查您的模板并查看是否正确传递了产品选项。我建议您在服务器上安装 Xdebug 并尝试调试代码。只需对控制器的 81 等进行中断并检查值即可。

There is nothing wrong with neither of these two classes ! Here is what's happening.
Your controller calls the editProduct method from your Model class and passes the product id and POST data that comes from your template page. Line 81 in your Controller class:

$this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);

So whatever the problem is, has something to do with your POST request.
All the error messages are coming from $product_option_value in that line which is a subarray of $product_option['product_option_value'], and $product_option comes from $data['product_option'] which is $this->request->post.
Check your template and see if you are passing the product options correctly. I suggest you to install Xdebug on your server and try to debug the code. simply put a break on like 81 of your controller and check the values.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文