opencart 1.5.6的商店信用问题 [英] Issue on store credit of opencart 1.5.6

查看:49
本文介绍了opencart 1.5.6的商店信用问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在管理部门为客户创建订单.客户有一定的信用额度(比如说200美元).订单总数的计算方式类似于order total - customer's credit = new order total.

I want to create an order for a customer in the administration. The customer has certain credit (let's say $200). The order total is calculated like order total - customer's credit = new order total.

问题在于创建订单后客户的信用没有改变.

The problem is the customer's credit does not change after creating an order.

例如:

  • 订单总数为:$500
  • 信用是:$200
  • 那么订单总额为:$ 500-$ 200 = $300
  • 但客户的信用额度仍然是:$200
  • the order total is: $500
  • credit is: $200
  • then the order total is : $500 - $200 = $300
  • but the customer's credit is still: $200

还有其他人有同样的问题吗?

Has anybody else had the same problem?

我尝试更改该订单的状态,包括处理和设置,但不起作用.

I try to change the status of that order, both processing and setting, but it doesn't work.

客户信息"页面中的交易不变.

The transaction in customer info page does not change.

我已经检查了后端中的代码-没有可用于oc_customer_transaction表的代码.

I have checked the code in backend - there is no code that would operate with oc_customer_transaction table.

在前端,/catalog/model/total/credit.php

public function confirm($order_info, $order_total) {
    $this->language->load('total/credit');
    if ($order_info['customer_id']) {
            $this->db->query("INSERT INTO " . DB_PREFIX . "customer_transaction SET 
                   customer_id = '" . (int)$order_info['customer_id'] . "', 
                   order_id = '" . (int)$order_info['order_id'] . "', 
                   description = '" . $this->db->escape(
                         sprintf($this->language->get('text_order_id'),  
                         (int)$order_info['order_id'])) . "', 
                   amount = '" . (float)$order_total['value'] . "', 
                   date_added = NOW()");

    }
}

在结帐过程中被调用以重新计算客户的信用余额.但是我没有在后端找到这样的代码.

it is called during the checkout process to recalculate customer's credit balance. But I haven't found such code in backend.

推荐答案

我已经解决了该问题.

代码:

$this->db->query("INSERT INTO " . DB_PREFIX . "customer_transaction SET 
    customer_id = '" . (int)$order_info['customer_id'] . "', 
    order_id = '" . (int)$order_info['order_id'] . "', 
    description = '" . $this->db->escape(
      sprintf($this->language->get('text_order_id'),  
      (int)$order_info['order_id'])) . "', 
    amount = '" . (float)$order_total['value'] . "', 
    date_added = NOW()");

只需在以下位置添加信用计算代码:

just add the credit calculate code when at following place:

1./admin/model/sale/order.php addOrder方法

1./admin/model/sale/order.php addOrder method

a.当您在后端将产品添加到新客户订单时,系统会将请求发送到前端(/catalog/checkout/mannual.php索引),以计算订单总数(例如:小计,信用,装运,总数).请求完成后,页面中的订单总数将刷新

a. when you add product to a new customer order in the backend, the system will send request to the frontend (/catalog/checkout/mannual.php index ) wo calculate the order total(such as: subtotal, credit, shipping, total). after this request, order total in the page will be refreshed

b.当您保存订单时,(admin/model/sale/order.php)addOrder方法将最终被调用.您只需要在该函数上方添加代码即可.

b. when you save the order, the (admin/model/sale/order.php) addOrder method will be called eventually. You just need add code above to that function.

insert into.....  customer_transaction  means use the credit

2./admin/model/sale/order.php editOrder方法

2./admin/model/sale/order.php editOrder method

a.当您编辑订单时,总计中的每个项目都会更改.因此,您应该删除之前用于此订单的所有信用.

a. when you edit a order, the each item in totals will be changed. so, you should delete all credit you used for this order before.

从oc_customer_transaction中删除*,其中'order_id'= $ order_id

delete * from oc_customer_transaction where 'order_id'=$order_id

b.由于已在步骤1中重新计算了各项总计(涉及贷项),因此此方法将收到新的贷项金额.只需通过代码打击插入新金额

b. since the each item of totals(involve credit) has been recalculated in step1, so this method will receive the new credit amount. just insert the new amount by code blow

3.您不需要更改admin/model/sale/order.php deleteOrder方法 因为它会删除所有总计,所以请在数据表oc_customer_transaction中包含项目

3.you do not need to change admin/model/sale/order.php deleteOrder method because it delete all totals, include item in the data table oc_customer_transaction

事情完成了!

这篇关于opencart 1.5.6的商店信用问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