Jump to content

soniya_.s

Recommended Posts

Hello,

I have override some custom function in order confirmation controller (override/controllers/front/OrderConfirmationController), and it works fine for payment methods(Pay by Cheque, Pay by Bank-wire),but unfortunately not working for paypal payment method.

 

Can anyone help regarding this, doesn't it be the same file i need to modify to also make it work for paypal order confirmation. Or prestashop defined some different controller for paypal order confirmation?

Link to comment
Share on other sites

Hey,

 

Basically i have implemented tracking pixel right after a click on "I confirm my order" button, so whenever  user clicks 

on "I confirm my order...", it would track that particular user purchased successfully.and for that purpose i have override OrderConfirmation Controller. Only problem is in-case of paypal i didn't receive any tracking pixel on my site (http://www.abc.com/).

So my goal is to receive tracking pixel on my site whenever user successfully purchased ,using any payment method(paypal, pay by bank-wire, pay by cheque).Below is the code snippet so you get better idea from code:

 

class OrderConfirmationController extends OrderConfirmationControllerCore

{

public function initHeader()

{

....

 


 

$data = array(

'VoucherCode'      =>  $VoucherCode,

'Amount'       => $OrderAmount

    );

                                                              

$data_string = json_encode($data);                                                                                   

       $ch = curl_init($url);                                                                      

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     

curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      

curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          

      'Content-Type: application/json',                                                                                

      'Content-Length: ' . strlen($data_string))                                                                       

       );                                                                                                                                                                                                                  

$result = curl_exec($ch);

 

return parent::initHeader();

}

}

 

Any help would be really appreciated.

 

Link to comment
Share on other sites

Yeah i have tested using paypal payment procedure, and after filling credit card information on paypal site, i can see order confirmation page assuring that "Your order on .... is complete."  but still tracking pixel doesn't get fires on order confirmation page. Don't know if there's separate "OrderConfirmation" controller for paypal or what?

Link to comment
Share on other sites

There is only a single order confirmation controller.  What is the URL of the order confirmation page when you tested with Paypal?

 

And instead of overriding the controller, the proper way is to create a module that uses the orderConfirmation hook.  Your module will be executed anytime the order confirmation page is displayed and you can add your javascript. 

 

If it has to be in the <head>, then create the module that hooks header and then you can add your javascript when the page is the order confirmation page

Link to comment
Share on other sites

  • 2 weeks later...
Thank you for your reply. i got following URL while testing with Paypal.

 


and through this url, it seems like modules/paypal/controllers/front/submit.php file is called. Now all i tried is to override paypal module's controller file, and i have placed file at location "...override\modules\paypal\controllers\front\submit.php". But still no luck, it doesn't override paypal submit.php file. is it wrong location i'm placing override file or we can't override module's controller php file anyway?

 

Any help would be really appreciated.

Link to comment
Share on other sites

I'm using Prestashop version "1.6.0.1.4", and yes i have tried to directly modify Paypal module' and it works as expected but the only drawback of doing this, is my changes won't be available in case i upgrade prestashop to newer version later on. 

Link to comment
Share on other sites

I'm using Prestashop version "1.6.0.1.4"

 

 

do you mean 1.6.0.14 ?

 

but the only drawback of doing this, is my changes won't be available in case i upgrade prestashop to newer version later on.

 

 

upgrading prestashop does not remove your customization of a custom module.

 

Now if you meant to say upgrading the paypal module, then you can still have issue with your override if the module changes the function you have overriden, or has changed the module in such a way that your override no longer works.

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