Corzinus
Corzinus is plugin which have logic of cart and checkout. That will be useful for your online-store
- Get started
- Configuration
- What you get?
- Cart
- Checkout
- Order
- Demo
Get started
- On your gemfile:
gem 'corzinus' - Run bundle install
- Run
rails g corzinus:install(configuration corzinus) - Run
rails g corzinus MODEL(Confirm run migration if you didn't do this) - Start a server
rails sand the cart will be available at /cart (if you chose default namespace: /cart)
Configuration
In config/initializers/corzinus.rb
...
# Define person class
config.person_class = 'MyUserClass'
# Define checkout steps
config.checkout_steps = [:address, :delivery, :payment, :confirm, :complete]
...Integration into the templates
= form_tag corzinus.order_items_path, method: :post do
= hidden_field_tag :productable_id, @product.id
= hidden_field_tag :productable_type, '@product.class.to_s'
= hidden_field_tag :quantity, 1
= button_tag 'Add to cart', type: :submit
What you get?
Cart
With corzinus you get all the functionality of the cart, necessary for a standard online-store
- cart page with empty or filled condition
- change the amount of chosen products
- remove products from the cart
- apply a coupon code for discount
Checkout
With corzinus you get opportunity to ordering purchase by checkout. By default checkout has of 5 steps.
-
:address– fill billing and shipping addresses -
:delivery– choose delivery method by selected shipping address in the previous step -
:payment– fill credit card requisites -
:confirm– show info about:address:delivery:paymentsteps -
:complete– show success message about finished order and sent a letter to the user's mail
[:address, :delivery, :payment] – are not required, so you can remove one/all of them
[:confirm, :complete] – are required and can not be removed.
:delivery depends on the :address
You also can add custom step
Order
Corzinus::Order is base model of Corzinus. It use in Cart and Checkout.
Order has attributes:
string :statedecimal :total_priceboolean :use_base_address
Order has relationships:
persondeliverycredit_cardcouponorder_items
Order has 5 states by gem Aasm
| State | Description |
|---|---|
:in_progress |
User don't complete order (default state) |
:processing |
User completed order and this order sent to administrator for processing |
:in_transit |
Order in transit |
:delivered |
Order delivered to the customer (finish state) |
:canceled |
Canceled by the manager (finish state) |
More info in Order