Jump to content

Append Payment Type to Module name before saving


Recommended Posts

Hi Guys, 

My first ever question! :) ... So.....
I've been working with Prestashop now for 6 weeks, after using wordpress for the last 8 years... I've managed to build a new payment module for our company,
from which, you can select from 3 different payment methods... 

  1. Credit Card
  2. Paypal
  3. PayLater

 

Everything is working great, the only issue I'm facing is when the order is saved to the database with the payment type set to -> "module name"

Q: I would like to add the name of the selected payment method to the end of the module name before saving to the database,
so when you view the order in the back office or in the PDF invoice it looks like..

Payment Method: 
MyModuleName-CreditCard

or -PayPal or -PayLater

 

I think the moduleName is being picked up from "$this->displayName" in the main class file.
but at what point or where can I append the payment type before its saved to the database?

 

I could do a read from the database with the orderID & update the field, but seems like a long work around!

 

Cheers

 

Link to comment
Share on other sites

Just found it! ;)

in my "ModuleNameValidationModuleFrontController" method..

Added this:
$module_name = $this->module->displayName.'-'.$payType; 

right before...
$this->module->validateOrder($cart_id, $payment_status, $cart_total, $module_name, $message, array(), $currency_id, false, $secure_key);

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...