Jump to content

Payment Module Delvelopment


brad890

Recommended Posts

Hi guys I'm hoping someone can help me, I'm trying to use the Pasyfast payment module, Which I've downloaded from the 3rd party payment gateway website, I'm guessing they developed the module as I cant find it on the prestashop website.

 

the module works perfectly BUT: it doesnt generate order creation e-mails sent to the customers and it doesnt notify the store owner of the newly placed order.

 

what I'd like to know is it possible to add some code to the core files that it generates the order creation e-mail and is linked to the "mail Alerts" module

 

here is a link to the 3rd part website for the module, I've also attached the .php and .xml files for the module

 

https://www.payfast.co.za/developers/prestashop

 

unless I'm trying to over complicate things and can link the above in the admin portion of the website?

config.xml

payfast.php

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

 

the key is that it creates it's own order status (under statues) or uses and existing one. This is what drives the emails....

 

thank you for the reply, how would I link it to a order status automatically, once its returned the customer to the payment successful page?

 

at the moment once the module has been used to make the payment, on the admin side under status is has nothing just "--"

Link to comment
Share on other sites

you can use existing payment modules to see how they create or use existing orders statues...bank wire, paypal, authorize net for example...

 

if you want a unique order state for your payment method then you will need a create new order state and delete order state

 

I've been trying to figure out how to link them for the last few days :wacko: I cant seem to find the option to link the module to a status automatically.

 

I've figured out how to add new statuses, and change them manually but cant seem to find out how to get prestashop to automatically set the order to a specific status when the order is created

Link to comment
Share on other sites

Ok maybe I'm not wording my question correctly, maybe let me try explain it in a scenario

 

Person X buys something from my store, uses the payment gateway "payfast" (module I've instlled)

 

as is at the moment I receive no notifications that order has been placed, but is added under orders in the back office (I get notifications for all default prestashop payment options, so not a problem with E-mail settings)

 

under orders the order status is blank "--" I now have to manually select a order status before preson X receives his first e-mail confirmation of the order.

 

is there a way to set that when person X places their order via the "payfast" module it automatically goes to the status "Payment remotely accepted" and I dont have to manually do it?

Link to comment
Share on other sites

I understood your question..and I apologize that but my responses did not clear things up for you...

 

you would modify the payfast module you have to use the order status that exists....else you create a new order status used by the payfast...

 

so yes there is a way...did you want to do it yourself, i.e. this is the developer portion of the forum...or are you looking for someone to do it for you?

Link to comment
Share on other sites

you would modify the payfast module you have to use the order status that exists....else you create a new order status used by the payfast...

 

so yes there is a way...did you want to do it yourself, i.e. this is the developer portion of the forum...or are you looking for someone to do it for you?

 

I know this is the developer section, I was hoping guys who had built their own payment modules would be able to help me, I dont know too much about coding, but am trying to learn

 

so what file would I need to edit to get the module to go to a predefined status? and what code would I need to insert?

 

would you be able to show me an example? say I wanted the wire transfer to rather go to "payment accpeted" instead of "awaiting bank wire payment" what specific code would I have to change? and where?

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

that's the problem isn't it...I don't have the module to tell you specifically where to change it...

 

what are you using for and editor? do you have your local computer set up to run apache and php?

 

you should have some decent working environment before putting on the developers hat...

 

I suggest dreamweaver...it's free for 30 days...but you can't really develop, until you can easily search (locate code)...modify it and test it...

Link to comment
Share on other sites

that's the problem isn't it...I don't have the module to tell you specifically where to change it...

 

what are you using for and editor? do you have your local computer set up to run apache and php?

 

you should have some decent working environment before putting on the developers hat...

 

I suggest dreamweaver...it's free for 30 days...but you can't really develop, until you can easily search (locate code)...modify it and test it...

 

editing the code isnt the problem, I've got the relevant programs to do that, have been fiddling around changing text, moving stuff, changing modules etc. and have been trying to work out how the default payment modules work by reading their code.

 

It's just I'm not sure what code line I'm supposed to be looking for, or adding to have a payment module automatically be set as a defined status when used

 

or where the statuses are referenced in payment module code? would it be referenced in the main module .php code? or would it be in one if the index or config codes?

Link to comment
Share on other sites

I don't want you to think that I am not sharing..but not all module fit the same pattern....so asking where to put code...well that varies by module...

 

here is a module I upgraded and provide free, the original module required that you manually add order status, I thought that's stupid, then added the code...and have been giving it away for free...though I do see the same or similar module now on add-on's for pay.

 

http://www.prestashop.com/forums/topic/153984-module-free-pagosonline-for-prestashop-145/page__fromsearch__1

 

another little tip...the last little module I created for payment, efecty..basically created from bankwire...took me 2 and a half weeks...to modify...and test...

 

best of luck in with your new developers hat

Link to comment
Share on other sites

thank for all your time and help elpatron :) , I managed to find what I was looking for in one of the other threads in the forum

 

