Project:Ubercart Restrict Qty
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Guess this is a good idea to have configurable qty. Not only just restricted to 1.

In my country there is rule on product limitation on supermarket. Eg. Baby milk is limited up to 4 cans per transaction, etc.

Hope we could get this feature in the future.

Regards

Comments

#1

Status:active» needs review

This is now in CVS in the Drupal -6--2 tree. See http://drupal.org/node/275863/cvs-instructions/DRUPAL-6--2 for checkout instructions ( a -dev will be available in the next 12 hours). It has had very little testing, but I would appreciate it if you would give it a try and report any bugs.

You should now be able to set per product quantity restrictions. You can define the quantity restriction when adding/editing the product feature.

#2

Module don't have an update function for those, who migrating from 6x-1. Here's a patch.

AttachmentSize
uc_restrict_qty_install.patch 769 bytes

#3

Version:6.x-1.0» 6.x-2.x-dev

CVS is updated now to include an implementation of hook_update_N... Thanks neochief. I actually used uc_restrict_qty_update_6200() since this is only appropriate for users of the 6.x-2.x tree and not any earlier versions.

#4

Okay, glad to hear that, because I've already implemented the lifetime limit feature, are in the middle of completion of SimpleTest for the module and will upload patch very soon.

#5

AttachmentSize
uc_restrict_qty.patch 32.86 KB

#6

I hate drupal.org! It ate my last comment's description. Okay, repeat.

Patch includes:
- #416424: Add Life Time QTY Restriction Feature
- 100% SimpleTests (oh, yes, baby!)
- Some fixed crap found by tests
- Fixed outdated description
- Added translation template

#7

Sorry, last patch includes wrong translation template. Here's a correct one.

AttachmentSize
uc_restrict_qty.patch 32.86 KB

#8

Status:needs review» needs work

Nice work... A couple of things though.

Firstly, I didn't feel it was right to set uc_restrict_qty_default_lifetime to TRUE by default, as I consider the lifetime restriction a feature that less that 50% of people wishing to restrict quantities would be using - So I changed to FALSE. If you think it really should be set to TRUE by default, please let me know why.

Secondly, I love the test suite, but, 34 of the tests fail!

I made one other small change - in one of the error strings. I simply added links to the checkout and cart pages to make the error message a lot more friendly to end users.

<?php
format_plural
($limit, "Sorry, you may only have a total of 1 item in your cart. You must <a href='@checkout'>checkout</a> or remove the item in <a href='@cart'>your cart</a> before adding a different item.",
       
"Sorry, you may only have a total of @count items in your cart. You must <a href='@checkout'>checkout</a> or remove items from <a href='@cart'>your cart</a> before adding others.", array('@cart' => url('cart'), '@checkout' => url('cart/checkout')))
?>

I updated the test to work with the new string, but I don't know how or if this will affect the translation template?

And lastly, I ran it through coder which picked up on a couple of minor formatting issues - which I fixed.

Could you take my patch and make the failing test cases pass?!

#9

AttachmentSize
uc_restrict_qty_1.patch 13.16 KB

#10

I don't know why you're getting errors, here's my test results:
259 passes, 0 fails, and 0 exceptions

Are you sure that you installed SimpleTest correctly? I remember I had same situation because I forgot to add some specific code to my settings.php (which described in INSTALL.txt of SimpleTest).

As for defaults for uc_restrict_qty_default_lifetime, I don't mind to change that, it's not critical at all.

So, please, check your simpletest installation and report if the problem is gone. If it will go away, I'll generate a new template and we will commit everything.

#11

Status:needs work» fixed

Seems the problem was because my Ubercart was a little out of date. All tests now pass, I have updated the translation template and commited to CVS.

How do you fancy backporting this?!

#12

>> How do you fancy backporting this?!

Sorry, I'm not sure that I understand you. Could you please rephrase that? :)

#13

Well, this module is available for both Drupal 5 and 6. But, this new feature is available to Drupal 6 users, and not D5. Ideally, all new features should be backported to work with earlier versions of the module too, in order to keep the functionality of the 2 versions in sync. I have no experience with developing for Ubercart 5.x and I don't have the timE or will this on... So, if you fancy it...!

#14

Ah, I see, thanks. As for my own modules, I have stoped moving new features in D5 branches in January and left only bugfixes. For now, it seems as a pretty good strategy. Those who need such features for D5 at least should tell about it. If no one requesting it, I think such porting is a wasting of time. So, let's forget about it until someone really want it (or/and will be willing to pay for it ;)

#15

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here