django-easycart icon indicating copy to clipboard operation
django-easycart copied to clipboard

include additional optional parameters in Add post request

Open mozilla-rowvigor opened this issue 7 years ago • 8 comments

I like the simplicity of django-easycart, but there is one feature I am not sure how to accomplish.

Using the jquery POST add request, I would like to push additional optional options, in addition to the quantity param such as size or color, how would I accomplish that?

mozilla-rowvigor avatar Oct 01 '17 22:10 mozilla-rowvigor

Take a look at: http://django-easycart.readthedocs.io/en/latest/cookbook.html#associating-arbitrary-data-with-cart-items

nevimov avatar Oct 02 '17 14:10 nevimov

Yes, I can pass additional arguments on the backend using the add method, however, I can only pass the pk, and quantity arguments with the add POST request. I can't include any additional parameters. Looking at the source code on line 117 of https://github.com/nevimov/django-easycart/blob/master/easycart/views.py

I see that the quantity param is the only optional parameter I can pass after the POST AJAX request, every other additional parameter is filtered out.

mozilla-rowvigor avatar Oct 02 '17 17:10 mozilla-rowvigor

Yep, looks like you're right. I'll fix the problem within a week.

nevimov avatar Oct 03 '17 11:10 nevimov

I've added a quick fix for the problem. See branch 'allow-passing-arbitrary-data'.

However, I've realized that the project needs some serious refactoring. The thing is, I don't use the app anymore and have no time/desire to work on it further. So, I recommend to use another app. I'll put a notice on the main page later.

nevimov avatar Oct 07 '17 14:10 nevimov

Thanks,

I completely understand. Since I have a decent understanding of your code, I probably modify your code as I continue developing. I searched for alternative shopping carts. I choose yours because it's the simplest and quickest learning curve.

mozilla-rowvigor avatar Oct 09 '17 15:10 mozilla-rowvigor

@mozilla-rowvigor can you ping me if you keep development? We are using it in soon-to-be production

n3storm avatar Oct 09 '17 16:10 n3storm

Sure.

mozilla-rowvigor avatar Oct 09 '17 16:10 mozilla-rowvigor

@mozilla-rowvigor please also ping me. Thanks. :+1:

kamranhossain avatar Nov 08 '17 01:11 kamranhossain