I'm using magento 1.9, and I just added a custom total following this tutorial: http://www.classyllama.com/blog/unravelling-magentos-collecttotals-example. Everything is working fine in terms of the total showing up in the cart, purchase history, purchase confirmation, etc, as well as actually being added to the total and saved to all the right tables.
I'm also using the Enterprise Reward module to allow customers to pay with points.
There's an issue, however: let's say a customer gets an item to which this new fee applies, and then they choose to use their points to pay, and their points happen to cover their entire order. In this scenario, the grand total paid is $0.00, and what they pay with points is the equivalent of the expected total + points, all's fine and dandy until this point, and the order that's saved to the database looks okay to me.
If one goes to look at the invoice generated, however, one can see that the invoice thinks only everything except the fee was covered by points, and thus the invoice says that the customer "paid" the fee (e.g. total paid is let's say $3 which is exactly what the fee is).
I tried to do some troubleshooting and noticed that when the Invoice model gets its total models as part of collectTotals, it gets them in such an order that the reward calculation happens before the fee calculation, and when I debug the reward module, it does indeed only see the total before the fee is applied and that's why it only says it'll use points for that, ignoring the fee.
I tried setting the
before node in my module's config.xml to explicitly say that it has to happen before
reward for the
order_invoice entry, like so:
<order_invoice> <totals> <fee> <class> the_fee/sales_order_invoice_total_fee </class> <after>subtotal</after> <before>reward</before> </fee> </totals> </order_invoice>
I tried adding more totals to both
after nodes, clearing all the caches I could clear in between and even though the config seems to be read anew in between tries, I still encounter the issue.
Is there any other place I should be updating to ensure that this is calculated correctly? Should I be messing with the Reward module? Or some other config? Usually changing stuff in config.xml has the expected effect but this has me at wits end, any pointers will be extremely appreciated!!