0.01
No commit activity in last 3 years
No release in over 3 years
You can use active_cart as the basis of a shopping cart system. It's not a shopping cart application - it's a shopping cart framework.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

ActiveCart¶ ↑

ActiveCart is a Shopping Cart framework, it’s not a fullyfledged cart, so you will need to do some stuff to get it to work.

The cart system has a storage engine, which means you aren’t bound to a particular database. So far, there is a an ActiveModel storage engine, called acts_as_cart, but the gem isn’t just for Rails, by writing other engines, you could target any datastore.

Installation¶ ↑

gem install active_cart

Usage¶ ↑

require 'rubygems'
require 'active_cart'

@cart = ActiveCart::Cart.setup(MyStorageEngine.new) do |t|
  t << ShippingOrderTotal.new
  t << GstOrderTotal.new
end

In this example the ShippingOrderTotal and GstOrderTotal have been created by the developer and follow the OrderTotal interface.

For information about the API and interfase, checkout the documentation: rdoc.info/projects/madpilot/active_cart

Sample using the contrived Memory demo classes in irb¶ ↑

>> require 'rubygems'
=> true
>> require 'active_cart'
=> true
>> include ActiveCart
=> Object
>> c = Cart.new(ActiveCart::StorageEngines::Memory.new)
=> #<ActiveCart::Cart:0xb7a697a0 @order_total_calculators=[], @storage_engine=[]>
>> c.add_to_cart(ActiveCart::Items::MemoryItem.new(1, "Test Item", 10))
=> nil
>> c.add_to_cart(ActiveCart::Items::MemoryItem.new(1, "Test Item", 10))
=> nil
>> c[0]
=> #<ActiveCart::Items::MemoryItem:0xb7a63170 @price=10, @name="Test Item", @quantity=2, @id=1>
>> c.total
=> 20

Copyright © 2010 Myles Eftos www.madpilot.com.au/contact, released under the MIT license