4 replies [Last post]
eh1160's picture
Offline
Joined: 07/16/2012
Juice: 9
Was this information Helpful?

ALL the products in my site are going to be unique, one-of-a-kind creations. I therefore need to limit users to selecting only 1 of each product.

I've been reading through the forums and various Google searches, but the advice isn't hitting the mark. Even the Ubercart documentation says that there should be a Default quantity to add to cart option on the product page. I don't see that option on my product pages!! See the attached screenprint to see for yourself.

Did I forget to add a module or something? Any ideas?

PreviewAttachmentSize
product-page.PNGproduct-page.PNG44.94 KB
end user's picture
Offline
Joined: 01/11/2008
Juice: 1682
Re: Limiting Products to a Quantity of 1

Maybe you could use rules to unpublish the product node after a purchase?

eh1160's picture
Offline
Joined: 07/16/2012
Juice: 9
Re: Re: Limiting Products to a Quantity of 1

I liked your idea of using Rules, but I tried something a little different. I tried to update a Product's Qty right a user tried to edit it in the cart. I'm afraid of someone hitting the "add to cart" button twice, accidentally ordering 2 of the same product.

The Rule kicks back an error that says "The selected data property doesn't support writing." when I try to set "uc-cart-item:qty".

Any ideas?

DanZ's picture
Offline
Joined: 08/07/2011
Juice: 1623
Re: Limiting Products to a Quantity of 1

The proper way to do it is to write a module that uses hook_form_alter() to disable the quantity field in the form whenever the product is of some type that should only be ordered once.

You'd have to cover every place where this can happen, and have a special case for the "add to cart" button, which automatically adds one and doesn't have such a field.

DanZ's picture
Offline
Joined: 08/07/2011
Juice: 1623
Re: Re: Limiting Products to a Quantity of 1

Further meditation made me realize that the inventory tracking system might already do what you need. Just put in an inventory of "1" of everything.

I haven't used inventory tracking, so I'm not sure, but it seems like a good place to check.