tripflex/whmcs-affcoupons

WHMCS V6

Opened this issue · 18 comments

Fatal error: Class 'WHMCS_Cookie' not found in
/modules/addons/affcoupons/hooks.php on line 48

Which beta version are you using?

Beta 4

Ok thanks, when I get back from memorial day holiday I will debug this ... chances are the class used for cookies has been removed or changed:

https://github.com/tripflex/whmcs-affcoupons/blob/master/aff.php#L22

You may be able to check the beta version's aff.php file and see what it has been changed to

From WHMCS:

Ok thank you, there's no issue, just I'm suprised someone has figured out how to use it. Should just be a case of adding: use WHMCS\Cookie; at the top of the file and changing the WHMCS_Cookie::get to just Cookie::get and then it should work exactly the same as before.

I've tried to add this to the code but still not working. I'm already using WHMCS 6.0.1 release, isn't a BETA software now.

The changes suggested by @metrotyranno seem to do the trick.. appears to be working perfectly on v6.1.1

@ant-fx @metrotyranno sorry guys been mad busy with other projects haven't had time to even test this out or work on any updates.

You mentioned that WHMCS said to use Cookie::get ... but shouldn't it be Cookie::set?

It seems that WHMCS likes to keep changing how they are handling cookies as they changed this in version 5, then with 5.2 they changed it again, and now it looks like version 6 they decided to go with namespaces and thus, changed it again

It's a great project @tripflex, many thanks for providing it, I'd love to see native support for this added into WHMCS as its essential for any kind of offline marketing that affiliates might perform.

Let's see, it was adding use WHMCS\Cookie; then changing from

$checkcookie = WHMCS_Cookie::get("AffiliateID", true);
if($affid){
    // update_query("tblaffiliates",array("visitors"=>"+1"),array("id"=>$affid));
    WHMCS_Cookie::set('AffiliateID',$affid,'3m');
}

to

$checkcookie = Cookie::get("AffiliateID", true);
if($affid){
    // update_query("tblaffiliates",array("visitors"=>"+1"),array("id"=>$affid));
    Cookie::set('AffiliateID',$affid,'3m');
}

As I say it appears to work fine on 6.1.1 but I have not done exhaustive testing.. only created 2 users, a coupon code associated with user 1 and purchased with that code on user 2, user 1 got the credit so seems to be working as expected.

Fatal error: Using $this when not in object context in /home/dbmhosti/public_html/vendor/smarty/smarty/libs/SmartyBC.class.php(464) : eval()'d code on line 2

Version 6.2.0 RC1

Hi ant-fx Have you tried this on Version: 6.2.0, as i cannot seem to follow you changes in the aff.php file, it seems that its changed.

I can add the a new coupon from the client area and it show in the promotions tab in the admin, but when you try to use it i get a 500 error, however when i create a promotion directly in the admin they work.

Anyone know what needs to be changed? I really wish this was a paid plugin so tripflex gets the reward he deserves for such a great plugin and if this can be fixed i am more than happy to Pay

What version of WHMCS are you using?

Can you enable error reporting in Setup -> General Settings -> Other -> Display Errors then reload the page and see what the error reports? (Turn the Display Errors option off again when you are done.)

What error is shown?

I really wish this was a paid plugin so tripflex gets the reward he deserves for such a great plugin and if this can be fixed i am more than happy to Pay

I agree, we would happily pay for this plugin to get regular updates and a more polished workflow.

Thanks for getting back to me ant-fx

I get the following error

Fatal error: Class 'WHMCS_Cookie' not found in /home/birchg/public_html/om/modules/addons/affcoupons/hooks.php on line 48
Call Stack

Time Memory Function Location

1 0.4221 40057920 call_user_func:{/home/birchg/public_html/om/includes/hookfunctions.php:0} ( ) .../hookfunctions.php:0
2 0.4221 40058056 affcoupons_set_affiliate_cookie( ) .../hookfunctions.php:0

This did work on Version: 5.3.14 but not on 6+ i am running version 2.1.2 of Affiliate Coupons

I have realised that the code changes you were referring to was for the hooks file so i made the changes you suggested and now i get

Fatal error: Class 'Cookie' not found in /home/birchg/public_html/om/modules/addons/affcoupons/hooks.php on line 48

Which refers to $checkcookie = Cookie::get("AffiliateID", true);

Any thoughts?

Did you include

use WHMCS\Cookie;

At the top of the file, just below the comments block? It should look like this:

/**
 * WHMCS Affiliate Coupons Admin Class
 *
 * @package    WHMCS 5.2.1+
 * @author     Myles McNamara (get@smyl.es)
 * @copyright  Copyright (c) Myles McNamara 2013-2014
 * @license    GPL v3+
 * @version    2.1.2
 * @link       https://github.com/tripflex/whmcs-affcoupons
 * @Date:   2014-03-19 21:42:52
 * @Last Modified by:   Myles McNamara
 * @Last Modified time: 2014-03-23 02:21:45
 */

use WHMCS\Cookie;

if (!defined("WHMCS"))
    die("This file cannot be accessed directly");

Hi ant-fx

You have made my day, the answer is no i missed that in the hooks file, just added it and all is good now with the other code changes.

Thanks buddy

Hi,
I am Using WHMCS v6.3.0
I install this addon and face a problem.
I can create Coupons type from Admin Panel but I can not see it in Client Area.
From Client area in Affiliates section I do not found coupon creating option and the Landing Page option.
I attach the screenshot..

ss

Please help as soon as possible.
Thanking You

Hi ant-fx

Have you tried this on V7?