I've been trying to generate order files that will be transmitted to a
fulfillment organization. I have a few questions after spending a day on
this.

1. Spree::Order.find(:complete) do |order|

The test orders I am creating are using the Bogus gateway. The results of
the find(:complete) return orders that are still in cart, orders with zero
items, and the one test order that I have run through the Bogus payment
gateway. order.outstanding_balance still shows a balance due
and order.paid? indicates that the order payment has not completed.

a. Is there a better filter I can use to return orders that have
completed payment and are waiting for fulfillment?

2. shipto_name1 = format("%s %s", order.billing_firstname,
order.billing_lastname)
shipto_name2 = 'Customer Second Name'

I'm looking for a ship_to name and either a second ship_to name or company.
Are we persisting these somewhere? I cannot find them.

3. order.ship_address.state

Returns the Name of the State and not the two letter code. I would have
thought that state_name contained the long name, but it is nil. Any ideas
where these may be?

thanks for your help

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spree-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Ryan Bigg at Feb 28, 2013 at 9:23 pm
    Hi Randy,

    You've not exceeded your question limit. There isn't one :) There is a
    limit to the amount of time we can spend answering questions from all
    people, of course. That's why we've not been able to reply sooner.

    Replies are inline.

    On Sat, Feb 23, 2013 at 2:32 PM, Randy Terbush wrote:

    I've been trying to generate order files that will be transmitted to a
    fulfillment organization. I have a few questions after spending a day on
    this.

    1. Spree::Order.find(:complete) do |order|
    First up, this should be:

    Spree::Order.complete, which will return all the completed orders. Then you
    can loop through them using .all, or if you've got a ton of them,
    find_each. Look at the API documentation for find_each if you don't
    understand what it does, it's pretty comprehensive.

    The test orders I am creating are using the Bogus gateway. The results of
    the find(:complete) return orders that are still in cart, orders with zero
    items, and the one test order that I have run through the Bogus payment
    gateway. order.outstanding_balance still shows a balance due
    and order.paid? indicates that the order payment has not completed.
    By fixing up the query, this should return the correct orders.
    a. Is there a better filter I can use to return orders that have
    completed payment and are waiting for fulfillment?
    You would create a query for the payment_state field then:

    Spree::Order.where(:payment_state => "paid"), which will return all orders
    which have been paid. You can chain this with complete too:

    Spree::Order.complete.where(:payment_state => "paid") to find all completed
    orders which have been paid.
    2. shipto_name1 = format("%s %s", order.billing_firstname,
    order.billing_lastname)
    shipto_name2 = 'Customer Second Name'

    I'm looking for a ship_to name and either a second ship_to name or
    company. Are we persisting these somewhere? I cannot find them.
    I am not sure I understand this question completely... I'm going to go
    ahead and assume you're asking about the company field on the checkout. You
    can enable this by setting the Spree::Config[:company] preference to be
    true. inside the Spree.config block inside config/initializers/spree.rb,
    you just need this line:

    c.company = true

    That'll make the company name field available on the checkout.
    3. order.ship_address.state

    Returns the Name of the State and not the two letter code. I would have
    thought that state_name contained the long name, but it is nil. Any ideas
    where these may be?
    If you want to return the two letter code, you can call
    order.ship_address.state.abbr. Whatever the abbr field is set to for that
    state is what will be returned. For the sample data, I think that's the
    2-letter sample code.

    I hope that helps you Randy. Good luck!

    --
    You received this message because you are subscribed to the Google Groups "Spree" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to spree-user+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupspree-user @
categoriesrubyonrails
postedFeb 23, '13 at 7:33p
activeFeb 28, '13 at 9:23p
posts2
users2
websitespreecommerce.com
irc#RubyOnRails

2 users in discussion

Randy Terbush: 1 post Ryan Bigg: 1 post

People

Translate

site design / logo © 2022 Grokbase