This has great potential and is much needed especially for subscription based carts. The only issue is when I try to apply to any product I get the following error message:

Fatal error: Call to undefined function dpm() in /home/ROOT/ANYSITE/sites/all/modules/uc_restrict_qty/uc_restrict_qty.module on line 164

Comments

glynster’s picture

No thoughts or solutions?

Max-III’s picture

I have the same, also on line 164.

Max-III’s picture

I have also been getting these errors: Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() when trying to delete a node. After uninstalling this module the errors went away.

Perhaps it helps and I really hope this module will get finished and working.

glynster’s picture

Agreed I see this as a life saver for sites that offer subscriptions and you do not want users being on more than 1 of the same subscription.

raulmuroc’s picture

Priority: Major » Normal
Status: Active » Needs review
StatusFileSize
new683 bytes

Attached a patch with solution.

Please, test & review it before commit.

Thank you.

glynster’s picture

Thanks for the patch. We can now apply features to a product. However we receive "The website encountered an unexpected error. Please try again later." when trying to add the product to the cart. The feature settings are limited to 1 in cart and lifetime ticked.

raulmuroc’s picture

Status: Needs review » Needs work
caskraker’s picture

Same problem as topic starter has when using the 7.x-1.0 version. Module is not usable this way.
I also get the dialogue in which you can enter the values for qty restriction twice. The second time it appears full-browser and has ignored any values i entered in the first dialogue. After hitting Apply in the second dialogue the error-message appears:

Fatal error: Call to undefined function dpm() in /home/mysite/public_html/sites/all/modules/uc_restrict_qty/uc_restrict_qty.module on line 164

Any clues?

Thanx,
Cas

caskraker’s picture

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

Correction: after applying the patch everything does work OK. I don't get a second dialogue window. After the first it just returns to the product features screen, as expected. The quantity is set to 1 in my case and that shows in the cart, the field is non-editable. No more errors.

I did NOT tick lifetime, however. If i do i get the same error glynster at #6 had.

Hope this may help to solve the problem.

Cheers,
Cas

glynster’s picture

Thanks for the clarification there, hope it helps as well.

teadrink3r’s picture

I too am getting the "The website encountered an unexpected error. Please try again later." error when trying to add a product to my cart when the product feature settings are limited to 1 in cart and lifetime ticked.

teadrink3r’s picture

I'm seeing this in the report / log:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'completed' in 'where clause': SELECT SUM(uop.qty) FROM {uc_orders} uo LEFT JOIN {uc_order_products} uop ON uo.order_id = uop.order_id WHERE uo.order_status = "completed" AND uo.uid = :uid AND uop.nid = :nid ORDER BY uop.nid; Array ( [:uid] => 0 [:nid] => 117 ) in uc_restrict_qty_count() (line 304 of /home/domain/public_html/sites/all/modules/uc_restrict_qty/uc_restrict_qty.module).

neochief’s picture

Status: Needs work » Needs review
StatusFileSize
new1.57 KB

Here's updated patch, which solves both of the issues.

neochief’s picture

StatusFileSize
new2.53 KB

I noticed that the main hook was named unproperly. Fixed as well.

jperry.nu.designs’s picture

just mentioning here that dpm() is a debugging function that is part of devel. It should not be included/active in a live version of the module. If you have the devel module installed, you can enable it and 1) no more errors, and 2) you get a nice debug message (object) when you add to a product.

I haven't reviewed the patches listed above, nor tested them yet, but I thought I would explain what dpm is and that it can be 'solved' by installing and enabling devel module even if you don't ever turn access to devel on for any user.

neochief’s picture

Issue summary: View changes
jamestombs’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #14 fixes all issues.

webservant316’s picture

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

see this issue for all the patches I needed to get this module working...

https://www.drupal.org/node/2144385#comment-9393401

raulmuroc’s picture

Status: Reviewed & tested by the community » Closed (fixed)
glynster’s picture

Great job fixing this!

glynster’s picture

The latest release fails, I had to revert to the latest dev version again.

raulmuroc’s picture

@glynster, could you ease some info bout the errors/problems you get?

webservant316’s picture

problem in current release noted here https://www.drupal.org/node/2454819.

glynster’s picture

Perfect problem resolved in the latest release. Thanks @webservant316 for finding the issue!

webservant316’s picture

version 1 works for me now also. :-)