0

I am using Magento 1.9.0.1. I want to change the grand total at Shipping Information step while checkout.I added new field called Locality in Shipping Information step.Depending on the locality selected by user, some amount should added to Grand total .And the newly changed grand total should save in db and display in order page in back end.

I added new field Locality. On change of locality field the grand total will change. But I don't know how to change the grand total. Please help me...

I only need to know How change the grand total at Shipping Information step while checkout.

Deepu Sasidharan
  • 5,193
  • 10
  • 40
  • 97
  • why you want to add some amount to grand total??? you can simply create some tax rules... – Nishant Solanki May 04 '15 at 10:02
  • Depending on the Locality selected I want to add extra amount to grand total..How can I do this by code..please.. – Deepu Sasidharan May 04 '15 at 10:07
  • by locality you mean states or countries??? – Nishant Solanki May 04 '15 at 10:08
  • please have a look at http://stackoverflow.com/questions/21430794/how-to-add-state-wise-tax-charge-without-adding-customer-and-product-class and http://stackoverflow.com/questions/11576000/magento-tax-zones-rates-how-to-incorporate-store-location-and-price-depende – Nishant Solanki May 04 '15 at 10:09
  • @NishantSolanki, locality is a newly added field just like city or landmark – Deepu Sasidharan May 04 '15 at 10:12
  • @NishantSolanki, tax rules not suit for here. – Deepu Sasidharan May 04 '15 at 10:16
  • I think that wont be so simple to do. that will need too much modifications in magento core files. but you can check this answer out ... http://stackoverflow.com/questions/4363876/how-to-set-custom-grand-total-before-checkout-process-in-magento – Nishant Solanki May 04 '15 at 11:06
  • @next2u: When ever you want to work out with the Grand Total or any changes in the Total of the product at that time you can create one "Observer" for that which will add or subtracts what ever amount you want from the cart total. Hope you can get what i am suggesting to you . –  May 04 '15 at 11:18
  • @NishantSolanki: the demo link in the answer gives nothing.. – Deepu Sasidharan May 04 '15 at 11:27
  • @PHPWeblineindia, can you post some code? I don't know how to create/where to create the "Observer".. – Deepu Sasidharan May 04 '15 at 11:30

1 Answers1

0

Currently working on the similar issue, but can't save totals after it, but the mail code looks like it. config.xml

  <global>
    <models>
      <test_example>
        <class>Test_Example_Model</class>
      </test_example>
    </models>

    <events>
      <checkout_controller_onepage_save_shipping_method>
        <observers>
          <check_totals>
            <class>Test_Example_Model_Observer</class>
            <method>checkTotals</method>
          </check_totals>
        </observers>
      </checkout_controller_onepage_save_shipping_method>
    </events>
  </global>

Function of observer

public function checkTotals(Varient_Event_Observer $observer)
    {   
        $quote      = Mage::getSingleton('checkout/type_onepage')->getQuote();
        $grandTotal = '12';

        $quote->setData('grand_total', $grandTotal);
        $quote->setData('base_grand_total', $grandTotal);
        $quote->save();
        }
    }

But I stuck on save() method, because it doesn't work somehow

tarexgg
  • 152
  • 1
  • 1
  • 12