I am trying to customize the Magento Paypal Express Checkout functionality to pass the order total amount using current store's currency and rather than the base currency to Paypal. However, my customizations aren't appearing on the site.
Here is what I have created:
app/code/local/My/Paypal/Model/Express/Checkout.php
<?php
class My_Paypal_Model_Express_Checkout extends Mage_Paypal_Model_Express_Checkout {
public function getCheckoutShortcutImageUrl() {
//Copy pasted the original code with some modifications to use
// _quote->getGrandTotal()
}
public function start($returnUrl, $cancelUrl, $button = null) {
//Copy pasted original code with modifications to use
//_quote->getGrandTotal() and _quote->getStoreCurrencyCode()
}
}
?>
app/code/local/My/Paypal/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<My_Paypal>
<version>0.1.0</version>
</My_Paypal>
</modules>
<global>
<models>
<paypal>
<rewrite>
<express_checkout>My_Paypal_Model_Express_Checkout</express_checkout>
</rewrite>
</paypal>
</models>
<global>
</config>
app/etc/modules/My_Paypal.xml
<?xml version="1.0"?>
<config>
<modules>
<My_Paypal>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</My_Paypal>
</modules>
</config>
I see my module showing up correctly under System -> Configuration -> Advanced -> Advanced -> Disable Modules Output as Enable, while Mage_Poll and Mage_Tag are showing up as Disable.
Directly changing Mage_Paypal_Model_Express_Checkout works, so I know my code changes work, but the correct way of customizing a model doesn't seem to work.
I refresh and flush the Magento cache with each change, so it's not just a caching issue.
My guess is that there is something wrong with my config.xml, but at this point I can't seem to figure out what.
Any ideas? Alternatively, a better way of achieving what I want to do would also work.
Also, how do I debug Magento to understand what may be erroring out in my customization? Are there logs I can turn on or look at?
your way of implementing it is well enough. the only better way would be using events, but that is not always possible.
try to add dependency to paypal module and check if this model already has been rewritten elsewhere.