make a error page while making module prestashop 1.7


Am_Ebanx = Module name

Error = Controller name

class Am_EbanxErrorModuleFrontController extends ModuleFrontController
{

    public function initContent()
    {
        parent::initContent();
        
         $error_message = ' error message  ';
        PrestaShopLogger::addLog($error_message, 1, null, 'ebanxerror', (int)$cart->id, true);

        $this->context->smarty->assign(array(
            'error_ebanx' => $error_message,
        ));

        $this->setTemplate('module:am_ebanx/views/templates/hook/payment_error.tpl');
    }
}

---------------------------------------------------------------------------
error.tpl file
----------------------------------------------------------------------------

<!-- Header part menu -->
<head>
    {block name='head'}
        {include file='_partials/head.tpl'}
    {/block}
</head>

<body>
{hook h='displayAfterBodyOpeningTag'}
<main>
    <!-- Menu part-->
    <header id="header">
        {block name='header'}
            {include file='_partials/header.tpl'}
        {/block}
    </header>

    <!-- Header part ends -->

    <section id="wrapper">
        <div class="container">

            <section id="main">
                <section id="content" class="page-content card card-block">
                    {include file='_partials/breadcrumb.tpl'}
                    <h2>{l s='Error in Ebanx' mod='am_ebanx'}</h2>

                    <div class="table-responsive-row clearfix">
                        <p>
                            {$error_ebanx|escape:'htmlall':'UTF-8'}
                        </p>
                    </div>



                </section>
            </section>
        </div>
    </section>
    <!-- Footer starts -->

    <footer id="footer">
        {block name="footer"}
            {include file="_partials/footer.tpl"}
        {/block}
    </footer>
    <!-- Footer Ends -->
    {block name='javascript_bottom'}
        {include file="_partials/javascript.tpl" javascript=$javascript.bottom}
    {/block}
    {hook h='displayBeforeBodyClosingTag'}
</main>

</body>

---------------------------------------------------------------------------







Comments

Popular Posts