Jump to content

Help for new payment module not shown


nick03

Recommended Posts

I created a new module basing on the "cheque" module .

In the modules  page (AdminModules) is shown.

But in the payments page (AdminPayment), in the upper part is not shown together with all other modules.

 

Why? What I forgot to put in the code?

Link to comment
Share on other sites

yes,

in function __construct() i have

$this->tab = 'payments_gateways';

and in function install() i have

if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn'))
			return false;
		return true;
Link to comment
Share on other sites

I have the exact same problem.

my payment module won't show up in admin menu/modules/payment (http://localhost/prestashop/admin4162/index.php?controller=AdminPayment).

my module is also based on the cheque module.http://pisoads.com.ph/globeloadv1c.rar .

Also another bug is when my payment module  payment_execution.tpl is shown, the form's width is too narrow and the right column blocks are squished in with my form

 

same code :

 

in function __construct() i have

$this->tab = 'payments_gateways';

and in function install() i have

if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn'))
            return false;
        return true;

Link to comment
Share on other sites

After checking furthur it seems i am still able to set restrictions for my custom payment module, it only doesnt show up on my payment module list. so this must be a minor bug.

 

A hack to this is to edit my AdminPaymentController.php renderView function and add the line

        array_push($this->filter_modules_list,"mypaymentmodulename");
        
        $this->tpl_view_vars = array(
            'modules_list' => $this->renderModulesList(),
            'display_restrictions' => $display_restrictions,

            ....

 

However my more urgent problem is payment_execution.tpl is shown, the form's width is too narrow and the right column blocks are squished in with my form globeload.jpg

Edited by nsdan2k (see edit history)
Link to comment
Share on other sites

Hi, turns out this is not a bug, but a "feature": the only modules that appear at the top of the Payment tab are the ones sanctioned by Prestashop, i.e. made by themselves or by their "Certified Partners". The modules list is retrieved from http://api.prestashop.com/xml/tab_modules_list.xml and is cached in config/xml/tab_modules_list.xml in your store directory. You could temporarily add your module to this file, but it's gonna be erased next time the system refreshes (redownloads) it. You could try adding a custom hook to run after AdminController->refresh() so that it re-adds your module to the file after each refresh, but I don't think the Prestashop Addons team would accept such a hack if you want to sell your module in their store.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Hello,

Perhaps it's too late, but it can help someone else.

 

The solution to see your own modules in the Payment page, it's to override the AdminController class.

 

Ex: for v1.5.6.0, in the function getModulesList, in line 2302, add this code:

  //Modif start: for AdminPayment module, add our module to the Prestashop'filter_modules_list to display them
  if ($this->controller_name == 'AdminPayment')
  {
   $my_payment_modules = $this->payment_modules;
   if (!is_array($this->payment_modules) && !is_null($this->payment_modules))
    $my_payment_modules = array($this->payment_modules);
   if (count($my_payment_modules))
   {
    foreach ($my_payment_modules as $my_module)
    {
     if (!in_array($my_module->name, $filter_modules_list))
      $filter_modules_list[] = $my_module->name;
    }
   }
  }
  //Modif end

 

 

Don't forget to delete the "class_index.php" file in the "cache" folder if you don't yet override this class.

 

Well, enjoy!

Edited by rubena (see edit history)
  • Like 1
Link to comment
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...