Skip to content

A lightweight session-based shopping cart for Django projects

License

Notifications You must be signed in to change notification settings

miguelchavez/django-cart

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# django-cart

Django-cart is a small, focused shopping cart meant to be integrated into custom django e-commerce solutions. If you're looking for something more robust, take a look at Satchmo; however, note that Satchmo has a pretty steep learning curve, and, in [the original author of django-cart's] opinion, isn't very Django-like.

# Why we forked

Initially, we had just copied the code into our own SVN repo.  That was kind of silly.  Other than that, after a few months, we have 45,000 empty carts in the database.  Sure, we could write a cron script to take care of old ones, but it seems that a Django app should be taking care of its own garbage collection.  Also, please note that it was our code causing all the carts.  Don't want to blame that on the original cart authors.

# What we changed

1)  Added a few convenience functions
2)  Added cart.cart.cart_processor so we always have a reference to the cart in our templates
3)  Prettied up the admin


#My fork (Miguel Chavez)

I need to add an extra field to the Items model. To support variations saved in the cart item.

This is what I added/changed:

1)  The variations field is a CharField. It is saved as a list of "variation:attribute" splitted by a comma. 
    Example:  "1:3,2:1" Which means "Variation.pk is 1 and Attribute.pk is 3","Variation.pk is 2 and Attribute.pk is 1"
    And can be interpreted (get values from database for each attribute/variation): "Color:Red,Size:Small"
2)  cart.add() has an extra argument called "variations" at the end : add(self, product, unit_price, quantity=1, variation='')  

About

A lightweight session-based shopping cart for Django projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 100.0%