3

I have different store views, one with code 'en' (this works) and one with code 'es_es' (this does not work and redirects me to the home).

This is the condition that redirects:

if ($result[0] == self::HTTP_CODE_OK) {
                            $this->sendEmailSuccessCreateRma($result[1]);
                            $this->messageManager->addSuccessMessage(__('RMA was created successfully'));
                            $this->_redirect('sap/rma/index');
                        } else {
                            $this->messageManager->addErrorMessage($result[1]);
                        }

And this statement in thephtml:

 <div class="actions-toolbar">
                <div class="primary">
                    <button type="submit" class="action primary" data-role="rma-submit">
                        <span><?= __('Submit Request') ?></span>
                    </button>
                </div>
            </div>
0

Inject the following class to your construct function:

\Magento\Store\Model\StoreManagerInterface $storeManager

and then use the following code for correct url for redirection:

$url = $this->_storeManager->getStore()->getUrl('sap/rma/index');
$this->_redirect($url);
|improve this answer|||||
  • Magento returns a blank page. I do not know where to see the error, the syntax is correct :( – chdzma Jul 12 '18 at 9:57
  • can you check the log? – Sukumar Gorai Jul 12 '18 at 10:24
  • What is the path of log file? In this case, var / log of magento do not show me any error – chdzma Jul 12 '18 at 12:38
  • magento_root/var/log/ this is the only path for magento logs. Enable php error so that you can see the errors for the website. – Sukumar Gorai Jul 12 '18 at 12:38
  • Yes i know, but it does not show me any error any of the logs – chdzma Jul 16 '18 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.