Posted by orianasarac on May 25, 2009 at 10:59pm
| Project: | Ubercart Restrict Qty |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
I cannot add more than one item to cart by clicking 'Add to cart' button on a product itself, but 'Update Cart' can change quantity without an error. This module is supposed to ensure there is one and only one item in cart. Did I miss anything? Thanks.
Comments
#1
Hmm... if a product has a restrict qty. feature, the cart form should change the Qty. textfield to simply print out the number. Are you using the latest version of Ubercart?
#2
Yes, I am using latest version of Ubercart.
#3
I'm having the same issue. Drupal 6.13 and Ubercart 6.x-2.0-rc3
In fact, after installing the latest dev version of uc_restrict_qty it's not doing anything at all. I can add the feature to my product (product kit) but nothing change when I go to cart. Multiple quantities can still be added.
#4
I'm seeing this issue as well on product kits. It is working fine on standard products. I haven't had a chance to investigate further yet.
#5
subscribing
#6
I can confirm that this only happens with product kits.
#7
Hi,
I don't use products kit and I can update quantity to a product on cart.
Uc_restrict_qty don't seems to work for me :(
My ubercart version : 6.x-2.2
uc_restrict_qty version : 6.x-1.1
I don't understand why
If I go ton the cart page, I can update quantity :(
Thanks by advance ;)
Best Regards,
Pierre-Yves
#8
Hi,
Sorry for the last post, I'm just stupid...
Best Regards,
Pierre-Yves
#9
I have been investigating why Product Kits are not properly applying the restrict qty.
Line 286 function uc_restrict_qty_count($form_values)
It appears that the product kit nid is not being passed, rather the first product nid is used instead. Perhaps I am not familar with how the Product Kit module works. But in order to validate that a limit should be applied (which if I did have the proper nid for the product kit this function would not do) the nid of the product kit should be provided not the first node in the bundle.
I am working on this for a client feature so I will post notes/patches if I get anywhere.
in uc_product_kit
uc_product_kit.module
- line 1161
function uc_product_kit_update_cart_item($nid, $data=array(), $qty, $cid=NULL) {}
The function detects if the item is a product or a product kit. Perhaps the same check should be accomplished in the uc_restrict_qty module?
I will try to identify the correct hook to apply the restrict_qty to the data array for the item.
#10
#9 : How is the investigation going ? I'm also having troubles with product kits and qty restriction...
Ubercart doesn't like when an 'immutable' product kit has a restricted item in it and the restriction applies.
I'm not really sure it's the exact same issue, but your investigation could help me a lot right now.
#11
subscribe
#12
Maybe it is just me, but I do not see the product kit's nid in the data at all. Instead I see all the component product nids in there. The functions uc_restrict_qty_add_to_cart_data and uc_restrict_qty_count seem to run for each component product. Need to dig further to get the product kit nid...
#13
I hope no one minds if I change the title of this issue to something more descriptive.
#14
Here's some code for this. So far it seems to work.
It does two things:
1) It restricts quantity on product kits if the feature is added to the product kit.
2) It restricts quantity on product kits if the feature is added to a component product of the kit, even if the feature is not added to the kit itself.
The only hiccup might be that it does not check for kit mutability (if the kit can be changed by customer or not). I'm not sure if that will have any negative effects.
#15
Here's a newer patch version with a small change. It checks if $form['items'] exist.
#16
My patch doesn't yet prevent product from being added to the cart twice when user clicks on "Add to Cart" button twice.
#17
Subscribing. Thanks for the patch, it works OK.