Jump to content

Promotions/Coupons


Recommended Posts

So pretty much what I need to do is create around 200 one-use coupon codes, each unique and one-use, so that I may give one person two codes, (or 10) and they may use all 10 codes, but the same code cant be used twice.

 

I have seen add-ons that do this, but they all cost money, and I have used all my money.

 

Thanks!

Link to comment
Share on other sites

If you know php and mysql you could write a script to do this by inserting records into the tblpromotions table. Here is an example script I wrote awhile back to generate 10% off recurring promo codes for a list of product ids to get you started:

 

require("dbconnect.php");
require("includes/functions.php");

for ($i = 1; $i <= 200; $i++) {
 $promo_code = generateRandomString(;
 $value = "10";
 $products = "1,4,9,52,53,56,58,60";
 $exp_date = "2013-09-30";

 print $promo_code . ' ';

 $results = insert_query("tblpromotions", array("code" => $promo_code, "type" => "Percentage", "recurring" => 1, "value" => $value, "cycles" => "Monthly,Quarterly,Semi-Annually,Annually","appliesto" => $products, "requires" =>"","requiresexisting"=> 0, "startdate" => "0000-00-00","expirationdate" => $exp_date, "maxuses" => 1,"applyonce" => 1, "newsignups"=>0, "existingclient" =>0, "onceperclient" => 1, "recurfor" => 0, "upgrades" =>0, "upgradeconfig" => "", "notes"=> ""));



}
function generateRandomString($length =  {
   $characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   $randomString = '';
   for ($i = 0; $i < $length; $i++) {
       $randomString .= $characters[rand(0, strlen($characters) - 1)];
   }
   return $randomString;
}

 

If you don't know php then I would recommend purchasing this addon for $15, I haven't tried it but it looks like it does what you are wanting to do.

https://www.whmcs.com/appstore/2290/Bulk-Promotion-Code-Generator.html

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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