0

How to change telephone number, check if shipping country is India i want to add +91 before place order only.

what i have tryed:

/skin/frontend/base/default/js/opcheckout.js

review.save() is calling when place order.

document.getElementById('billing:telephone').value="9123456";
document.getElementById('shipping:telephone').value="91234567";
billingnewsletter();  shipping.save();

using sales_order_save_before events:

$quote = Mage::getSingleton('checkout/session')->getQuote();
$billingaddress = $quote->getBillingAddress();
$billingtelephone = $billingaddress->getTelephone();
$billingaddress->setTelephone("31313131");
$billingaddress->save();

but it is not setTelephone

1 Answer 1

1

Please try below,

$quote = Mage::getSingleton('checkout/session')->getQuote();
$billingaddress = $quote->getBillingAddress();
$billingtelephone = $billingaddress->getTelephone();
$billingaddress->setTelephone("31313131");
$billingaddress->save();
$quote->setBillingAddress($billingaddress);
$quote->save();

======= EDIT ==============

Please use other event sales_convert_quote_to_order and use below code in that observer function

$quote = $observer->getQuote();
$billingaddress = $quote->getBillingAddress();
$billingtelephone = $billingaddress->getTelephone();
$billingaddress->setTelephone("31313131");
$billingaddress->save();
$quote->save();
2
  • i tried the above but not saving. Mar 13, 2018 at 5:39
  • Please try my updated code with mentioned event Mar 13, 2018 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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