0

I have created an placeorder function that is placing order programmatically. Now, I need to another function which can update the shipping address of an order. I am using the below code, but it is giving error Call to a member function getId() on boolean in.

Please help me if anyone idea about this.

                $order = Mage::getModel('sales/order')->load($data['orderId']);

                $orderShippingAddress = $order->getBillingAddress()->getId();
                $orderShipping = Mage::getModel('sales/order_address')->load($orderShippingAddress);
                $shippingAddress
                    ->setPrefix($data['prefix'])
                    ->setFirstname($name[0])
                    ->setLastname($name[1])
                    ->setEmail($data['email'])
                    ->setCompany($data['houseNo'])
                    ->setStreet(array(
                         '0' => $data['area'], // compulsory
                         '1' => $data['landmark'] // optional
                     ))
                    ->setCity($data['city'])
                    ->setCountry_id('IN')
                    ->setRegion($data['state'])
                    ->setRegion_id($region_id)
                    ->setPostcode($data['pincode'])
                    ->setTelephone($data['telephone'])
                    ->setFax($data['bulidingName'])
                    ->setSaveInAddressBook(1)
                    ->save();
2
  • I am getting the post data in $data variable, Mar 20, 2018 at 10:52
  • I have resolved the issue. The issue was I was trying to load the order using load function. But I was passing increment_id instead of entity_id. So, solution was loadByIncrementId. Mar 21, 2018 at 10:21

0

Your Answer

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

Browse other questions tagged or ask your own question.