Jump to content

[PS 1.7.6] Adding hookPaymentReturn in basic payment module: ContextErrorException Undefined index: layout

Recommended Posts

I'm developing a simple payment module starting from the basic one:

I am trying to add a hookPaymentReturn
which allows me to add a tpl to the payment confirmation page (like ps_wirebank)
It fails with the following exception:

ContextErrorException Undefined index: layout

Attached the exception.

The added code has been simplified to the maximum to avoid errors

In Paymentexample.php

    public function hookPaymentReturn($params)
        if (!$this->active) {

        $state = $params['order']->getCurrentState();

            'shop_name' => $this->context->shop->name,
            'status' => 'ok'

/*        if (
        )) {

                'shop_name' => $this->context->shop->name,
//                'total' => Tools::displayPrice(
//                    $params['order']->getOrdersTotalPaid(),
//                    new Currency($params['order']->id_currency),
//                    false
//                ),
                'status' => 'ok'
//                'reference' => $params['order']->reference,
//                'contact_url' => $this->context->link->getPageLink('contact', true)
        } else {
                    'status' => 'failed'
//                    'contact_url' => $this->context->link->getPageLink('contact', true),

        return $this->fetch('module:paymentexample/views/templates/front/payment_return.tpl');


In paymentexample/views/templates/front/payment_return.tpl



Screenshot 2020-04-02 at 11.46.47.png

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More