0

I have tried multiple Extra Fee extensions and while they work fine the problem I run into is that they don't allow the tax to be added to the grand total. I have been searching through google and many other places before posting here. I was wondering if anyone had run into this problem and fixed it. I have been going at this for the past two weeks as that was when I noticed this issue.

The site that this issue is running on only charges tax for people in Iowa. If the extra fee is deleted from the site the tax adds to the grand total.

If any further information is needed to assist in this project please let me know.

Thank You Michael

EDIT I actually found my fix and now this issue has been fixed. I added

$address->setGrandTotal($address->getGrandTotal() + $address->getTaxAmount());

$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseTaxAmount());

to the collect model and that resolved my issue. I hope this might help anyone in the future.

1
  • That's really weird, but have you also tried Fooman Surcharge? I know from experience that extension works great, so if tax is still omitted it must be something in your setup. And it would be rather hard to debug. – Melvyn Jan 10 '15 at 9:27
1

please try with below code. create one observer event on module's config.xml file and create observer file inside model.

            <sales_quote_collect_totals_after>
                <observers>
                    <yourmodulename>
                        <type>singleton</type>
                        <class>NameSpace_ModuleName_Model_Observer</class>
                        <method>setCorrectTax</method>
                    </yourmodulename>
                </observers>
            </sales_quote_collect_totals_after>  

Observer.php file is below

class NameSpace_ModuleName_Model_Observer {

  public function setCorrectTax($observer)
    {
      $quote = $observer->getEvent()->getQuote();
      $canAddItems = $quote->isVirtual() ? ('billing') : ('shipping');
       foreach ($quote->getAllAddresses() as $address) {
        if ($address->getAddressType() == $canAddItems) {
         $yourtax = 'fetch here your tax'; 
         $address->setGrandTotal((float) $address->getGrandTotal() + $yourtax);                           
         $address->getBaseGrandTotal((float) $address->getGrandTotal() + $yourtax);
         $address->save();
        }
       }
    }

}

Might be this will help you!!

1
  • I added that but unfortunately it did not work. I flushed the cache and reindexed the site as well before writing this. It might be that I am doing something wrong and that's why this isnt working. Are there any other known extensions to conflict with tax not being added to grand total? – empiremike Jan 10 '15 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.