Dreamvention / paypal

PayPal Checkout Integration
https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=38358
8 stars 7 forks source link

[3.x.x branch] Wrong heading title in sale/order/info #26

Open mhcwebdesign opened 1 month ago

mhcwebdesign commented 1 month ago

When the payment extension PayPal Checkout Integration is enabled on an OpenCart 3.0.x.x version, e.g. https://github.com/opencart/opencart/tree/3.0.x.x , the heading title is wrong on the admin backend's sale/order/info page. It always shows this:

Screenshot_2024-05-31_12-00-31

It should show this: Screenshot_2024-05-31_12-02-08

This issue is caused by the event handler order_info_before in file admin/controller/extension/payment/paypal.php which calls the $this->load->language('extension/payment/paypal'); . Later on, OpenCart calls the event handler event/language/before (see file admin/controller/event/language.php) which then loads the wrongly modified data from the $this->language->data .

Suggested bugfix for admin/controller/extension/payment/paypal.php :

    public function order_info_before($route, &$data) {
        .....
        $this->load->language('extension/payment/paypal','extension_payment_paypal');
        .....
        $data['tabs'][] = array(
            'code'    => 'paypal',
            'title'   => $this->language->get('extension_payment_paypal')->get('heading_title_main'),
            'content' => $this->load->view('extension/payment/paypal/order', $data)
        );
        .....
    }
mhcwebdesign commented 1 month ago

I might add, the same issue probably also exists for OpenCart 4.0.x.x or OpenCart 2.3.x.x versions, though I haven't tested them, was busy on maintaining the OC 3.0.x.x branch.