I want to be able to provide estimated shipping quote to people using a
country/zip code field entry. I am not sure how to continue. I see that
the rate_hash method passes in the order object and the calculators use the
shipping_address attribute on the order for the address. That said, is
there a way I can just pass in the country and zip code to get back the
rates hash?

I guess I can have the user enter a whole address, but the point is to
provide a quick method for calculating a shipping quote.

Regards,

Nate

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/50UsGszywAsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

Search Discussions

  • Elliot Gage at Jan 4, 2013 at 3:59 am
    Did you have any luck with getting something to work? I'm looking to do the
    same as well.
    Before I start hacking out a solution, thought I'd check ;)
    On Saturday, December 15, 2012 10:12:09 AM UTC-8, Nate Lowrie wrote:

    I want to be able to provide estimated shipping quote to people using a
    country/zip code field entry. I am not sure how to continue. I see that
    the rate_hash method passes in the order object and the calculators use the
    shipping_address attribute on the order for the address. That said, is
    there a way I can just pass in the country and zip code to get back the
    rates hash?

    I guess I can have the user enter a whole address, but the point is to
    provide a quick method for calculating a shipping quote.

    Regards,

    Nate
    --
    You received this message because you are subscribed to the Google Groups "Spree" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/E-eiRv2WFZAJ.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
  • Nate Lowrie at Jan 4, 2013 at 2:40 pm
    Elliot,

    I actually did just get it working last weekend. I ended up actually
    putting a shipping_address form on the cart form. Then I had to do a few
    things:

        1. Decorate the orders controller edit method to properly generate a
        shipping address. I set everything but country, state, and zipcode to
        "quote". Turns out you only need those 3 when calculating shipping.
        2. On the shipping_address form I used hidden fields for all of the
        fields I didn't want to show.
        3. I had to expand the checkout coffeescript to include the quote fields
        in the state mapping/setting and properly target the update-cart form.
        4. Decorate the orders controller update method to check to see if the
        get quote button is pressed. If it is, I remove the line item params so
        they don't get updated. If it wasn't the quote button, you need to remove
        the shipping_address_attributes params otherwise the order update will
        throw an error.
        5. Decorate the checkout controllers before_address method to remove the
        quotes from the shipping_address if they are there.
        6. Add logic to the view for showing rates. When the ship address is
        present and valid, I show the values from the rates_hash method and hide
        the shipping quote fields.

    The advantage of using the shipping_address are many:

        - The data persists across page loads so the user enters it once and
        then each time the cart is updated the new shipping quote is displayed
        - The country/state/zip code data is already there when the user enters
        the billing/shipping addresses on checkout.
        - If the user enters addresses in checkout and then goes back to the
        cart, the system will user those checkout addresses for the shipping quote.

    Right now this is bundled with my theme, but I will break it out into a
    plugin w/ tests soon. It's heavily tied in at the moment and I am not sure
    how useful it will be to you if you use the standard theme. I can send you
    the code off list if you want.

    Regards,

    Nate
    On Thursday, January 3, 2013 10:55:03 PM UTC-5, Elliot Gage wrote:

    Did you have any luck with getting something to work? I'm looking to do
    the same as well.
    Before I start hacking out a solution, thought I'd check ;)
    On Saturday, December 15, 2012 10:12:09 AM UTC-8, Nate Lowrie wrote:

    I want to be able to provide estimated shipping quote to people using a
    country/zip code field entry. I am not sure how to continue. I see that
    the rate_hash method passes in the order object and the calculators use the
    shipping_address attribute on the order for the address. That said, is
    there a way I can just pass in the country and zip code to get back the
    rates hash?

    I guess I can have the user enter a whole address, but the point is to
    provide a quick method for calculating a shipping quote.

    Regards,

    Nate
    --
    You received this message because you are subscribed to the Google Groups "Spree" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/pjnOr_DHElQJ.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
  • Francesco Carrella at Sep 8, 2013 at 8:23 am
    Hi Nate, I'm very interested about that.
    Do you like to share this code? Can we help you to improve & maintain it?

    Tnx,
    Francesco
    On Saturday, December 15, 2012 7:12:09 PM UTC+1, Nate Lowrie wrote:

    I want to be able to provide estimated shipping quote to people using a
    country/zip code field entry. I am not sure how to continue. I see that
    the rate_hash method passes in the order object and the calculators use the
    shipping_address attribute on the order for the address. That said, is
    there a way I can just pass in the country and zip code to get back the
    rates hash?

    I guess I can have the user enter a whole address, but the point is to
    provide a quick method for calculating a shipping quote.

    Regards,

    Nate
  • Francesco Carrella at Nov 3, 2013 at 7:07 pm
    Tnx Nate! I appreciate that

    I can't wait! :P

    On Monday, September 16, 2013 5:24:13 PM UTC+2, Nate Lowrie wrote:

    Give me a few weeks to pull it out into an extension. I am in the middle
    of upgrading spree from 1.2 to 2.1 at the moment.

    Regards,

    Nate
    On Saturday, September 7, 2013 6:33:21 PM UTC-4, Francesco Carrella wrote:

    Hi Nate, I'm very interested about that.
    Do you like to share this code? Can we help you to improve & maintain it?

    Tnx,
    Francesco
    On Saturday, December 15, 2012 7:12:09 PM UTC+1, Nate Lowrie wrote:

    I want to be able to provide estimated shipping quote to people using a
    country/zip code field entry. I am not sure how to continue. I see that
    the rate_hash method passes in the order object and the calculators use the
    shipping_address attribute on the order for the address. That said, is
    there a way I can just pass in the country and zip code to get back the
    rates hash?

    I guess I can have the user enter a whole address, but the point is to
    provide a quick method for calculating a shipping quote.

    Regards,

    Nate
  • Francesco Carrella at Jan 19, 2014 at 4:01 pm
    Hello! Some news?
    On Monday, September 16, 2013 5:24:13 PM UTC+2, Nate Lowrie wrote:

    Give me a few weeks to pull it out into an extension. I am in the middle
    of upgrading spree from 1.2 to 2.1 at the moment.

    Regards,

    Nate
    On Saturday, September 7, 2013 6:33:21 PM UTC-4, Francesco Carrella wrote:

    Hi Nate, I'm very interested about that.
    Do you like to share this code? Can we help you to improve & maintain it?

    Tnx,
    Francesco
    On Saturday, December 15, 2012 7:12:09 PM UTC+1, Nate Lowrie wrote:

    I want to be able to provide estimated shipping quote to people using a
    country/zip code field entry. I am not sure how to continue. I see that
    the rate_hash method passes in the order object and the calculators use the
    shipping_address attribute on the order for the address. That said, is
    there a way I can just pass in the country and zip code to get back the
    rates hash?

    I guess I can have the user enter a whole address, but the point is to
    provide a quick method for calculating a shipping quote.

    Regards,

    Nate
    --
    Don't miss SpreeConf on Feb 26-27
    http://spreeconf.com
  • Nate Lowrie at Jan 20, 2014 at 1:34 pm
    Sorry about that. Got tied up with other things. I will do a blog post
    about it shortly.

    Regards,

    Nate
    On Sunday, January 19, 2014 11:01:48 AM UTC-5, Francesco Carrella wrote:

    Hello! Some news?
    On Monday, September 16, 2013 5:24:13 PM UTC+2, Nate Lowrie wrote:

    Give me a few weeks to pull it out into an extension. I am in the middle
    of upgrading spree from 1.2 to 2.1 at the moment.

    Regards,

    Nate
    On Saturday, September 7, 2013 6:33:21 PM UTC-4, Francesco Carrella wrote:

    Hi Nate, I'm very interested about that.
    Do you like to share this code? Can we help you to improve & maintain it?

    Tnx,
    Francesco
    On Saturday, December 15, 2012 7:12:09 PM UTC+1, Nate Lowrie wrote:

    I want to be able to provide estimated shipping quote to people using a
    country/zip code field entry. I am not sure how to continue. I see that
    the rate_hash method passes in the order object and the calculators use the
    shipping_address attribute on the order for the address. That said, is
    there a way I can just pass in the country and zip code to get back the
    rates hash?

    I guess I can have the user enter a whole address, but the point is to
    provide a quick method for calculating a shipping quote.

    Regards,

    Nate
    --
    Don't miss SpreeConf on Feb 26-27
    http://spreeconf.com
  • Mohammed Mahdi at Mar 17, 2015 at 6:44 pm
    Hi Nate,

    Do you have an update on making the extension or making a blog post
    regarding the estimated shipping prior to checkout? We are really
    interested in taking a look at the code.

    Thanks!
    Mohammed
    On Monday, January 20, 2014 at 8:34:19 AM UTC-5, Nate Lowrie wrote:

    Sorry about that. Got tied up with other things. I will do a blog post
    about it shortly.

    Regards,

    Nate
    On Sunday, January 19, 2014 11:01:48 AM UTC-5, Francesco Carrella wrote:

    Hello! Some news?
    On Monday, September 16, 2013 5:24:13 PM UTC+2, Nate Lowrie wrote:

    Give me a few weeks to pull it out into an extension. I am in the middle
    of upgrading spree from 1.2 to 2.1 at the moment.

    Regards,

    Nate

    On Saturday, September 7, 2013 6:33:21 PM UTC-4, Francesco Carrella
    wrote:
    Hi Nate, I'm very interested about that.
    Do you like to share this code? Can we help you to improve & maintain
    it?

    Tnx,
    Francesco
    On Saturday, December 15, 2012 7:12:09 PM UTC+1, Nate Lowrie wrote:

    I want to be able to provide estimated shipping quote to people using
    a country/zip code field entry. I am not sure how to continue. I see that
    the rate_hash method passes in the order object and the calculators use the
    shipping_address attribute on the order for the address. That said, is
    there a way I can just pass in the country and zip code to get back the
    rates hash?

    I guess I can have the user enter a whole address, but the point is to
    provide a quick method for calculating a shipping quote.

    Regards,

    Nate

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupspree-user @
categoriesrubyonrails
postedDec 15, '12 at 6:12p
activeMar 17, '15 at 6:44p
posts8
users4
websitespreecommerce.com
irc#RubyOnRails

People

Translate

site design / logo © 2023 Grokbase