Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How do I save the Shipping Method while skipping it on Onepage Checkout? 
 
TopEcommerce
Jr. Member
 
Total Posts:  7
Joined:  2009-10-17
 

I have successfully skipped the Shipping Method which I have set to “Flat Rate” using the method in this post:

http://www.magentocommerce.com/boards/br/errors.php/viewthread/4080/#t176291

and modifying this file MAGENTO_ROOT/app/code/core/Mage/Checkout/controllers/OnepageController.php

Yes I modified the core because I couldn’t find better option out there.

So now after inputting billing information it skips all the way down to payment information (unless they specify a different address for shipping).  However, it doesn’t not have the shipping rate saved and listed on the right-hand progress bar?

Any ideas how to go about doing this?

End Goal:

1.  Customer Arrives at Checkout
2.  Customer enters information into Billing Information Screen (I’ve Already skipped Register or Guest Option successfully)
3.  Customer chooses Billing Address as Shipping Address and is taken directly to Payment Information
Or
Customer chooses Different Shipping Address and is taken to Shipping Information which is filled and then go directly to Payment Information
4.  Shipping Method is Saved as the default method (Which I have set to Flat Rate) completely invisible to the Customer
5.  Shipping Method appears on the right column saved when Payment Information Screen is reached.
6.  I do a little dance and go have a beer!

Thank you for any and all help in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
TopEcommerce
Jr. Member
 
Total Posts:  7
Joined:  2009-10-17
 

Thank you so much for the reply tzyganu!

So I’ve implemented your code into both Onepage.php and Onpagecontroller.php

The code for Onepagecontroller.php works exactly as suspected but as soon as I use your code on Onepage.php after filling out the “Billing information” it sends me back to the cart (http://websitedomain.com/index.php/checkout/cart/) instead of down to the payment information with the shipping method saved.  Did I miss something along the way?  I’ve included code placement of both of the lines I added to Onepage.php.  Again without the code implemented in Onepage.php after filling out the “Billing Information” it will take me directly to the “Payment Information” section so I know there is nothing wrong with the Onepagecontroller.php code.

Really appreciate your help!

/**
             * Billing address using otions
             */
            $usingCase = isset($data['use_for_shipping']) ? (int) $data['use_for_shipping'0;

            switch(
$usingCase{
                
case 0:
                    
$shipping $this->getQuote()->getShippingAddress();
                    
$shipping->setSameAsBilling(0);
                    break;
                case 
1:
                    
$billing = clone $address;
                    
$this->getQuote()->getShippingAddress()->setShippingMethod(flatrate_flatrate);
                    
$billing->unsAddressId()->unsAddressType();
                    
$shipping $this->getQuote()->getShippingAddress();
                    
$shippingMethod $shipping->getShippingMethod();
                    
$shipping->addData($billing->getData())
                        ->
setSameAsBilling(1)
                        ->
setShippingMethod($shippingMethod)
                        ->
setCollectShippingRates(true);
                    
$this->getCheckout()->setStepData('shipping''complete'true);
                    break;
            
}
        }

and

$address->implodeStreetAddress();
        
$address->setCollectShippingRates(true);
        
$this->getQuote()->getShippingAddress()->setShippingMethod(s_method_flatrate_flatrate);

        if ((
$validateRes $address->validate())!==true{
            $res 
= array(
                
'error' => 1,
                
'message' => $validateRes
            
);
            return 
$res;
        
}

Thanks Again!!!!!!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
TopEcommerce
Jr. Member
 
Total Posts:  7
Joined:  2009-10-17
 

So I was missing the ‘Single Quotes’ around the shipping method… It took me straight to the “Payment Information” and I didn’t think it took because it didn’t show up in the “Your Checkout Progress” in the sidebar for the amount and method of shipping.  But it did add it in at the final order review.  So THANK YOU!

So my new question to you is on your checkout does the “Shipping Method” cost and type show up in your sidebar and if so how did you do it?

Good eye and thank you so much for all of your help!  I really appreciate it!  I wonder how much it would cost me to ship a six pack to Bucharest…

 
Magento Community Magento Community
Magento Community
Magento Community
 
TopEcommerce
Jr. Member
 
Total Posts:  7
Joined:  2009-10-17
 

IT WORKS!!!!  Thank you so, so much!  I may be passing through Romania next summer and will definitely look you up for beers if I do!  I’ll also put this into a simplified condensed post (giving credit to you of course) when I get a chance.

Again thank you so much for taking your time to help me!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top