Shopping Cart for my Application

Hi guys,
i want to implement a shopping cart i my application for ordering
books (this will
work only in localhost not in production). Is there any tutorial
explaining how can this be done?? Or any good plugin with
instructions???

I dont want to use shopping cart from the book Agile Web D.
with rails because its too complicated. Anything else that you can
suggest me??

Thanx in advance
Kostas L.

Kostas L. wrote:

Hi guys,
i want to implement a shopping cart i my application for ordering
books (this will
work only in localhost not in production). Is there any tutorial
explaining how can this be done?? Or any good plugin with
instructions???

I dont want to use shopping cart from the book Agile Web D.
with rails because its too complicated. Anything else that you can
suggest me??

Thanx in advance
Kostas L.

That one is actually a fairly easy shopping cart to implement. There
are a lot of things you need to consider before reaching out for this.

You have to consider what payment gateway you will be using, whether or
not it will be encrypted or not, how you will handle cart sessions when
they leave your site and return.

It’s not an easy thing to do. I started with the shopping cart from
agile rails, changed and manipulated it for my own ideas, and a good IPN
gateway screencast are the episodes 141 - 143 from Ryan B. at
railscasts.com.

I would like to say that if you feel the agile rails shopping cart is
complicated, you may indeed be in for some issues trying to implement
any shopping cart at all. And, there are very few shopping cart
tutorials out there but a lot of payment gateway tutorials.

I’m not aware of any plugin for shopping carts.

I’d like to expand a little bit on my previous response because I know
how difficult this might be going forward for you. I’d like to help you
out as much as I can.

So, inevitably you are going to have to think about how everything will
function. Personally, when I envisioned my cart, I read and watched all
the screencasts related to the subject and then diagramed the following:

A Stores Controller
– this would work as the controller for the shopping cart
– houses an Add to Cart method
– houses a checkout method
A Products Controller and Model
– would house the products or services we sell
A Order Model
– This would house the orders
A Payment Notifications Controller
– This would process incoming IPN notifications

I’m not sure how much you’ve worked out thus far, but you will need to
read and watch the screencasts, gain an idea about what you want to do
and implement, piece it out first, and then start slowly.

I would work out your products first, then your stores controller. You
will have the ability to add and manipulate the products in your cart
with those two pieces.

Once you master that and how you want to handle the sessions for the
cart, you can then implement an orders model and a payment notifications
system to handle the gateway transactions.

The idea here is to take baby steps into the process until it becomes
clearer to you.

Hi Alpha B.,
i havent found either any kind of shopping cart plugin.
Now, you said that you have used the shopping cart from agile rails.
My main problem with that cart, is that it works only inside the store
controller. I want to change this. For example, i want to be able to
add products, when i show each product details. Where should i move
all this functionality that is inside the store_controller??? I
thought of the application_controller but i dont think is a good idea.
What do you think???
I havent found any sollution for this thats because i am searching for
a plugin.

Cheers kostas

On Aug 22, 7:10 pm, Alpha B. [email protected]

@Alpha B.: Your second message really helped me! I will watch the
railscasts you told me hope they help!!!

@heimbull: Thanx for the sollution this helped!!! It was actually so
simple! I just downloaded the source code of spree. I would say its
really good project. Now i’ll see the second one.

Thanx both of u guys!!!
Cheers Kostas

You can make a add to cart link anywhere on the site that points to
the store controllers add function… If you are showing products on
the front page you can just do a link_to “Add to Cart”,
add_product_store_path(@product) or something like that…

Maybe you should also have a look at these to stores that have some
good functionality

@Alpha B.: Your second message really helped me! I will watch the
railscasts you told me hope they help!!!

@heimdull: Thanx for the sollution this helped!!! It was actually so
simple! I just downloaded the source code of spree. I would say its
really good project. Now i’ll see the second one.

Thanx both of u guys!!!
Cheers Kostas

Kostas L. wrote:

And something else that came to my mind about the Agile cart. How can
i make the cart (written in ajax) available to the other controllers
too? eg to be shown when i render each other controller’s action?
Cause when i go to another controller the cart is gone!!!
Any sollution for that???

Your cart is being saved through a cart session applicable to the
current user. No matter where the user goes in your site, until you nil
out the cart session, the cart is still active and available.

If you want to show a cart view on each page then you have to create a
cart view for each page or apply a sidebar layout to the pages you want
the cart to be viewable on.

As an example of clearing out a cart session,

session[:cart] = nil

When that is applied, the cart session will be cleared. I apply this
during the checkout process.

And something else that came to my mind about the Agile cart. How can
i make the cart (written in ajax) available to the other controllers
too? eg to be shown when i render each other controller’s action?
Cause when i go to another controller the cart is gone!!!
Any sollution for that???