Onepagecheckout: If I jump back to shipping address (i.e. from step shipping method or payment method) then I do see an empty shipping address form.
Since I "force" the customers to use billing address as shipping address I want to pre populate the shipping fields with billing address (automatically fill out shipping address for guests by using billing address).
The concerning template is
All shipping fields would get filled out automatically if a customer is logged in because all fields have values like
value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>
So actually my goal is to overwrite $this->getAddress() with the data from billing address. But I can't get it to work!
What I got so far in
// Load billing address $checkout = Mage::getSingleton('checkout/session')->getQuote(); $bilAddress = $checkout->getBillingAddress(); // Load customer model $customAddress = Mage::getModel('customer/address'); $customAddress->setData($bilAddress); // Now I want to set billing address as shipping address. But none of these 3 approaches work. $checkout->setShippingAddress(Mage::getSingleton('sales/quote_address')->importCustomerAddress($customAddress)); $this->setShippingAddress(Mage::getSingleton('sales/quote_address')->importCustomerAddress($customAddress)); $checkout->getShippingAddress()->setSameAsBilling(true);
Can anyone point me in the right direction? I ran out of ideas. Thank you very much for any help! I appreciate it!