Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Incrementing the Grand Total
 
seedeg
Sr. Member
 
Total Posts:  85
Joined:  2009-02-02
 

Hi,

I need to increment the grand total by $20. Therefore if the final grand total is $500, I need to override the Grand Total variable to be $520.

I digged in the setGrandTotal methods but all of them seem to have something to do with credit memos… What I want to do is that for every order at checkout stage, the grand total must increase by $20. Please how can I do this? I have been searching for a while now and I didn’t find a way…

I am imagining something like this: this->setGrandTotal($amount + 20)

I know that this can be done. At checkout stage I also want to grand total variable to increase in order for the customer to know about the extra $20 submission fee

Thanks for any response in advance…

 
Magento Community Magento Community
Magento Community
Magento Community
 
seedeg
Sr. Member
 
Total Posts:  85
Joined:  2009-02-02
 

I managed to increase the grand total at the checkout stage. So if the grand total is $500, at the checkout it will tell you $520. I managed this by modifying the following code in: /app/code/core/Mage/Sales/Model/Quote.php

public function getTotals()
    
{
        $totals 
$this->getShippingAddress()->getTotals();
        foreach (
$this->getBillingAddress()->getTotals() as $code => $total{
            
if (isset($totals[$code])) {
                $totals[$code]
->setValue($totals[$code]->getValue()+$total->getValue()+ 20);
            
}
            
else {
                $totals[$code] 
$total;
            
}
        }
        
return $totals;
    
}

Of course, the +20 is the part that i added.

However, in the orders section in the backend, the grand total of the order is still $500. Obviously, this means that only $500 will be charged. Am I right?

Does someone has any idea how can I increment the grand total from the back-end as well so ultimately, the extra $20 will be charged.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

hey seedeg,

um there is now an extension that might fit your needs for this

see http://www.aitoc.com/en/magentomods_loyalty_program.html

im currently trying it out on a project

hth
brendan

 
Magento Community Magento Community
Magento Community
Magento Community
 
lb336603
Jr. Member
 
Total Posts:  16
Joined:  2009-03-07
 

So I needed a similar function, to divide all orders in half to create a downpayment. I will charge customers the second half of their order upon completion of purchased services.

I followed your instructions with different math at the end and it worked!

public function getTotals()
    
{
        $totals 
$this->getShippingAddress()->getTotals();
        foreach (
$this->getBillingAddress()->getTotals() as $code => $total{
            
if (isset($totals[$code])) {
                $totals[$code]
->setValue($totals[$code]->getValue()+$total->getValue() / 2);
            
}
            
else {
                $totals[$code] 
$total;
            
}
        }
        
return $totals;
    
}

I’m so excited to actually have that working but my problem now is that I cant figure out how to simply change the wording in the cart from ‘grand total’ to ‘downpayment’. I want it to be very clear that the number there is not the order total, but half that.

Any suggestions, and thanks for the advice!

 
Magento Community Magento Community
Magento Community
Magento Community
 
seedeg
Sr. Member
 
Total Posts:  85
Joined:  2009-02-02
 

To change the Grand Total text to Downpayment navigate to the csv file:

/app/design/frontend/"interface"/"template"/locale/"Your Language Folder"/translate.csv and then enter the following:

“Grand Total”,"Downpayment"

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