Getting order total on checkout screen

Posts: 69
Joined: 08/08/2007
Early adopter... addicted to alphas.Getting busy with the Ubercode.

I tried searching the forums but couldn't seem to get an answer to this question. Is there a simple way on the checkout screen (where addresses are entered, etc) to get the cart total? I'm working on a module that needs to make a calculation based on the order total and I can't seem to find a simple way to get the total. I thought arg1 held the order, but I'm thinking maybe the order hasn't been created at that point, or I'm just mis-typing something and I've just got a variable wrong. Any help would be greatly appreciated.

Cheers,
Steph

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Steph, I think I saw in the other post that you found this is part of the Payment module's checkout pane. I'm not sure if this should be part of that pane or not, but it makes sense (for taxes and shipping calculation) that the order total preview will come after addresses are entered and before payment details are entered. Did you have a case where you wanted the total preview w/o collecting payment?

Posts: 69
Joined: 08/08/2007
Early adopter... addicted to alphas.Getting busy with the Ubercode.

Hi Ryan,

Yeah, that other post was for a different module, and that was just I hadn't completely setup the store since I did a clean install. Since it was just for testing, I completely forgot about setting up payments. It wasn't a case of wanting it without collecting payment, it was just since it wasn't a real store, I didn't setup payments. My bad.

For this case basically I'm trying to get the order total so I can make a calculation based on that. I want to get the order total, and figure out what amount of change is needed to make it a whole number, and allow the user to donate that amount of money. So first I need to calculate after shipping, etc is added to the order total, what that order total is, then I need to round it up, then subtract the actual order total from the rounded up one. But then I want to actually make that amount a line item and then end up adding it to the order total.

Hmm...now that I've written that out, I'm starting to realize the problem. Maybe I should have it so that on the checkout page people just check a checkbox to say that they want to donate the change to make their order total even, and then on the review screen update the order.

Obviously you know the system better Ryan, can you give me a suggestion on the best way of going about this?

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Yeah, I think the checkbox method will end up being the most foolproof. There wouldn't really be an easy way for you to get the order total on the checkout screen itself. It might even be better to somehow add the checkbox to the review form where you can display how much will be donated... but that might get overlooked more often.