new Spree-powered store online, a few questions

211 views
Skip to first unread message

Tomek "Tomash" Stachewicz

unread,
May 28, 2011, 11:12:54 AM5/28/11
to spree...@googlegroups.com
Hello!

First things first: I've finally migrated bitspudlo.com from my-first-rails-project to a Spree-based engine.
68 LOC* powering a fully-functional store. I love you, Spree team, contributors and extension authors :) 

In the spirit of open-source, the engine is open-sourced as well:

Stuff other than vanilla Spree:
* globalize3 & globalize_spree (my own Spree extension) for multilingual db content (product names and descriptions, taxon names)
* pronix/spree-multi-currency, awesome extension by Dmitri Vasilyev covering everything related to multi-currency stuff (I've contributed english readme to this extension)
* spree-paypal-website-standard (my own Spree extension) for payment using Paypal Website Payments Standard

Everything's been running smoothly for almost a week now, 4 days ago we did a full switch with migrating all the product data and zero-ing stock levels on the old store (up at old.bitspudlo.com until we complete all orders placed there).

I wanted to send big THANK YOU for everyone in the Spree community -- core team, contributors, extension authors and the whole community.

I've first encountered Spree at autumn'2010, when doing topastic.com for a client and fell in love with the engine. These were the times of Spree 0.30 (actually pre-), not everything was smooth (so we needed to fill a few holes within the application code) and basically the codebase wasn't very mature -- but I already loved the idea, the codebase (test culture, loose coupling, rails 3) and solutions (taxons, great admin panel). It is then when I started working on spree-paypal-website-standard and when I thought of moving bitspudlo.com to Spree, but our business requirements were simply not met by then-current state of Spree extensions (multi-currency, multi-language). But I've quickly set-up another Spree-powered store for a friend escaping from hell of OSCommerce -- store.pulp-city.com -- and have been reassured in my love for Spree. I've started working on globalize-spree, to bridge Spree with Globalize3, and when Dmitri created spree-multi-currency I knew it's just a matter of writing some migration scripts and getting everything to work together. And here we are, with bitspudlo.com running on edge Spree!

This is probably going to become a blog post :) 

Now, down to two questions I have before I can consider the engine 100% satisfying. Due to nature of our business (buying boxes with miniatures, splitting them and selling individual items) we must have a very strict stock levels policy. So no backorders, selling only stuff we have on hand.

1. How do I clear incomplete orders/carts (i.e. abandoned carts) AND free the items added there back into our stock levels?

2. How do I hide completely done orders (paid & shipped) from "completed" orders filter we use to see what needs shipping?

Cheers,
Tomasz Stachewicz

* (20 LOC controllers code for redirecting legacy URLs, 8 LOC of helpers, 40 LOC of customization)

Brian Quinn

unread,
May 28, 2011, 12:28:40 PM5/28/11
to spree...@googlegroups.com
Hey Tomash,
Congratulations on the new store it looks great, and what an amazing achievement with just 68 lines of code! Reducing the amount of code and the complexity of deploying a Spree store is something I've personally been focused on for a quiet a while, but you're really ahead of the curve.

Thank you for your contributions to the Spree community, and I'm looking forward to test driving your globalize_spree extension soon.

On your questions:

1) Incomplete orders/carts shouldn't be affecting your stock on_hand values as the inventory units aren't created (and stock levels decreased) until the order is actually completed. If you're seeing otherwise it's definitely a bug.

2) The orders list is sorted by date by default, so the completed orders should just drift down/off the first page over time. You could however add a customization to the Admin::OrdersController#index action to filter exactly as you want it by default?

Thanks again!

Brian Quinn

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
-------------------------------------------

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree...@googlegroups.com.
To unsubscribe from this group, send email to spree-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

Tomek "Tomash" Stachewicz

unread,
May 28, 2011, 12:50:02 PM5/28/11
to spree...@googlegroups.com

1) Incomplete orders/carts shouldn't be affecting your stock on_hand values as the inventory units aren't created (and stock levels decreased) until the order is actually completed. If you're seeing otherwise it's definitely a bug.

Awesome, thanks. It's even better than I thought, then :)

How can I clean abandoned carts to not clutter the order list? Is there some rake task for that (delete abandoned older than a day, for example), or should I write one on my own?
 

2) The orders list is sorted by date by default, so the completed orders should just drift down/off the first page over time. You could however add a customization to the Admin::OrdersController#index action to filter exactly as you want it by default?

Thanks!

Brian Quinn

unread,
May 28, 2011, 1:35:00 PM5/28/11
to spree...@googlegroups.com
How can I clean abandoned carts to not clutter the order list? Is there some rake task for that (delete abandoned older than a day, for example), or should I write one on my own?
There isn't one in core, but a cron job or recurring delayed_job to clear them out would be pretty simple to write. That would be a worthwhile addition to core if you'd like to submit a patch? Best to just keep it as module then people can execute it anyway they'd like.

Tomek "Tomash" Stachewicz

unread,
Jun 5, 2011, 9:28:51 AM6/5/11
to spree...@googlegroups.com
Bumping with one question: due to nature of our business (again) it's very important we don't allow selling more stuff that we have on hand.

I think there's a bug in Spree regarding that: even with backorders disabled and inventory tracking enabled, it's completely possible to add to cart more items than we have on hand. Both within the "add to cart" form on product page and using "update" on cart details page.
I've even plugged here with the issue:
Can't find the lighthouse old issue describing that, I'm sure it's been discussed before.

I think this (setting line_item#quantity maximally to the current number on_hand) should be handled in spree.order.contents_changed event, as it's used both in orders#update (cart editing) and orders#populate (adding item to cart). 
What do you think? I could even patch that, if someone can give me directions on how exactly do events work (i'm reading about ActiveSupport::Notifications at the moment) and where/how can I plug into spree.order.contents_changed with some extra code.

Tomash


Tomek "Tomash" Stachewicz

unread,
Jun 5, 2011, 9:30:32 AM6/5/11
to spree...@googlegroups.com
forgot to paste the link of issue I've plugged into

Tomek "Tomash" Stachewicz

unread,
Jun 5, 2011, 12:15:57 PM6/5/11
to spree...@googlegroups.com
I think I've solved my problem. Check the issue comments:


If I write some test coverage for it and enclose within spree configuration options (allow_backorders false), what are the chances of getting this into spree core?

T.

Tomek "Tomash" Stachewicz

unread,
Jun 6, 2011, 7:39:19 AM6/6/11
to spree...@googlegroups.com
In terms of removing abandoned carts, is this code good enough?

Order.where(:state => "cart").where("created_at < ?", (Time.now-1.days)).each{|o| o.destroy}

(quick hack pasted from console)

T.

Sean Schofield

unread,
Jun 6, 2011, 10:14:27 AM6/6/11
to spree...@googlegroups.com
That would probably work but I would be more lenient with the
timeframe. I suggest two weeks or something like that. People often
come back a day or two later to their browser and finish an order.

Sean

> --
> 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/-/dGM3b1V4SnBwVDBK.

Tomek "Tomash" Stachewicz

unread,
Jun 6, 2011, 10:36:06 AM6/6/11
to spree...@googlegroups.com
Good point, thanks!
Reply all
Reply to author
Forward
0 new messages