duanguanye4124 2014-06-21 09:22
浏览 40
已采纳

如何从自定义字段Opencart数据库中获取价值?

I developed the OpenCart module. I intend to add the receipt number on each product to add field "nota" in "oc_product" table. The plan when users place an order, then any goods ordered will get a receipt number when you are on the "View Cart"

I've been following the rules of how to add custom fields in OpenCart and get the value of the field "nota" extension such as this:

http://www.opencart.com/index.php?route=extension/extension/info&extension_id=2838

but it appears an error in index.php?route=checkout/cart

Notice: Undefined index: nota in D:\DATA PENTING\Project\Proyek\htdocs\toko\catalog\controller\checkout\cart.php on line 276

This error only when in the "View Cart", if the other page like index.php?route=product/product&product_id=* no error occurs and showing receipt number.

and if i follow error i found this codes and then add codes to get "nota" value, but still error occurs.

$this->data['products'][] = array(
                    'key'                 => $product['key'],
                    'thumb'               => $image,
                    'name'                => $product['name'],
                    'model'               => $product['model'],
                    'nota'                => $product['nota'],
                    'option'              => $option_data,
                    'quantity'            => $product['quantity'],
                    'stock'               => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')),
                    'reward'              => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
                    'price'               => $price,
                    'total'               => $total,
                    'href'                => $this->url->link('product/product', 'product_id=' . $product['product_id']),
                    'remove'              => $this->url->link('checkout/cart', 'remove=' . $product['key']),
                    'recurring'           => $product['recurring'],
                    'profile_name'        => $product['profile_name'],
                    'profile_description' => $profile_description,
                );
            }

Anyone can help this error?

  • 写回答

1条回答 默认 最新

  • dsykx64220 2014-06-22 10:06
    关注

    please edit system/library/cart.php

    after this line :

    'name' => $product_query->row['name'],

    add:

    'nota' => $product_query->row['nota'],

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 etcd集群部署问题
  • ¥20 谁可以帮我一下问一下各位
  • ¥15 为何重叠加权后love图的SMD与svyCreateTableOne函数绘制基线表的不一致
  • ¥15 QFILHelper怎么恢复全字库,提示进程已完成,只能恢复分区文件
  • ¥150 求 《小魔指》街机游戏机整合模拟软件
  • ¥20 你好,我想问下easyExcel下拉多选,或者复选框可以实现吗
  • ¥20 双非跨考工科哪个专业和方向就业前景好?
  • ¥20 求会6sv辐射传输模型,辅导(可py6s🙏🏻有偿
  • ¥15 .xla后缀的文件拖到excel里什么内容也没有怎么办
  • ¥20 Workbench中Mechanical打不开、闪退是什么原因?