OpenCart未添加订单历史记录3.0.1.1

时间:2017-08-19 20:15:17

标签: php opencart opencart-module opencart-3

我无法解决这个问题,我在这里试图弄清楚发生了什么,我安装了付款分机,当我尝试用信用卡支付产品时,一切正常,我的支付服务器确认转换和OpenCart向卖家和客户发送电子邮件,问题是,在完成转换后,OpenCart没有添加订单历史记录,卖家和客户,我试着查看扩展源代码,但一切看起来对我好我问其他人,这个扩展没有人有问题。日志文件只输出:

2017-08-19 4:50:29 - FEE5D6-AF8F438F43BD-F004C9EFA444-E7BD05

这是支付延期时的js调用函数来确认付款:

PagSeguroDirectPayment.createCardToken({
            cardNumber: $('input#numero-cartao').val(),
            brand: $('input#bandeira').val(),
            cvv: $('input#cvv').val(),
            expirationMonth: expiration[0],
            expirationYear: expiration[1],
            success: function(data) {
                $.ajax({
                    url: 'index.php?route=extension/payment/pagseguro_cartao/transition',
                    data: 'creditCardToken=' + data.card.token + '&senderHash=' + PagSeguroDirectPayment.getSenderHash() + '&installmentQuantity=' + $('select#parcelas option:selected').attr('data-value') + '&installmentValue=' + $('select#parcelas').val() + '&creditCardHolderName=' + $('input#nome').val() + '&creditCardHolderCPF=' + $('input#cpf').val() + '&creditCardHolderBirthDate=' + $('input#data-nascimento').val() + '&creditCardHolderPhone=' + $('input#telefone').val(),
                    type: 'POST',
                    dataType: 'JSON',
                    success: function(data){
                        if (data.error) {
                            $('#warning').html( getError(data.error.code, data.error.message) ).show();
                        } else {
                            $('#button-confirm').attr('disabled');

                            $.ajax({
                                url: 'index.php?route=extension/payment/pagseguro_cartao/confirm',
                                data: 'status=' + data.status,
                                type: 'POST',
                                success: function() {
                                    /*location.href = '{{ continue }}'*/
                                }
                            });
                        }
                    },
                    complete: function(data) {
                        $('#button-confirm').button('reset');
                    }
                });
            },
            error: function(data) {
                console.log(data);
                var html = '<ul>';
                $.each(data.errors, function(i,e){
                    html += '<li>' + getError(i,e) + '</li>';
                });
                html += '</ul>';

                $('#warning').html(html).show();

                $('#button-confirm').button('reset');
            }
        });
    });

和目录/控制器/分机/付款处的控制器:

public function confirm() {
        $this->load->model('checkout/order');

        switch ($this->request->post['status']) {
            case 1:
                $status = $this->config->get('payment_pagseguro_aguardando_pagamento');
                break;
            case 2:
                $status = $this->config->get('payment_pagseguro_analise');
                break;
            case 3:
                $status = $this->config->get('payment_pagseguro_paga');
                break;
            case 4:
                $status = $this->config->get('payment_pagseguro_disponivel');
                break;
            case 5:
                $status = $this->config->get('payment_pagseguro_disputa');
                break;
            case 6:
                $status = $this->config->get('payment_pagseguro_devolvida');
                break;
            case 7:
                $status = $this->config->get('payment_pagseguro_cancelada');
                break;
            default: 
                $status = $this->config->get('payment_pagseguro_aguardando_pagamento');
                break;
        }

        $this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $status);

        if (isset($this->session->data['order_id'])) {
            $this->cart->clear();
            unset($this->session->data['shipping_method']);
            unset($this->session->data['shipping_methods']);
            unset($this->session->data['payment_method']);
            unset($this->session->data['payment_methods']);
            unset($this->session->data['comment']);
            unset($this->session->data['coupon']);
            unset($this->session->data['pagseguro_desconto']);
            unset($this->session->data['pagseguro_acrescimo']);
        }
    }
}

1 个答案:

答案 0 :(得分:0)

显然,所有订单历史记录都是从管理区调用ajax,通过API运行。目录文件夹中包含哪个API控制器。因此,如果您的.htaccess文件中有重定向规则,则整个ajax请求不起作用。

我建议您从Google Chrome或Firefox运行控制台并打开网络标签。添加新订单历史记录时,请检查服务器的响应。你会发现问题。