Closed (won't fix)
Project:
e-Commerce
Version:
master
Component:
product
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Mar 2006 at 01:35 UTC
Updated:
22 Sep 2006 at 05:18 UTC
Hi,
I am posting again because i feel that i wasn't clear enough on my last post.
I would like a little help in getting the "add to cart" link to add more than one of an item when it is clicked.
A little push in the right direction would be greatly appreciated in this matter.
I am using version 4.6.
Thanks in advance.
Comments
Comment #1
wpd commentedAs far as I know, there is not a configuration setting to allow this. The cart software can accept a different quantity.
You need to change the add to cart link from:
http://www.example.com/cart/add/16
To:
http://www.example.com/cart/add/16/$qty
16 is the node/product id.
I think this is a needed feature, but it is more likely to get added to 4.7/cvs first... (Unless you do it yourself).
Scott
Comment #2
Erofee commentedThanks Scott, that got me 50% of the way there. If i create a link like so: /product/add/13/5 it will add 5 of product 13. The next hurdle i need to get over is placing a text box next to the add link that can contain a qty to add. Does anyone have any suggestions?
Comment #3
wpd commentedI would get rid of the link and add a text box and a submit button.
Then modify the cart code to look for the GET or POST variable.
Maybe try looking at the update cart code for an example.
Other:
-Actually modifing the text link is basically impossibly without using some javascript.
-I have not looked into this, but I assume that the text links will cause problems when bots spider your site. You will end up with a many
shopping carts filled with products.
I think this would be easy to do in 4.7. I am not as familiar with the 4.6 code. BTW, the feature is more likely to get into the 4.7 codebase than 4.6. I can help test with 4.7 version.
Comment #4
dgtlmoon commentedI dont know how drupal feels about this, i mean it works but it works by running some javascript set resets the form action, have a look..
this is product.module from current CVS (rc1)
Comment #5
Erofee commentedThanks for the code snippet. This is absolutely brilliant and exactly what i was looking for. Javascript is not my forte and this has helped a lot. There is just one small problem which i think can be fixed relatively easily but i am not sure how to do it. When you have multiple products on one page, you get an error when trying to add one of them to the cart. I think that this issue can be resolved by uniquely naming each input type, ie call the input type [nid]quantity. Do you know how i can do this?
Many thanks,
Erofee.
Comment #6
neclimdulthat's pretty much a hack around the cart adding page. one line there to check for a posted quantity would be easier and less messy.
Comment #7
Erofee commentedneclimdul, are you referring to my reply?
Comment #8
neclimdulNot really, sorry. I was refering to the javascript. It doesn't work on browsers with javascript turned off. So it isn't a very permanent solution.
Comment #9
simePushing to HEAD. Not sure it's on the right track, but there is history there.
Comment #10
neclimdulI'm going to say this is really a wont fix. You can do this on a per product level by disabling the add to cart link though the product api and then having a form on your item page. the cart add page should even accept posted quantity values so something like
should work.