2

How would I modify the data in a PayFlow Pro transaction? I want to add some stuff to the comments. I know that the tranction data is built in the _addMethodToRequest() function in the /app/code/core/Mage/PaypalUk/Model/Api/Nvp.php file.

I really don't want to modify the core source code. We are using 1.4.0.1 with intentions of maybe upgrading later.

This post shows how to do it as a module but doesn't give the version. I followed the steps, modifying them to fit the version I have, but it isn't working. http://www.magentocommerce.com/boards/viewthread/274906/

1 Answer 1

1

If you are planning on upgrading soon, then simply copying the file to the app/code/local/Mage code pool will override the core file without the need for a custom module. Just be sure and make note of it after upgrading and simply remove the modified file from app/code/local/Mage.

However with that said. While its not ideal, it is a quick and easy way to "modify" the core without touching the core files. This is mainly useful for novice developers to make changes without physically modifying the original core file.

Ultimately the ideal solution is to find an observable event to attach the comments before the transaction is saved. Something like the event: sales_order_payment_place_start or locate another possible candidate. See here for finding more events:

If there are no available events to observe/hook into then a model rewrite like the link you provided is the next best option.

6
  • The only problem is the function above is protected, will that cause problems overriding just that method and calling the parent function to get the results and modifying them?
    – MB34
    Jun 3, 2014 at 15:42
  • Technically its not overriding in the OOP sense so a protected parent class should not cause any issues if you are copying the file to the local/Mage code pool. Magento will check this area to load a file FIRST, and skip any others in the remaining code pools (community, core, lib, etc)
    – B00MER
    Jun 3, 2014 at 15:48
  • So unlike regular OOP, you can't just override the single function in your extended class?
    – MB34
    Jun 3, 2014 at 15:49
  • You can however, it requires a custom module be created with specifics to what model you're overriding in the modules config.xml. magentocommerce.com/knowledge-base/entry/…
    – B00MER
    Jun 3, 2014 at 15:50
  • I understand that I can do it this way with the config file but not sure how the config file should look if I'm overriding the single function in the file listed.
    – MB34
    Jun 3, 2014 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.