Jump to content

Affiliate Coupons


Recommended Posts

  • 1 month later...
  • Replies 175
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • 2 weeks later...
  • 4 weeks later...
  • 1 month later...
  • 4 weeks later...

Hmmm... I struggled installing this for over a week. Everything seemed fine and perfect and I read and re-read this thread many times but nothing seemed to work. My problem was that everythign seemed to isntall fine, but nothing displayed on the user's affiliate.php page. I could add usable coupons in the admin area, but the user just saw nothing. I even "View Source" on the HTML page, but no code was there -- just disappeared. Then 5 minutes ago I made a slight change and things appeared.

 

Here is what I did:

 

I changed this:

{if $affiliatelinkscode}
<p><strong>{$LANG.affiliateslinktous}</strong></p>
<p align="center">{$affiliatelinkscode}</p>
{/if}
<hr>
<!-- BEGIN AFFILIATE COUPONS CODE -->
{php}
include('affcoupons.php');
{/php}
<!-- END AFFILIATE COUPONS CODE -->
{/if}

 

to this:

 

<p><strong>{$LANG.affiliateslinktous}</strong></p>
<p align="center">{$affiliatelinkscode}</p>
{/if}
<hr>
<!-- BEGIN AFFILIATE COUPONS CODE -->
{php}
include('affcoupons.php');
{/php}
<!-- END AFFILIATE COUPONS CODE -->

 

 

I only removed the first IF and the final /IF

 

Any idea why that would work? I am only 5 minutes info configuring this now that it appears, so maybe I will find the solution why....

Link to comment
Share on other sites

1) Yes, using the code grants the creator (the affiliate) the credit.

 

Ok, I have not been able to test this functionality because of the way my payment processor is setup. So I have a question: how much credit is the creator given? Does this default to the main "Affiliate Earning Percentage" set in the General Settings > Affiliates area?

 

If so, does that mean if I set it to 10% in the "Affiliate Earning Percentage" then that works for the default WHMCS affiliate link code as well as the Coupon Code from Frank's module here?

Link to comment
Share on other sites

  • 4 months later...

I figured it out. Actually WHMCS changed * so during upgrade it was over written. So I added this at the end of file after moved permanently header:

=============================

// perform redirect

header("HTTP/1.1 301 Moved Permanently");

 

$r = select_query("tblaffcouponslanding", "landing", array("aff_id"=>$aff));

$data = mysql_fetch_array($r);

$landing = $data['landing'];

header("HTTP/1.1 301 Moved Permanently");

if ($landing) {

header("Location: $landing");

exit;

} else {

header("Location: ".$whmcs->get_config('Domain'),true,301);

exit;

}

=============================

 

May be this will be helpful for new release or existing users of this great module. I really love it. Thanks again!

Link to comment
Share on other sites

  • 4 weeks later...

Hi,

 

I have new 5.2.4 WHMCS. I installed the module like in the manual, I added the above code to *, I added a few coupons, but nothing is displayed in the client affiliate program page.

 

Anyone know how to fix it?

 

Best regards,

Thomas

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...
  • 4 months later...
