Jump to content

How to Limit a Free Product once to a client ?


Recommended Posts

  • 5 months later...
I don't know if it's v7 compatible, but you could try the free module below. :idea:

 

https://github.com/Jetserver/WHMCS-Product-Limiter

Just tested this with 7.2.3 and it DOES NOT work.

 

Getting the following errors:

 

 

BadFunctionCallException: mysql_free_result is not supported in /home/username/public_html/includes/dbcompatfunctions.php:0

Stack trace:

#0 /home/username/public_html/modules/addons/limit_purchase/functions.php(21): mysql_free_result(Object(PDOStatement))

#1 /home/username/public_html/modules/addons/limit_purchase/functions.php(9): limit_purchase->loadConfig()

#2 /home/username/public_html/modules/addons/limit_purchase/limit_purchase.php(91): limit_purchase->__construct()

#3 [internal function]: limit_purchase_output(Array)

#4 /home/username/public_html/admin-login/addonmodules.php(0): call_user_func('limit_purchase_...', Array)

#5 {main}

Link to comment
Share on other sites

works for me on v7.2.3 using Six & Standard_cart - e.g., setup a product with a limit of 1...

BtOPSxg.png

then go to the cart and try to add two of these products, click checkout and it correctly outputs the error message and prevents checkout occurring...

 

4CIFGJk.png

remove the second product and checkout works as normal. :idea:

 

I guess your problem will be that you're using PHP7 (i'm testing with 5.5 on the dev currently) and so mysql_free_result has been removed...

 

http://php.net/manual/en/function.mysql-free-result.php

 

Warning

This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:

 

so long-term, it's definitely going to fail if it's isn't rewritten to use mysqli or PDO... short term, if you're not using PHP7 (or possibly 5.6), it should work fine.

Link to comment
Share on other sites

that could be one of those "how long is a piece of string" questions!

 

either way, I suspect the answer is somewhere between the two... more than a couple of tweaks, but not quite a complete rewrite... the core addon works, so it's just a case of tweaking the SQL method.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated