Module doesn't work as there is a typo in the declaration of the hook_uc_add_to_cart() , which is being called hook_add_to_cart() as it was in Drupal 6. Also the database query is done D6 style and fails.
I'll attach a patch

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rlustemberg’s picture

Title: Module doesn't work (Drupal6 code left over » Module doesn't work (Drupal6 code left over)
rlustemberg’s picture

FileSize
1007 bytes
rlustemberg’s picture

Status: Active » Needs review
DrCord’s picture

The patch did not work. I still get a WSOD anytime I try to add a restriction.

Northern_Girl’s picture

Hi,

I have got the same problem : when I try to add a "number restriction" (for selling roles), I end up with a WSOD.

Can the number of items in the cart be controlled with Rules? If so, how?

Thanks.

NG.

RaulMuroc’s picture

+1

pitxels’s picture

So I got this in error_log:

PHP Fatal error: Call to undefined function dpm() in ****/sites/all/modules/uc_restrict_qty/uc_restrict_qty.module on line 165

So I removed this dpm($form_state); function and i'm not getting WSOD anymore.

Not sure what is that function for....

pitxels’s picture

Anyway there are more errors, I wonder why is this 7.x version is marked as stable.

Jaypan’s picture

Anyway there are more errors, I wonder why is this 7.x version is marked as stable.

Yeah, the D7 branch is basically unusable.

webservant316’s picture

I really need this module to work. Are there any alternatives since this does not appear to work?

nonsie’s picture

Version: 7.x-1.0 » 7.x-1.x-dev

I've started a sandbox project that has most of the code cleaned up and updated from D6 - https://www.drupal.org/sandbox/nonsie/2373399
Once it is fully functional I hope that it can be merged into this project for a D7 release.

webservant316’s picture

thanks. I posted a few questions over there.

webservant316’s picture

FileSize
13.24 KB

To get this thing working I need the above patch, plus a handful of other fixes to uc_restrict_qty.module. Sorry, but I do not have the tools to make a git patch, so I have attached the whole uc_restrict_qty.module with my corrections.

Good news is I got it working.

Could someone please properly integrate these fixes into the module and update dev?

Thanks!

ñull’s picture

Status: Needs review » Needs work

#13 does not work for me. The only thing I see that works is that in cart you no longer can change the quantity of the restricted product, but it still allows to add a quantity that is over the set quantity limit.

webservant316’s picture

Small problem fixed in my patches to the uc_restrict_qty.module, reattached to this post in whole. Additionally these lines changed to...

function uc_restrict_qty_uc_cart_item_update($item) {
    // If this item has a quantity restriction on it...
    if (isset($item->data['restrict_qty']['qty']) && $item->data['restrict_qty']['qty'] > 0) {

Without the additional tweak to my earlier patch there was an error when updating the quantity of the item in the shopping cart when the restrict feature was NOT enabled. However, that now works. And with the restrict feature ENABLED on the product one cannot add quantity in the shopping cart greater than the limit.

This module patch is working fine for me, however my patches are a major hack. Could the maintainer please check out my revisions and integrate them into the module properly, please?

Install uc_restrict_qty.module.take2_.txt as uc_restrict_qty.module and report back to let me know if it works for you.

RaulMuroc’s picture

Assigned: rlustemberg » Unassigned
Status: Needs work » Needs review
FileSize
19.15 KB

Attach patch. Please test.

RaulMuroc’s picture

Applying latest patch to D7 uc_restrict_qty:

  • In admin/store/settings/products works
    • Global limit works
    • Replace contents works
  • Default max limit for product works
  • By product limitation in node/x/edit/features works

So basically every feature implemented works nicely. There are many thing to improve: documentation, UI messages, more testing, new features.... but for that please open new tickets (I will also for what I see so far).

This for me is RTBC so proceeding.

RaulMuroc’s picture

Status: Needs review » Reviewed & tested by the community
RaulMuroc’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Committed and works. (FFTR = Feel free to re-open).

webservant316’s picture

Thanks for converting my changes to a valid patch. I installed the DEV version clean and everything works great for me. Thanks again.

Jaypan’s picture

Can you please release this as a full release, considering it wasn't working at all before, and apparently the dev works now?

RaulMuroc’s picture

THANK YOU webservant316, a little section has been included for you in "Credentials" ;)

RaulMuroc’s picture

@Jaypan, done.

Jaypan’s picture

Thanks Raul!

webservant316’s picture

Glad to pitch in. This is an essential module for me!

Jaypan’s picture

Thanks to you as well Webservant