Jump to content
HostT

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

Recommended Posts

ok folks here is the fix for this addon, gosh willy wonka im a nice guy lmao ....

 

issue: if you use this addon your page will not pass w3c because the way they coded this, it puts html input tags in your header, which is not where they go. This fixes that issue..

 

so here we go..

 

open your templates/<whatever you use>/header.tpl file

 

i did mine for portal so yours may be different but basically you want the hidden inputs to be right after the top container. They are hidden but if you need to test and make them visible then you dont mess up your page layout if you put them here, its a good empty place... so whereever you put them just put them where it works for you.. but near the top of the page.

 

here is my layout to give you an idea..

 


<body>

{$headeroutput}
<div id="top_container">
 <div id="top">
   <div id="company_title">{$companyname}</div>

    <div id="welcome_box">{if $loggedin}{$LANG.welcomeback}, <strong>{$loggedinuser.firstname}</strong>   <img src="templates/{$template}/images/icons/details.gif" alt="{$LANG.clientareanavdetails}" width="16" height="16" border="0" class="absmiddle" /> <a href="clientarea.php?action=details" title="{$LANG.clientareanavdetails}"><strong>{$LANG.clientareanavdetails}</strong></a>   <img src="templates/{$template}/images/icons/logout.gif" alt="{$LANG.logouttitle}" width="16" height="16" border="0" class="absmiddle" /> <a href="logout.php" title="Logout"><strong>{$LANG.logouttitle}</strong></a>{else}{$LANG.please} <a href="clientarea.php" title="{$LANG.loginbutton}"><strong>{$LANG.loginbutton}</strong></a> {$LANG.or} <a href="register.php" title="{$LANG.clientregistertitle}"><strong>{$LANG.clientregistertitle}</strong></a>{/if}
  </div>
</div>
</div>

<!-- so this is where i put mine right after the 3 close divs -->


 

so now that we have the postion, lets put the code.

 

basically what this does (and youll understand better when you see the other file we will work on) is it physically puts the input tags on the page in the right place. And then we pass the values to the js to load the inputs.

 

The way they did it was they had a string "<input type=...........blah blah" and just stuck that in the header from their file. so we will fix that..

 

 

You have two values to be passed 'page value' and the 'script name'. I found the {literal} to be required but if yours it not working you might try without it but it should be ok..

 

 

what this js does is it pulls the values from a session strorage area that we store the values in, and it checks to see if the page is freshed it updates the value.

 

 



<!-- added for affiliate inputs -->

<div id="affcoupInput">
<input type="hidden" id="index_page" value="" />
<input type="hidden" id="script_name" value="" />
</div>

{literal}
<script type="text/javascript">

/* page value */

  var pagefield = document.getElementById("index_page");

 if (sessionStorage.getItem("couppage")) 
 {
  pagefield.value = sessionStorage.getItem("couppage");
  }

 pagefield.addEventListener("change", function() 
 {
 sessionStorage.setItem("couppage", pagefield.value);
 });

/* script name */

 var sname = document.getElementById("script_name");

if (sessionStorage.getItem("coupsname")) 
{
sname.value = sessionStorage.getItem("coupsname");
}

sname.addEventListener("change", function() 
{
 sessionStorage.setItem("coupsname", sname.value);
 });

</script>
{/literal}

<!-- end add -->

 

save your header.tpl

 

 

and then open whmcs/modules/addons/affcoupons/inc/clientarea.php

 

 

the original code looks like this

 


$return_html .= '<input type="hidden" id="index_page" value="' . parent::$index_page . '"/>';
$return_html .= '<input type="hidden" id="script_name" value="' . $vars['SCRIPT_NAME'] . '"/>';

 

since that runs right along with their other js above it thats why it all gets put in the header..

 

so we are going to comment that old code out and put some new code above it..

 

here is the finished replacement code

 

 

IMPORTANT!

 

your going to be working in the 'else' section... the first $return_html statement looks like this

 

$return_html = '<script type="text/javascript" src="' . AC_WHMCSe::get_module_url( 'affcoupons' ) . '/inc/js/affiliates.js"></script>';

 

LEAVE THAT ONE ALONE, dont mess with it... just do the changes below that one.

 

 

and here are the changes, this grabs those values and stores them so we can grab them when the header loads and the js runs.

 


 //added to fix the input in the header issue, there is also new js in the header tpl file
 $return_html .= '<script type="text/javascript"> 
 sessionStorage.setItem("couppage", "' . parent::$index_page . '");
 sessionStorage.setItem("coupsname", "' . $vars['SCRIPT_NAME'] . '");
 </script>';


  //old code not used - puts inputs in header does not pass w3c
  //$return_html .= '<input type="hidden" id="index_page" value="' . parent::$index_page . '"/>';
  //$return_html .= '<input type="hidden" id="script_name" value="' . $vars['SCRIPT_NAME'] . '"/>';


 

 

save it, thats it..

 

you can go back to your header if you want and change the inputs from hidden to text to see the values, click on some different pages to make sure it changes... and then set them back to hidden..

 

all done..

 

this one was a challenge, me and jquery are not buddies and honestly i tried several different ways to make this happen and no dice so i went back to old reliable normal js lol..

 

glad to help..

Edited by durangod

Share this post


Link to post
Share on other sites
How do I fix this:

http://prntscr.com/3v7904

 

to make it look like it does when here:

http://prntscr.com/3v795z

 

I use a custom theme.

 

As I mentioned in our emails back and forth, this is related to your theme and how it completely changed the div tag layout from the default setup. The next release will have a lot of fixes including an option to use Ajax to dynamically load, or use smarty template tag to output.

 

 

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...

 

Yes I agree the tags should use self closing syntax to be XHTML compliant as i'm guessing some people are using XHTML as their doctype. There are some issues with self closing tags in HTML5 but input is not one of them. I'll add this as an issue on GitHub and get it fixed in next release.

 

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

 

As for the screenshots, those were from a blank WHMCS install using the Default theme, I did not change anything on the actual install and it should have been using the Bootstrap 2 framework. Chances are they changed something in later releases so it's probably best to just integrate a framework myself or write my own CSS code as it wouldn't be much. I'll add this as an issue as well.

 

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

 

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.

 

Right now there is no way to do so, this is planned feature but I haven't had time to implement it yet, the original addon did not have this available so it has to be added from scratch.

 

Here's the existing feature/issue:

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

 

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

 

Yes, just like a regular promo code.

 

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?

 

You can use it however you want, it's actually just an easier way for your affiliates to give out instead of a link, because when you think about it, if someone has a promo code chances are they are def going to use it, when they do it's tied to the affiliate who gave it to them, so there's no worries about making sure they go to the right URL.

 

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.

 

This addon wasn't designed to automatically add menu items to your site, you will need to manually add a link if you want them to go to that page. That is the default WHMCS addon module page, right now it loads that DIV through Ajax and appends it to the bottom of the Affiliates page. As mentioned above in the next release I will add an option to use JS to automatically add it (like it is now), use custom smarty template variable, or just a button linking to it.

 

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

 

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?

 

That was is the sidebar link that still showing the demo HTML link. I just copied it out of the sample addon file and forgot to change it, will be fixed on next release.

 

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

 

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

 

Not sure what you mean, "list both if you can" ... list both what? If you're referring to updating the first post in this thread, that's not possible as unfortunately WHMCS has locked the thread so I can't edit it.

 

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.ph...-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

 

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.

 

Yes, this will be fixed in next release, I rewrote the entire codebase of this addon over a weekend when I found numerous security issues with the original version, so never got around to testing for valid HTML. Regarding the type="text/javascript" it is not required in HTML5 but for compatibility with HTML4/XHTML i will add it.

 

script type attribute:

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

 

header issues:

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

Share this post


Link to post
Share on other sites

1. As Affiliate option in WHMCS which can to Enable/Disable the Affiliate System, I also want to give the option to Enable/Disable the Landing Page feature on the Affiliate page in the Client Area.

 

2. I want to restrict members to make 1 Coupon Code for 1 Coupon Type.

They also can Edit the existing Coupon Code and they can Delete it.

 

I think this idea is needed by many people. I give thanks and appreciation for this job.

Share this post


Link to post
Share on other sites

Looking forward to the next release. The add-on does not show up on my affiliates.tpl page even when the code is added, but it does work if I go to the specific URL.

Share this post


Link to post
Share on other sites

Any idea on how to get this to work? The link: index.php?m=affcoupons, works properly. But if you go to the Affiliates link through WHMCS it does not show up on the bottom of the affiliates page like it is supposed to.

Share this post


Link to post
Share on other sites

I have the same problem... I posted on GitHub as well; hopefully we'll hear something soon.

 

Any idea on how to get this to work? The link: index.php?m=affcoupons, works properly. But if you go to the Affiliates link through WHMCS it does not show up on the bottom of the affiliates page like it is supposed to.

Share this post


Link to post
Share on other sites
The link: index.php?m=affcoupons, works properly. But if you go to the Affiliates link through WHMCS it does not show up on the bottom of the affiliates page like it is supposed to.

 

Yes, this bug also happens to my installation with WHMCS 5.3.10 and Affiliate Coupon v2.1.2.

 

 

My Lowatch may give some hint:

404 Not Found

/index.php?m=affcoupons: 33 Time(s)

 

- - - Updated - - -

 

coupon.PNG

 

Another minor bug. An extra irrelevant icon and link shown on the side bar.

 

- - - Updated - - -

 

The 3rd opinion from me is:

 

Hope to see a full multiple language support of this module! Thanks for your works! :idea:

Share this post


Link to post
Share on other sites

Hi,

 

Will this be updated to work with WHMCS v6.0? - As the new WHMCS affiliate system has anice look and feel, it would be great to integrate this plugins functionality with it.

Share this post


Link to post
Share on other sites
Hi,

 

Will this be updated to work with WHMCS v6.0? - As the new WHMCS affiliate system has anice look and feel, it would be great to integrate this plugins functionality with it.

 

Because the author is not often here in the forum, the question should be better placed on GitHub.

Share this post


Link to post
Share on other sites

Is any body interested in updating this for a few US$? I think we can post it on Elance for about US$20.

 

If 5 guys will pay, each of us will only pay $4 for this project. :idea:

 

 

About the ugly "Example" menu, please edit the file sidebar.php of this module.

Example ==> Affiliate Coupons

Then, delete the whole command line under it:

<li>......</li>

 

It will look very nice now. :idea:

Share this post


Link to post
Share on other sites

Looks like I have fixed it for 6.2.2

 

in

modules/addons/affcoupons/hooks.php

add

use WHMCS\Cookie;

 

and change

WHMCS_Cookie::get ---> Cookie::get

WHMCS_Cookie::set ---> Cookie::set

 

Now not show error messages and looks like working.

 

Test on your side

Share this post


Link to post
Share on other sites
Looks like I have fixed it for 6.2.2

 

in

modules/addons/affcoupons/hooks.php

add

use WHMCS\Cookie;

 

and change

WHMCS_Cookie::get ---> Cookie::get

WHMCS_Cookie::set ---> Cookie::set

 

Now not show error messages and looks like working.

 

Test on your side

 

bro , can help us for whmcs 6.3 ???

Share this post


Link to post
Share on other sites

This is great to hear! From the OP download link is this the only change required?

 

Looks like I have fixed it for 6.2.2

 

in

modules/addons/affcoupons/hooks.php

add

use WHMCS\Cookie;

 

and change

WHMCS_Cookie::get ---> Cookie::get

WHMCS_Cookie::set ---> Cookie::set

 

Now not show error messages and looks like working.

 

Test on your side

Share this post


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

  • Similar Content

    • By ModulesGarden
      1. WHMCS V7.8 Beta – Modules Compatibility

      It is a pleasure to let you guys know that we are ready for the V7.8 edition of your favorite web hosting management and billing software!

      Our Product Development Team will spare no effort to ensure that every single WHMCS module up for
      grabs on our Marketplace has been thoroughly tested in terms of a tip-top integration with this freshest WHMCS version. Even though the system is still in the beta stage, we managed to roll out several updates already. And still counting!
      Amazon EC2 For WHMCS - v1.1.0 DigitalOcean Droplets For WHMCS - v1.3.1 DirectAdmin Licenses For WHMCS - v1.1.5 EURid Registrar For WHMCS - v1.2.3 Password Manager For WHMCS - v2.2.7 Quotes Automation For WHMCS – v2.0.4 Report Generator For WHMCS - v4.0.1 Unban Center For WHMCS - v2.2.1 Zimbra Email For WHMCS - v1.5.3 Keep an eye on more compatibility labels coming soon!


      2. Netcetera Case Study - EasyDCIM

      While focused on growth, companies tend to overlook the impact their actions may have on the environment around. Data centers, for example, consume a lot of energy and most probably this trend will not shift any time soon.

      But does it have to be that way? EasyDCIM carried out an in-depth case study of a certain company that provides 100% carbon neutral hosting solutions without losing a bit on the service quality.

      Tread the same path to maximum business optimization!


      3. DirectAdmin software 15% OFF

      What do you love summertime for the most? We personally enjoy the chance to pamper our clients with ever hotter deals. And here is one to keep you warm throughout the entire August!
      Choose between our standalone modules for WHMCS integrated with DirectAdmin and save 15% on every single item picked with the code: 15%DirectAdmin Got a taste for more individualized software? Get in touch and have your dream solution for DirectAdmin developed at -15% of the price too! Make summer all about new business opportunities!


      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!
    • By ModulesGarden
      1. GoGetSSL For WHMCS - NEW
      Welcome another trailblazing and FREE software in the ranks of our modules - GoGetSSL For WHMCS!
      With this functional tool you will be enabled to supply fully configurable SSL certificates to your clientele and do this all right inside your WHMCS! You will be offered the capability to create new certificates as well as perform all basic operations on the already existing ones (terminating, renewing or modifying). 
      As for your audience, they too will be given all features needed to order new certificates with specific properties and later on view their details in your client area. 
      Download the module from our website with a few simple clicks!
       
      2. SMS Center For WHMCS 3.4.0
      A pleasure to announce that this customer-centered module has been featured with rock-solid support for as many as four new SMS gateways!
      The extra choice you have been given is that of: Hajana One, MEDIA SAT, SMSpubli, plus SMSAPI.pl. This makes the official list of available SMS gateways to include 29 providers in total. Additionally, you are welcome to sign up  to the SMSAPI.pl provider and receive on preferential terms an exclusive bonus from ModulesGarden. 
      Learn more about SMS Center For WHMCS 3.4.0!
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
      Still missing your favorite SMS gateway in the module? We can change that! Order SMS Center For WHMCS through our website, open a ticket with the details and we will develop your dream integration for free. Simple as that! 
       
      3. Unban Center For WHMCS 2.2.0
      This update empowers your clients to unban any IP addresses blocked through Imunify360 from their cPanel directly. Also, they will now be informed via email about each IP address automatically unbanned after logging in to the WHMCS client area.
      Learn more about Unban Center For WHMCS 2.2.0!
       
      4. EasyDCIM Dedicated Servers For WHMCS 1.6.0
      The 1.6.0 release opens up for you and your audience a set of new possibilities. Find among them: graph presenting total traffic from all of the client’s devices, support for "Blade" server model, plus useful information in WHMCS client area on most crucial server details including current operating system and its status. There is more!
      Learn all about EasyDCIM Dedicated Servers For WHMCS 1.6.0!
       
      4. 20% Off Open Source Software
      Recently we launched a one-off promotion on all new open source modules for WHMCS. Now we are extending it to license upgrades as well!
      Do you already own an annual license of our modules and would like to perform a quick upgrade to the open source version? You can do it easily on your own, with just a few clicks! Plus, the newly generated invoice will already contain all discounts applicable, including the exclusive 20% price cut.
      Switch into the unencrypted software for 20% less!
       
      5. 15% Off DirectAdmin Software
      Looking for a reliable web hosting control panel in some reasonable pricing? Be sure to profit from our summer promotion on all kinds of software tools aimed at DirectAdmin!
      The time-limited 15% discount applies to:
       

      All custom projects and services dedicated to DirectAdmin Two modules integrating the DirectAdmin control panel with WHMCS: DirectAdmin Extended For WHMCS and DirectAdmin Licenses For WHMCS All modules equipped with DirectAdmin support: DNS Manager For WHMCS, Advanced Billing For WHMCS, IP Manager For WHMCS, WordPress Manager For WHMCS and many more

      Preview the full list of discounted items!
       
      6.  Account Synchronization For WHMCS – Your Thoughts
      Are there any current or potential users of our Account Synchronization For WHMCS module here? 
      We have just created a brief survey to pick your brains on its features – which ones bring you the biggest benefits and which could be replaced or modified for greater utility. 
      Help us create the software of your dreams!
       
      7. Explore also our other recent releases:

      Product Cross-Selling For WHMCS - NEW Domains Reseller For WHMCS - v2.0.2 Password Manager For WHMCS - v2.2.6 Quotes Automation For WHMCS - v2.0.3 Zendesk For WHMCS - v2.1.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!
    • By ModulesGarden
      Summer greetings from the ModulesGarden team! 
      We would like to invite you to our energizing promotion dedicated to all modules and custom projects related to DirectAdmin!

      Join now and get 15% off your bespoke software plus such popular modules supporting DirectAdmin as:
      - DirectAdmin Extended For WHMCS
      - DirectAdmin Licenses For WHMCS
      - DNS Manager For WHMCS
      - WordPress Manager For WHMCS
      - Advanced Billing For WHMCS

      Cannot wait to view the full list and grasp this amazing opportunity?
      Leap into our Blog article: https://www.blog.modulesgarden.com/directadmin-summer-promotion
    • By HarryAdney
      Hi guys,
      Quick question, when testing out an affiliate link the page redirects straight to my home page, i.e. clicking on https://domain.com/*?aff=1 redirects straight to https://domain.com. Is this correct?
      Cheers,
       
      Martin
    • By ModulesGarden
      1. May Promotion
      Let us start today’s news with something that everyone loves the most – discounts! 
      This time we would like to offer you one deal in particular – enormous 20% price cut on both annual licenses and open source products for WHMCS, cPanel, Blesta and more. 
      Grab the promo code and use it well before 1st June!
       
      2. Hetzner VPS For WHMCS
      Excited about the idea of supplying Hetzner virtual machines to your audience from WHMCS directly, and in a completely automated manner? Who wouldn’t be, especially now that such a convenient solution is perfectly within your reach! 
      After ordering a machine most suited to their needs, your clients will be able to control its status, rebuild it with selected OS distribution, plus access remote console and much more.  
      For the specifics you should definitely visit the product’s dedicated page. 
      Learn more about Hetzner VPS For WHMCS!
       
      3. GoDaddy Domain Registrar For WHMCS 3.3.0 - in this module update we added the possibility to choose between two alternative ways of activating the registrar. You can use either GoDaddy's dedicated reseller account or a normal user account, depending on you personal preferences. 
      Learn more about GoDaddy Domain Registrar For WHMCS 3.3.0!
       
      4. MetricsCube Update
      MetricsCube is an undoubted leader in the field of professional business analysis. 
      And recently, a hefty update of this tool was pushed to live, supplying company owners with some extra tools. Most importantly, you have been offered the possibility to export desired reports to PDF, CSV and XLS files, choose between two novel LTV reports, and get the application ready for use even faster than before! 
      Check the release notes and get a 14-day free trial!
       
      5. Be sure to explore the list of our latest releases!  

      Client Area Popup For WHMCS - v1.2.2 cPanel Extended For WHMCS - v3.5.1 CRM For WHMCS - v2.5.4 DirectAdmin Extended For WHMCS - v3.1.2 Domains Reseller For WHMCS - v2.0.1 IP Manager For WHMCS - v2.5.3 Plesk Key Administrator For WHMCS - v1.3.1 Support Tickets Allocator For WHMCS - v1.3.1 Virtuozzo VPS For WHMCS - v1.4.1 WordPress Manager For WHMCS - v1.3.2 Zendesk For WHMCS - v2.1.2 Zimbra Email For WHMCS - v1.5.2


      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.

×

Important Information

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