http://www.prestashop.com/forums/topic/7643-how-to-change-default-order-status-for-some-payment-module/

 

turns out I was looking for the wrong code, statuses are referenced as _PS_OS_(different statuses) and to change a default payment module status it looks like one needs to change it in the /validation.php of that module

Link to comment
Share on other sites

here are two functions that I've written for last payment module...one adds new order status, the other removes it...used in install/uninstall...note: if it checks for 1.4 and it's not, then it assumes it.s 1.5...

 

private function _createOrderState()
{
 if (!Configuration::get('PS_NEW_ORDER_STATUS'))
 {
  $orderState = new OrderState();
  $orderState->name = array();
  foreach (Language::getLanguages() as $language)
  {
if (strtolower($language['iso_code']) == 'es')
 $orderState->name[$language['id_lang']] = 'EN ESPERA DE PAGO POR YOUR PAYMENT METHOD';
else
 $orderState->name[$language['id_lang']] = 'Awaiting YOUR PAYMENT METHOD Payment';
  }
  $orderState->send_email = true;
  if (substr(_PS_VERSION_, 0, 3) == '1.4')
$orderState->color = 'lightblue';
  else
$orderState->color = 'royalblue';
  $orderState->hidden = false;
  $orderState->delivery = false;
  $orderState->logable = false;
  $orderState->invoice = false;
  if (substr(_PS_VERSION_, 0, 3) == '1.4')
$orderState->template = array_fill(0,10,"yourmailtemplatefolder");
  else
$orderState->template = 'efecty';
  if ($orderState->add())
  {
@copy(dirname(__FILE__).'/../../modules/'.$this->name.'/logo.jpg', dirname(__FILE__).'/../../img/os/'.(int)$orderState->id.'.gif');
@copy(dirname(__FILE__).'/../../modules/'.$this->name.'/copymails/en/youremailtemplate.html', dirname(__FILE__).'/../../mails/en/youremailtemplate.html');
@copy(dirname(__FILE__).'/../../modules/'.$this->name.'/copymails/en/youremailtemplate.txt', dirname(__FILE__).'/../../mails/en/youremailtemplate.txt');
@copy(dirname(__FILE__).'/../../modules/'.$this->name.'/copymails/es/youremailtemplate.html', dirname(__FILE__).'/../../mails/es/efecty.html');
@copy(dirname(__FILE__).'/../../modules/'.$this->name.'/copymails/es/youremailtemplate.txt', dirname(__FILE__).'/../../mails/es/efecty.txt');
Configuration::updateValue('PS_NEW_ORDER_STATUS', (int)$orderState->id);
  }
 }
}
private function _deleteOrderState()
{
 $orderState = new OrderState(Configuration::get('PS_NEW_ORDER_STATUS'));
 return $orderState->delete();
}

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