To get a customer's default billing adress you can do the following:
<?php
$customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
$visitorData = Mage::getModel('customer/customer')->load($customerId);
$billingaddress = Mage::getModel('customer/address')->load($visitorData->default_billing);
$addressdata = $billingaddress ->getData();
$addressdata['street'];
$addressdata['city'];
$addressdata['postcode'];
$addressdata['region'];
$addressdata['telephone'];
var_dump($addressdata);
Before starting,we need to what are the functionality of two forms.
- First form is given result list of available shipping methods basic
of your select country and other address details.
- Another update total basic of selected method.
You could not merge two form into one form because of whenever an address have multiple shipping methods then you need to selected one of those.For this case it should be wrong process.
An idea ,consist of two form.But all two form content will be update via ajax.
Lets go ESTIMATE SHIPPING AND TAX form.
for doing all using ajax for this form.You need to change something
- Change Get Quote button on click code
from
onclick="coShippingMethodForm.submit()";
to
onclick="coShippingMethodForm.submit(); return false;"
Then on coShippingMethodForm.submit=function()
call a prototype ajax
for getting available shipping methods list:
new Ajax.Request(this.form.action, {
method:this.form.method,
parameters: this.form.serialize(),
onLoading:function(){ },
onSuccess: function(transport) {
jQuery("#avaliable-Shipping-method").html(transport.responseText);
},
onFailure: function() { }
});
Now you need to override
Checkout Cartcontroller.php
for getting available shipping methods
using ajax and response the list shipping from estimatePostAction()
.
and create a div#avaliable-Shipping-method for update your formusing list of avlaible shipping methods
Best Answer
First you need to create Quote Collection object
After that you need to filter Collation by customer id