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

mrfelton’s picture

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.

neochief’s picture

StatusFileSize
new769 bytes

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

mrfelton’s picture

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.

neochief’s picture

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.

neochief’s picture

StatusFileSize
new32.86 KB
neochief’s picture

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

neochief’s picture

StatusFileSize
new32.86 KB

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

mrfelton’s picture

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.

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?!

mrfelton’s picture

Status: Needs review » Needs work
StatusFileSize
new13.16 KB
neochief’s picture

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.

mrfelton’s picture

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?!

neochief’s picture

>> How do you fancy backporting this?!

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

mrfelton’s picture

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...!

neochief’s picture

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 ;)

Status: Fixed » Closed (fixed)

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

ñull’s picture

Component: Code » Documentation
Issue summary: View changes
Status: Closed (fixed) » Needs work

From the module home page there is a link to this issue from the 7.x-dev section. I see here a 6.x version number. Either the version number is wrong or the link on the frontpage should be removed or changed.

raulmuroc’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev

Not working anymore on D6 improvements.

@see: Port to D7

A need -dev has been committed today and this option works. So closing as fixed, feel free to re-open if doesn't work for you.

raulmuroc’s picture

Status: Needs work » Closed (fixed)