3 Redirecting from block not working
source | link

You can achieve this with the Process 2, with a slight change.

You have to use ResultFactory instead of RedirectFactory and you have to specify the type as redirect, so your code should be changed to

public function __construct(
    ................
    .......................
    \Magento\Framework\Controller\ResultFactory $resultFactory,
) {
    parent::__construct($context, $data);
    ........
    ..........
    $this->resultFactory = $resultFactory;
}
public function redirectAccordingToStatus($status='30')
{
    $resultRedirect = $this->resultFactory->create(ResultFactory\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT);
    return $resultRedirect->setPath('paym/payment/cancel');
}

Run the setup upgrade again and check if it's working.

You can achieve this with the Process 2, with a slight change.

You have to use ResultFactory instead of RedirectFactory and you have to specify the type as redirect, so your code should be changed to

public function __construct(
    ................
    .......................
    \Magento\Framework\Controller\ResultFactory $resultFactory,
) {
    parent::__construct($context, $data);
    ........
    ..........
    $this->resultFactory = $resultFactory;
}
public function redirectAccordingToStatus($status='30')
{
    $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
    return $resultRedirect->setPath('paym/payment/cancel');
}

Run the setup upgrade again and check if it's working.

You can achieve this with the Process 2, with a slight change.

You have to use ResultFactory instead of RedirectFactory and you have to specify the type as redirect, so your code should be changed to

public function __construct(
    ................
    .......................
    \Magento\Framework\Controller\ResultFactory $resultFactory,
) {
    parent::__construct($context, $data);
    ........
    ..........
    $this->resultFactory = $resultFactory;
}
public function redirectAccordingToStatus($status='30')
{
    $resultRedirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT);
    return $resultRedirect->setPath('paym/payment/cancel');
}

Run the setup upgrade again and check if it's working.

2 Redirecting from block not working
source | link

You can achieve this with the Process 2, with a slight change.

You have to use ResultFactory instead of RedirectFactory and you have to specify the type as redirect, so your code should be changed to

public function __construct( ................ ....................... \Magento\Framework\Controller\ResultFactory $resultFactory, ) { parent::__construct($context, $data); ........ .......... $this->resultFactory = $resultFactory; } public function redirectAccordingToStatus($status='30') { $resultRedirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT); return $resultRedirect->setPath('paym/payment/cancel'); }

public function __construct(
    ................
    .......................
    \Magento\Framework\Controller\ResultFactory $resultFactory,
) {
    parent::__construct($context, $data);
    ........
    ..........
    $this->resultFactory = $resultFactory;
}
public function redirectAccordingToStatus($status='30')
{
    $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
    return $resultRedirect->setPath('paym/payment/cancel');
}

Run the setup upgrade again and check if it's working.

You can achieve this with the Process 2, with a slight change.

You have to use ResultFactory instead of RedirectFactory and you have to specify the type as redirect, so your code should be changed to

public function __construct( ................ ....................... \Magento\Framework\Controller\ResultFactory $resultFactory, ) { parent::__construct($context, $data); ........ .......... $this->resultFactory = $resultFactory; } public function redirectAccordingToStatus($status='30') { $resultRedirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT); return $resultRedirect->setPath('paym/payment/cancel'); }

Run the setup upgrade again and check if it's working.

You can achieve this with the Process 2, with a slight change.

You have to use ResultFactory instead of RedirectFactory and you have to specify the type as redirect, so your code should be changed to

public function __construct(
    ................
    .......................
    \Magento\Framework\Controller\ResultFactory $resultFactory,
) {
    parent::__construct($context, $data);
    ........
    ..........
    $this->resultFactory = $resultFactory;
}
public function redirectAccordingToStatus($status='30')
{
    $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
    return $resultRedirect->setPath('paym/payment/cancel');
}

Run the setup upgrade again and check if it's working.

1
source | link

You can achieve this with the Process 2, with a slight change.

You have to use ResultFactory instead of RedirectFactory and you have to specify the type as redirect, so your code should be changed to

public function __construct( ................ ....................... \Magento\Framework\Controller\ResultFactory $resultFactory, ) { parent::__construct($context, $data); ........ .......... $this->resultFactory = $resultFactory; } public function redirectAccordingToStatus($status='30') { $resultRedirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT); return $resultRedirect->setPath('paym/payment/cancel'); }

Run the setup upgrade again and check if it's working.