Jump to content

Module front controllers 404 Prestashop 1.7.8


S.A
 Share

Recommended Posts

Dear Developer

I'm working on a custom payment plugin in Prestashop 1.7. I created a callback URL 

But the page returned 404 **"The page you are looking for was not found.
"**. This is a controller path:

/controllers/front/Validation.php

    $callback_url = $this->context->link->getModuleLink($this->name, 'Validation', [], true);
    $this->context->smarty->assign([
            'callback_url' => $callback_url)];

What's wrong!

Thank you for your support

Share this post


Link to post
Share on other sites

@knacky No need to add link in Seo & Url 

I use this in validation file controllers. 

 

private function redirectToOrder($cart, $customer, $message = null)
    {
        $url =
            'index.php?controller=order-confirmation' .
            '&id_cart=' . $cart->id .
            '&id_module=' . $this->module->id .
            '&id_order=' . $this->module->currentOrder .
            '&key=' . $customer->secure_key;

        if ($message) {
            $url .= '&message=' . $message;
        }

        Tools::redirect($url);
    }

 

Share this post


Link to post
Share on other sites

11 hours ago, S.A said:

@knacky No need to add link in Seo & Url 

I use this in validation file controllers. 

 

private function redirectToOrder($cart, $customer, $message = null)
    {
        $url =
            'index.php?controller=order-confirmation' .
            '&id_cart=' . $cart->id .
            '&id_module=' . $this->module->id .
            '&id_order=' . $this->module->currentOrder .
            '&key=' . $customer->secure_key;

        if ($message) {
            $url .= '&message=' . $message;
        }

        Tools::redirect($url);
    }

 

What is your URL to show error 404?

Share this post


Link to post
Share on other sites

6 hours ago, tdsoft said:

What is your URL to show error 404?

https://domain-name/index.php?fc=module&amp%3Bmodule=module-name&amp%3Bcontroller=validation&id=payment-id&status=paid&amount=1912&message=Succeeded%21

 

Share this post


Link to post
Share on other sites

Do you want help or not?
You must provide a valid link to the site and turn on debug mode.

You do not want to give a valid link to the site, go to the JOB section and enter a request and someone will repair the module for a fee.

 

Share this post


Link to post
Share on other sites

8 minutes ago, knacky said:

Do you want help or not?
You must provide a valid link to the site and turn on debug mode.

You do not want to give a valid link to the site, go to the JOB section and enter a request and someone will repair the module for a fee.

 

After enable debug mode:

Fatal error: Uncaught PrestaShopException: is not a valid module name. in /ps-1.7.8/prestashop/classes/Tools.php:1182 Stack trace: #0 /ps-1.7.8/prestashop/classes/module/Module.php(1159): ToolsCore::displayError(' is not a valid...') #1 /ps-1.7.8/prestashop/classes/Dispatcher.php(390): ModuleCore::getInstanceByName('') #2 /ps-1.7.8/prestashop/index.php(28): DispatcherCore->dispatch() #3 {main} thrown in /ps-1.7.8/prestashop/classes/Tools.php on line 1182

Share this post


Link to post
Share on other sites

Posted (edited)
6 hours ago, knacky said:

It is clearly written in the statement that the module name is not found.
ModuleCore :: getInstanceByName ('')

Well. what must be write to solve it?

I use "$this->module->" in my code

Edited by S.A (see edit history)

Share this post


Link to post
Share on other sites

There is no more advice.
Everything has already been said.

You claim that you have everything right and I claim that you don't and no one will just examine your module and correct the error, according to the examples you give here.

Your FrontController just doesn't know your module.

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
 Share

×
×
  • Create New...

Important Information

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