opencart订单电子邮件额外产品字段

时间:2018-05-18 13:44:47

标签: php email field opencart extra

我需要在购物车中添加一些信息以订购电子邮件。我必须设法显示每个产品的供应商字段,但我无法将其添加到oc_order_product表中我相信我需要它,所以我可以通过订单电子邮件发送它 在目录/ controller / checkout / cart.php我添加了这个

$data['products'][] = array(
                'cart_id'   => $product['cart_id'],
                'thumb'     => $image,
                'name'      => $product['name'],
                'supplier_id'       =>htmlspecialchars_decode($product['supplier']),
                'supplier_comments'     =>htmlspecialchars_decode($product['suppliercomments']),
                'model'     => $product['model'],
                'option'    => $option_data,
                'recurring' => $recurring,
                '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'])
            );

和目录/ model / checkout / order.php

if (isset($data['products'])) {
        foreach ($data['products'] as $product) {
            $this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET order_id = '" . (int)$order_id . "', product_id = '" . (int)$product['product_id'] . "', name = '" . $this->db->escape($product['name']) . "', Suppliername = '" . (int)$product['supplier_id'] . "', Suppliercomments = '" . (int)$product['cupplier_comments'] . "', model = '" . $this->db->escape($product['model']) . "', quantity = '" . (int)$product['quantity'] . "', price = '" . (float)$product['price'] . "', total = '" . (float)$product['total'] . "', tax = '" . (float)$product['tax'] . "', reward = '" . (int)$product['reward'] . "'");

问题是供应商的数据没有存储在数据库中

1 个答案:

答案 0 :(得分:0)

更好地为您的供应商信息创建新表格,易于管理

同样在opencart 3.X中更改默认数据库表是无效的