Jump to content
StreamingServers

How to Limit a Free Product once to a client ?

Recommended Posts

Hi,

 

how can i limit a free product/service only onetime to a client?

I just want that a client order the free product/service only onetime with his account.

 

I just want prvent some Spam cients, that make multiple order for the free producht or service.

 

I would be happy about every ideas or excitement.

 

Kind regards

Share this post


Link to post
Share on other sites
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}

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Is this hard to update for PHP7? A couple line changes ?!?! or is it like a total rewrite of the module ? I am trying to compare modules to see if I can notice the differences in the files and see what I can do to get this to work, as I could use this module right now with my free trails I want to offer.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines