Jump to content
Sign in to follow this  
HostT

Open Source Affiliate Coupons/Promo Code (instead of link)

Recommended Posts

So what does this addon mean? It means your customers can give out promo codes, AND no longer have to use those ugly affiliate links!

 

We all know customers will make sure to use a promo code ... but will they make sure to use your link? No, not always.

 

Enter WHMCS Affiliate Coupons

 

Selection-1002x631-11.png

 

In my opinion this is one of the best and one of my favorite addons -- the original version Affiliate Coupons by Frank Lazslo:

http://forum.whmcs.com/showthread.php?31020-Affiliate-Coupons

 

Unfortunately the addon has not been updated recently (and completely understandable), I decided to go ahead and put it up on my GitHub and start working on it.

 

Latest update should be fully compatible with WHMCS 5.2+

 

So here's what's been updated so far:

  • Updated Affiliate Cookie ID
  • Updated Hook Cookie ID
  • Updated Default Template
  • Updated Client Area HTML/CSS Output

 

Planned Updates:

  • Restructure to only addon module
  • Update admin area configuration, and layout
  • Update templates and output

 

Got an idea? Well post it on GitHub under issues!

 

So what are you waiting on!? It's open source, so check it out on GitHub, and if you're feeling froggy, contribute as well!

 

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

 

NOTE: If you're using WHMCS 5.1 you will have to use the branch in link below, 5.2 has changed and the master branch is not compatible with WHMCS 5.1

 

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

Selection-1130x736-12.png

Share this post


Link to post
Share on other sites

Great thank you! I missed the notice on the other thread and just saw this here, so I'll be testing it in the coming days and let you know. many thanks again!

Share this post


Link to post
Share on other sites

Hi there. Please help installing this addon.

After installing it is not visible in client area. After changed affcoupons.php to show errors I get this.

 

Fatal error: Call to undefined function select_query() in /var/www/html/affcoupons.php on line 26

 

Thanks in advance.

Share this post


Link to post
Share on other sites
Hi there. Please help installing this addon.

After installing it is not visible in client area. After changed affcoupons.php to show errors I get this.

 

Fatal error: Call to undefined function select_query() in /var/www/html/affcoupons.php on line 26

 

Thanks in advance.

 

What version of WHMCS are you using? That error is from the select_query() function that is a native WHMCS MySQL query. That error says there is something wrong with your WHMCS installation, it's not related to the addon.

Share this post


Link to post
Share on other sites

Hiya, is this confirmed working with the latest whmcs? I've tried to install, but it seems broken. I renamed the folder to just affcoupons so that it shows up as an addon, but from that point on, it just gives me broken pages.

 

Thanks!

Share this post


Link to post
Share on other sites
Hiya, is this confirmed working with the latest whmcs? I've tried to install, but it seems broken. I renamed the folder to just affcoupons so that it shows up as an addon, but from that point on, it just gives me broken pages.

 

Thanks!

 

Which version, 5.3.5?

 

Did you follow the installation instructions?:

https://github.com/tripflex/whmcs-affcoupons/blob/master/INSTALL

 

Please provide any further details you can so I can try and reproduce the errors

Share this post


Link to post
Share on other sites

I tried a lot of ways but, it is not showing up in the affiliates.php at the bottom? What do i need to put in affiliates.tpl?

Share this post


Link to post
Share on other sites

i am assuming since there is already a default * file in the root, we save that to old and replace it with the one in this module, is that correct?

Share this post


Link to post
Share on other sites

i cant get this to work either, its installed and activated and i added a coupon but it is nowhere to be found other than in the ACP list

 

cannot access https://mysite.com/index.php?m=affcoupons not found

 

 

UPDATE:

 

The promo code page is located here not at the link above..

 

https://yoursite.com/whmcs/index.php?m=affcoupons

Edited by durangod

Share this post


Link to post
Share on other sites

ok folks i totally changed the layout of the promo codes page, everything is centered and i move the alert to the top of the page, to me it looks better.

 

the file name is clientaffcoupons.tpl and it goes in the modules/addons/affcoupons/

make sure you rename your old one to old or save it someplace.

 

here is what it looks like on the client side.

 

affpromsample.jpg

 

and here is the code..

 


<!-- moded version layout, all centered and added widths and colors and css and moved inputs to center page content -->

<!-- added notice style as it was not found in bootstrap -->


<div id="affcoupons-ajax">
      <div class="affnotice">

        <!-- added if notice color to change text color on alert to red -->

         <div id="notice" class="alert alert-{if !$notice_type}success{else}{$notice_type}{/if}" {if $notice} style="color:#cc0b34;"{/if} {if !$notice}style="display: none;"{/if}>{$notice}
         </div>
      </div>

    <div class="page-header">
       <div class="styled_title" align="center">
           <h2>Landing Page</h2>
       </div>
    </div>

   <form method="POST" action="{$index_page}?m=affcoupons" name="landingpage" id="landingpageForm" align="center">
       <input type="hidden" name="cmd" value="modlanding">
       <div class="well textcenter">
           <input type="text" name="landing" id="landing" value="{$landing}" class="bigfield" size="40" maxlength="60" />
             
           <input type="submit" name="Submit" value="Update" class="btn btn-primary btn-large" id="updatelanding" />
           <div class="internalpaadding">
            <p>This option will control where your referrals will be redirected after visiting your referral link.</p>
           </div>
       </div>
   </form>
<div class="page-header">
    <div class="styled_title" align="center" style="padding-top:15px;">
        <h2>Your Coupons</h2>
    </div>
</div>
<table  class="table table-striped table-framed" cellspacing="10" cellpadding="0" style="background-color:#EBEBEB;" align="center">
    <thead>
        <tr>
            <th width="10%" align="center">Delete</th>
            <th width="30%" align="center">Coupon Code</th>
            <th width="20%" align="center">Coupon Type</th>
            <th width="20%" align="center">Coupon Value</th>
            <th width="20%" align="center">Uses</th>
        </tr>
    </thead>

    {if !$coupon}
    <tbody><tr><td colspan="5" style="text-align:center;font-weight:bold;">No Coupons Found</td></tr></tbody>
    {else}
      <tbody>
       {foreach from=$coupon key=k item=v}
	<tr>
	<td width="10%" align="center">
	<a href="{$index_page}?m=affcoupons&cmd=del&cid={$v.id}"><img src="modules/addons/affcoupons/inc/images/delete.png" alt="Delete"></a>
	</td>
	<td width="30%" align="center">{$v.code}</td>
	<td width="20%" align="center">{$v.type}</td>
	<td width="20%" align="center">{$v.value}</td>
	<td width="20%" align="center">{$v.uses}</td> 
	</tr>
       {/foreach}
     </tbody>
    {/if}

</table>
<div class="page-header">
    <div class="styled_title" align="center" style="padding-top:15px;">
        <h2>Add Coupons</h2>
    </div>
</div>

<form action="{$index_page}?m=affcoupons" method="POST" name="addcoupons" class="form-horizontal">
    <input type="hidden" name="cmd" value="add" />
    <div class="well" align="center">

<!-- modified so that it is in one control group and one class controls css (side by side) and added bkground color -->

        <div class="control-group">
                <div class="controls">
                <label for="code" class="control-label">Coupon Code:</label>
                <input type="text" name="code" id="code" />       
                <label for="code" class="control-label" style="padding-left:10px;">Coupon Type:</label>
                <select name="type">
		{foreach from=$avail_coupon item=v}
		<option value="{$v.enc_string}">{$v.label}</option>
		{/foreach}
                </select>
                         <input type="submit" name="Submit" value="Add" class="btn btn-primary btn-large" />
            </div>  <!-- close controls -->
        </div> <!-- close group -->
     	    </div>  <!-- close well -->
</form>
</div> <!-- close div affcoupons-ajax -->
<br />
<br />
<!-- end affcoupons-ajax -->


 

enjoy :)

 

ps - one simple note to developer make sure your closeing your input tags with / and i dont know what template you used for your demo image on the first post but it dont look nothing like mine at all...

 

questions:

 

as admin how do i know what coupon codes are valid, once the client assigns a code it should be shown in the ACP someplace but it is not. So how do i know what is valid and what is not as an admin.

 

And do these codes go in the promo input on the cart page?

 

I dont need to print or design anything like a flyer, that is all for the affiliates to do? I am guessing thats how this works, they hand out a flyer with the code and then that person uses the code to get the discount. Correct?

 

and i guess ill be adding a menu link or some kind of link to https://yoursite.com/whmcs/index.php?m=affcoupons because it is not showing up on the affiliate page and i thought you said it would be there.

 

and also please tell me what this is i the image. if this is just a sample, how do i get rid of it i dont like samples on my site. What is planned here?

 

exampsb.jpg

 

thats all questions for now thanks.

 

thanks :)

Edited by durangod

Share this post


Link to post
Share on other sites

here is another change...

 

Issue: setting the type to Percentage still show for example 20.00 under coupon value..

 

Fix.. toss in an if statement to change the display accordingly.

 

here is the new code snippet for inside of modules/addons/affcoupons/clientaffcoupons.tpl

 

original code

 

<td>{$v.value}</td> 

 

i changed to this (this is my version with the width and align - you dont have to use those i just did it thats all

 


//basic version 

               {if $v.type == "Percentage"}
               <td>{$v.value|string_format:"%d"}</td> 
               {else}
               <td>{$v.value}</td> 
               {/if}



// or fancy version

               {if $v.type == "Percentage"}
               <td width="20%" align="center">{$v.value|string_format:"%d"}</td> 
               {else}
               <td width="20%" align="center">{$v.value}</td> 
               {/if}


 

so that will show lets say 20 if percentage and 20.00 if not..

Share this post


Link to post
Share on other sites

Seems to me your going to have to do some serious css mods or have someone do them for you. Im not sure where the dev got his screen shot on the first page. Maybe he also uses a custom theme im not that familiar with all the other themes, i just use portal. But i still believe your going to have to do some big changes to the tpl file to get that look.

Share this post


Link to post
Share on other sites

I dont get why it looks normal with no edits before adding or deleting a coupon. Its a custom theme with no edits and it looks perfect.

Share this post


Link to post
Share on other sites

hi,

 

first please update your thread in the add on section or maybe list both if you can.

 

but i found an issue. Seems like its a battle between your addon and the SEO addon, i made a post there as well.

 

http://forum.whmcs.com/showthread.php?47572-FREE-ADDON-WHMCS-SEO-Page-Manager/page3

 

 

when i went to try to get this to pass w3c it told me that my meta did not belong so i looked and i understand why now

 

this is what it showed i source.

 

 

<script type="text/javascript" src="https://xxxxxxx.com/billing/modules/addons/affcoupons/inc/js/affiliates.js"></script><input type="hidden" id="index_page" value="index.php"/><input type="hidden" id="script_name" value="/billing/index.php"/>

<meta name="description" content="The Portal home page has an assortment of hosting options and features for clients and non clients of DDH. Order your domain, become and affiliate, check network, submit tickets, check announcements and many more features. " />

<meta name="keywords" content="Members Area, Members Home, Portal Home, DDH Portal, DDH Client Area, Hosting Home Page, hosting" />

 

</head>

 

 

i dont know why the meta ended up below your js but it needs to be above, again i left them a post as well.

 

also i think those hidden inputs are yours and they dont belong in the header without an object assignment of some kind. They need to be either in the hook or somehow inside the parsed body section.

 

also i had to add type="text/javascript" to your modules file to get rid of that issue and also had to close a few inputs with / as well in your modules files.

 

is there any way we can get those inputs out of the head section and into the body, and is there any way you can move your js after the meta section so they dont conflict.

 

thanks :)

Share this post


Link to post
Share on other sites

you probably need to redo this section in your clientarea php file

 


} else {
$return_html = '<script type="text/javascript" src="' . AC_WHMCSe::get_module_url( 'affcoupons' ) . '/inc/js/affiliates.js"></script>';
$return_html .= '<input type="hidden" id="index_page" value="' . parent::$index_page . '"/>';
$return_html .= '<input type="hidden" id="script_name" value="' . $vars['SCRIPT_NAME'] . '"/>';
      }

 

 

especially the last two lines which put inputs in the header and they dont belong there. I would suggest possibly converting those to js and just using innerHTML and getElementById to load the values. If you cant do that i think i remember seeing a .loadafter function someplace that you can load stuff like that after the initial body container which is just as good.

 

 

yeah its called insertafter and you have it in your affiliates.js file

 

if (checkAffHeader || checkAffPath == '/affiliates.php' || script_name == '/affiliates.php') {
       $('<div>').load( '/' + index_page + '?m=affcoupons #affcoupons-ajax').insertAfter('.whmcscontainer .contentpadded .pagination');

 

 

just use the same function and load the inputs after the header is loaded.

 

if you need help let us know.

Edited by durangod

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Similar Content

    • By ModulesGarden
      The magical Christmas atmosphere can already be felt around every corner, filling our hearts with joy and happiness. 
      Driven by this extraordinary time, we send the kindest wishes to all our clients this season. Have a time full of laughter and moments spent with the ones closest to you!
        So as to allow you to feel the spirit even ahead of time, we have launched a magnificent Christmas Promotion! You are more than welcome to grab all WHMCS modules available on our marketplace 10% OFF, using a jolly promo code which remains applicable until January 8th, 2023.

      Get the Christmas gift you've always dreamed of!
    • By ModulesGarden
      Welcome the most hungry bargain hunters!

      We know you've been on the lookout for details about our Black Friday event, but what you don't know is that you're in for a much bigger treat than you thought.
      We’ve launched our Black Weeks action, empowering you to stock up on every WHMCS product from our huge marketplace at a staggering 25% discount, which includes not only
      annual licenses but also open source products as well as license upgrades!
       
      Keep filling your shopping cart until December 4th without a shadow of a guilty conscience - your WHMCS business will thank you for that!

      Embark on the wildest shopping frenzy of the year!
    • By PUQ
      It's that time of year again! Black Friday is upon us and that means big savings on WHMCS modules. If you're looking to add some new features to your WHMCS installation or just save some money, this is the perfect opportunity.
      We have a wide selection of modules on sale, so there's sure to be something for everyone. Whether you're looking for a new payment gateway, a better way to manage your clients, or just some general enhancements, we've got you covered.
      So don't wait – take advantage of our Black Friday deals today!
      Pick the module in our shop and use this Promo Code: BF80
    • By ModulesGarden
      Halloween season is almost upon us! Time to watch out again, as you never know when a ghost or a vampire might appear out of nowhere, asking you for treats.
      Today we join this boo-tiful aura with a special contest, in which everyone can participate to win a promo code for a 22%, 33%, 44%, 55% or even a jaw-dropping 66% discount – it's all up to how accurate (or lucky ) you are!
      You will find all details on our Blog, so make sure you drop by and take part. Not in the mood for contests? Don’t worry, you’ll also find a uniquely thrilling 13% Halloween discount applicable to every single WHMCS module you could possibly find within the confines of our vast Marketplace.
      Be sure to make your presence felt in our contest by November 2nd to make this spooky celebration even more memorable!

      Win a treat, avoid the trick!
    • By ModulesGarden
      1. It’s time to let out the monsters!

      You can’t possibly come up with a better occasion to treat yourself than Halloween season, and now you can do it with not just sweets. We’re feeling particularly spooked this year and have prepared an exciting game that will make your hair stand on end!

      Beware, as you can win a promo code of 22%, 33%, 44%, 55%, or the massive 66% discount – only by replying with an answer to one question. Make sure to drop by as you can already find a chilling 13% discount promo code on the Blog! Your answers will be collected until November 2nd.

      Hop on your broom and join in!




      2. Multibrand For WHMCS 2.10.0

      Our extraordinary toolkit for managing multiple brands at once has just scored full compatibility with the latest WHMCS V8.6, even before this version of the system has reached its General Availability stage, as well as for the stable V8.5!

      Multibrand For WHMCS 2.10.0 adds a significant amount of comfort for your clientele, debuting a spanking new feature – brand switcher. If your client is assigned to two brands or more, they will be able to easily navigate between them, not having to enter their credentials each time.

      Next to many other enhancements of this famous piece of software, there is another announcement bound to catch your attention – it’s now available at a superb 10% discount!

      Read more about Multibrand For WHMCS 2.10.0!




      3. Server Allocator For WHMCS 1.3.0

      Our developers never cease to amaze us with new, creative ideas, just like here in the case of our Server Allocator For WHMCS known for automated matching of servers to the products of your clients.

      It’s with the 1.3.0 update that the module, already praised for its endless server assigning possibilities, becomes equipped with a new rule type that makes it real for a chosen server to be assigned to specific customers.

      Moreover, you’ll definitely be pleased to know that we have enriched it with not only impeccable WHMCS V8.6 and PHP 8.1 support, but also... a handsome 20% discount!

      Read more about Server Allocator For WHMCS 1.3.0!




      4. PanelAlpha with Quick Onboarding Process

      The futuristic WordPress revolution has recently taken another step forward, as PanelAlpha has been equipped with the new Quick Onboarding Process, which only requires your clients to take three straightforward steps in order to add an instance.

      PanelAlpha’s team has no intention of slowing down though, and you can look forward to the availability of the platform’s own admin area in the near future. Your customers will also be able to share control of their instances!

      Quick Onboarding can already be experienced personally via live demo, just like every previously implemented addition. Why don’t you give it a go before the next set of news gets announced?

      Enter the world of PanelAlpha!




      5. More WHMCS V8.6 Compatibility Updates

      How could we forget to make a special mention of other most recent updates dedicated to full-scale WHMCS V8.6 support?
      Amazon EC2 For WHMCS - v1.4.2 Amazon Lightsail For WHMCS - v1.3.3 DirectAdmin Licenses For WHMCS - v1.4.7 Discount Center For WHMCS - v1.5.1 Domains Reseller For WHMCS - v2.2.6 Plesk Extended For WHMCS - v3.6.3 Quotes Automation For WHMCS - v2.2.3


      Need Custom Software Development For Your Business?
      Get Your Free Quote Now! Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
  • 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