Crinsane / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
3.67k stars 1.73k forks source link

Taxes #69

Closed martinlindhe closed 8 years ago

martinlindhe commented 9 years ago

First, thanks for a great lib!

It would be useful to have a tax field that could hold the tax rate %, and some helpers to show price with or without tax, also total price with/without tax.

I'm in need of this feature and are thinking if i could extend this cart, or if it would be possible to improve on the lib to add this functionality. What do you think?

Crinsane commented 9 years ago

I've been thinking about this. I'm thinking about adding 'tax' and 'weight' (for shipping) in version 2, but still not sure how to implement it. It just feels wrong to me to keep adding extra parameters.

I'll keep this open for now.

martinlindhe commented 9 years ago

While I solved my need for now, I'm still interested in this feature. And weight would also be very nice to have.

Some other laravel-related lib have this notion of extending models with extra properties, like EloquentSluggable does.

In the Shoppingcart case, one would normally have a Model that one wants to stick in the shopping cart, and by letting the model use a Shoppingcart trait and declare some mapping between columns and intention, it could be made quite clear.

Perhaps something like (just making stuff up)

class Product extends Model {

    protected $cartMapping = [
        'price'  => 'price_excluding_taxes',
        'vat'     => 'tax_percentage',
        'wgt'     => 'weight',
        'count'  => 'stock',
    ];

   ...
Crinsane commented 9 years ago

I've been thinking about using traits for these kinds of things. I hope to find some time in the next few days to work on some ideas I have.

Thanks for the input!

martinlindhe commented 9 years ago

sounds good :-) thanks

kferran commented 9 years ago

Any ideas on this?

nexana commented 9 years ago

I am looking for something similar. I am currently extending the Cart class with my own and added new attributes (like paymentmethod, shippingmethod, appliedTax,...)

However, the updateCart method doens't seem to store these extra attributes on the session.

Any help would be greatly appreciated!

gjportegies commented 9 years ago

What about implementing discount? Would be very nice to have the option to add only a single discount percentage.

danboh commented 9 years ago

@gjportegies Wondering if you were able to implement discounts?

reppair commented 9 years ago

That would be just awesome! I'm a junior developer working on my first project with laravel and just got @Crinsane 's cart integrated. THANKS for the open source code. I am building e-commerce website / app for a friend who wants discounts functionality integrated. As you might guess I got stuck and now I am researching all possibilities. All suggestions, links to useful resources to read / watch and ideas are deeply appreciated. (:

lukepolo commented 9 years ago

Since this has been an open issue for quite a while, if anyone needs this support use https://github.com/lukepolo/laracart

Crinsane commented 8 years ago

Tax is integrated in the new version which is currently in the master branch.