Never mind... I was stupid and I had some bad code... I fixed my issue above. This module is GREAT! I hired Frank earlier this year for some custom mod work and he did a very good job. Too bad he had to stop his WHMCS work :(

 

Hi! Sorry to bring up such an old response, but exactly HOW did you solve the issue? I am using a custom affiliates.tpl file, so I've added the code at the bottom:

 

{if $inactive}

<p>{$LANG.affiliatesdisabled}</p>

{else}

<p align="center">{$LANG.affiliatesrealtime}</p>

<table cellspacing="1" cellpadding="0" class="frame"><tr><td>
<table width="100%" cellpadding="2">
<tr><td width="30%" class="fieldarea">{$LANG.affiliatesvisitorsreferred}</td><td width="20%">{$visitors}</td><td width="30%" class="fieldarea">{$LANG.affiliatescommissionspending}</td><td width="20%">{$pendingcommissions}</td></tr>
<tr><td class="fieldarea">{$LANG.affiliatessignups}</td><td>{$signups}</td><td class="fieldarea">{$LANG.affiliatescommissionsavailable}</td><td>{$balance}</td></tr>
<tr><td class="fieldarea">{$LANG.affiliatesconversionrate}</td><td>{$conversionrate}%</td><td class="fieldarea">{$LANG.affiliateswithdrawn}</td><td>{$withdrawn}</td></tr>
</table>
</td></tr></table>

<p align="center"><strong>{$LANG.affiliatesreferallink}:</strong> <input type="text" size="60" value="{$referrallink}"></p>

{if $withdrawrequestsent}
<p align="center">{$LANG.affiliateswithdrawalrequestsuccessful}</p>
{else}
{if $withdrawlevel}<p align="center"><input type="button" value="{$LANG.affiliatesrequestwithdrawal}" onclick="window.location='{$smarty.server.PHP_SELF}?action=withdrawrequest'" class="buttonwarn" /></p>{/if}
{/if}

<p class="heading2">{$LANG.affiliatesreferals}</p>

<table align="center" class="clientareatable" cellspacing="1">
<tr class="clientareatableheading"><td>{$LANG.affiliatessignupdate}</td><td>{$LANG.orderproduct}</td><td>{$LANG.affiliatesamount}</td><td>{$LANG.orderbillingcycle}</td><td>{$LANG.affiliatescommission}</td><td>{$LANG.affiliatesstatus}</td></tr>
{foreach key=num item=referral from=$referrals}
<tr class="clientareatableactive"><td>{$referral.date}</td><td>{$referral.service}</td><td>{$referral.amount}</td><td>{$referral.billingcycle}</td><td>{$referral.commission}</td><td>{$referral.status}</td></tr>
{foreachelse}
<tr class="clientareatableactive"><td colspan="6">{$LANG.affiliatesnosignups}</td></tr>
{/foreach}
</table>

{if $affiliatelinkscode}
<p><strong>{$LANG.affiliateslinktous}</strong></p>
<p align="center">{$affiliatelinkscode}</p>
{/if}
<hr>
<!-- BEGIN AFFILIATE COUPONS CODE -->
{php}
include('affcoupons.php');
{/php}
<!-- END AFFILIATE COUPONS CODE -->
{/if}

 

Still, I cannot get anything to show up on the affiliate's page. Using 5.2.12 of WHMCS. Any thoughts or suggestions are appreciated!

Link to comment
Share on other sites

OK, please ignore my last post, as I had forgotten to include the affcoupons.php file in my WHMCS folder. Once I did that, everything worked! Here's my latest challenge...

 

When you look at my affiliates page, the formatting that is provided with this module does not seem to work.

 

affiliatecoupons.png

 

As you can see, none of the header styles or table styles that are defined in the code's "print" commands seem to be recognized. When I look at other sections of the affiliates.tpl file, the method for making text stylized and creating tables is very different. By inserting the affcoupons.php in my template, the script's output is just plain and not aligned properly.

 

Below is what my affcoupons.php file tries to output (the part of the code that i believe displays the information):

print "<p class=\"heading2\">Landing Page</p>
	<p class=\"heading3\" align=\"center\">$msg2</p>
	<form action=\"affiliates.php\" method=\"POST\" name=\"landingpage\">
	<p align=\"center\">
	This option will control where your referrals will be redirected after visiting your referral link.<br />
	<input type=\"hidden\" name=\"cmd\" value=\"modlanding\">
	Landing Page: <input type=\"text\" size=\"48\" name=\"landing\" value=\"$landing\">
	<input type=\"submit\" name=\"Submit\" value=\"Modify\"></p></form>";
// Get Existing Coupons
$coupon = array();
$sql = "SELECT p.code, p.type, p.value, p.uses, p.id
	FROM tblpromotions p, tblaffcoupons a
	WHERE a.aff_id = '$aff_id' AND a.coupon = p.id";
$data = mysql_query($sql);
while ($r = mysql_fetch_array($data)) {
$coupon[$r[4]]['code'] = $r[0];
$coupon[$r[4]]['type'] = $r[1];
$coupon[$r[4]]['value'] = $r[2];
$coupon[$r[4]]['uses'] = $r[3];
$coupon[$r[4]]['id'] = $r[4];
}
print "<p class=\"heading2\">Your Coupons</p>
	<p class=\"heading3\" align=\"center\">$msg</p>
	<table align=\"center\" class=\"clientareatable\" cellspacing=\"1\">";
print "<tr class=\"clientareatableheading\"><td> </td><td>Coupon Code</td><td>Coupon Type</td><td>Coupon Value</td><td>Uses</td></tr>";

foreach ($coupon as $key => $val) {
$code = $val['code'];
$type = $val['type'];
$value = $val['value'];
$uses = $val['uses'];
$id = $val['id'];
print "<tr class=\"clientareatableactive\"><td><a href=\"affiliates.php?cmd=del&cid=$id\"><img src=\"templates/default/images/delete.png\"></a></td><td>$code</td><td>$type</td><td>$value</td><td>$uses</td></tr>";
}
print "</table>";
print "<p class=\"heading2\">Add Coupons</p>";
print "<form action=\"affiliates.php\" method=\"POST\" name=\"addcoupons\">
	<input type=\"hidden\" name=\"cmd\" value=\"add\">
	<p align=\"center\">Coupon Code: <input type=\"text\" name=\"code\" value=\"\" size=\"30\"> Coupon Type: <select name=\"type\">";

$data = select_query("tblaffcouponsconf", "*", array());
while ($val = mysql_fetch_array($data)) {
$type = $val['type'];
$recurring = $val['recurring'];
$value = $val['value'];
$cycles = $val['cycles'];
$appliesto = $val['appliesto'];
$expirationdate = $val['expirationdate'];
$maxuses = $val['maxuses'];
$applyonce = $val['applyonce'];
$newsignups = $val['newsignups'];
$existingclient = $val['existingclient'];
$label = $val['label'];
$string = "$type@$recurring@$value@$cycles@$appliesto@$expirationdate@$maxuses@$applyonce@$newsignups@$existingclient";
$enc_string = base64_encode($string);
print "<option value=\"$enc_string\">$label</option>";
}
print "</select><input type=\"submit\" name=\"Submit\" value=\"Add\"></p></form>";
?>

 

Can anyone guide me to make the changes so that the headers, tables, buttons and whatever else looks like the rest of my affiliates.tpl page?

 

Thanks in advance!

Link to comment
Share on other sites

  • 1 month later...

Well out of luck and just giving it a try, I was able to download the 1.2 version through the same link for 1.1, and went ahead and uploaded it to GitHub.

 

I've just started working on updating this addon today, you can follow development or even contribute:

https://github.com/tripflex/whmcs-affcoupons

 

Master branch that is on there now has been modified to work with WHMCS 5.2.1+, if you are using WHMCS 5.1 or lower you must use the WHMCS-5.1 branch (will probably never be updated again):

https://github.com/tripflex/whmcs-affcoupons/tree/WHMCS-5.1

 

There were some updated from 1.1 that I found when going through the code, but for the only real change i've found so far was the cookie ID from WHMCSAffiliateId to AffiliateId, which is referenced both in the * and hook file to check the promo code against affiliate id. This has already been updated on the master branch.

 

Once I can test it on templates i'll update it to work with the newest version. I've got the beta 5.3 and * has stayed the same from 5.2, just need to do a little more testing.

 

Enjoy.

Link to comment
Share on other sites

GitHub master branch has been updated to fix formatting of template layout.

 

 

OK, please ignore my last post, as I had forgotten to include the affcoupons.php file in my WHMCS folder. Once I did that, everything worked! Here's my latest challenge...

 

Look at the github link in my earlier post, i've updated the latest version and fixed the template to use the new bootstrap formatting. Should work on the new templates. You must be using WHMCS 5.2+

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • 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