Magento Forum

Adding a new address total
 
mrjabruce
Jr. Member
 
Total Posts:  7
Joined:  2008-03-24
 

Hello, I am messing around with the checkout capabilities of Magento and would like the following functionality. When on onepage checkout and at the review section, I need to be able to insert my own total, such as a rewards total. This field will be input from the cart page, and applied after the subtotal, but before grand total. I need this to be deducted from subtotal, but only up to the amount of subtotal, not more. How do I do this? I saw that grand total, subtotal, and discount total have models that use a fetch function. So I have coded my own Rewards model, but now how do I link it so that the cart knows how to find it and put it in the right spot on the one page review section? Any help would be very appreciated.

Thanks,
J

 
Magento Community Magento Community
Magento Community
Magento Community
 
mrjabruce
Jr. Member
 
Total Posts:  7
Joined:  2008-03-24
 

I also tried adding the following to my module’s config.xml, but when I have it in my config.xml, I get a not found error.

<!-- This is in my RewardsCheckout module (which is a custom module) -->
    <global>
        <
sales>
            <
quote>
                <
totals>
                    <
rewards>
                        <class>
rewardscheckout/quote_address_total_rewards</class>
                        <
after>subtotal</after>
                        <
before>grand_total</before>
                    </
rewards>
                </
totals>
            </
quote>
        </
sales>
    </global>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

and you have this in your custom module config?

<config>
    <global>
        <
models>
            <
rewardscheckout>
                <class>
YourNameSpace_RewardsCheckout_Model</class>
            </
rewardscheckout>
        </
models>
    </global>

It is also possible to provide just plain class name in your <totals> configuration:

<rewards>
                        <class>
YourNameSpace_RewardsCheckout_Model_Quote_Address_Total_Rewards</class>
 
Magento Community Magento Community
Magento Community
Magento Community
 
mrjabruce
Jr. Member
 
Total Posts:  7
Joined:  2008-03-24
 

Thanks Moshe! i now have it showing up in the cart and checkout pages smile

My next question is this. I notice that for the different totals they use the passed in $address object to get the value for the total. Such as $address->getTaxAmount().  Is it possible to overload the Mage_Sales_Model_Quote_address to add an extra function such as getRewardsAmount()? Or should I do it another way? I hope that makes sense.

Also, now that I have it as a total, how do I get it to actually subtract from the subtotal and display in the grand total? Right now it only shows the item, but does not actually subtract it from the grand total.

Thanks,
J

 
Magento Community Magento Community
Magento Community
Magento Community
 
mrjabruce
Jr. Member
 
Total Posts:  7
Joined:  2008-03-24
 

I found the following classes:

Mage_Sales_Model_Convert_Order and Mage_Sales_Model_Convert_Quote

do I need to overload/override these classes to get the functionality i seek?

Thanks,
J

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top