Is it possible to set up a product that can ONLY be purchased by a coupon code? My perfect setup would be.... Product a: free signup... limited access to site (no problems setting up) Product b: 3 months membership to site bought with paypal (again no probs) product c: Date ended membership available only to 'club' members paid for by a unique coupon. Maybe implementation of option 3 is staring me in the face, but short of making an unreasonably high high price with a 100% discount, I cannot see it. Any help would be gratefully appreciated
Why not post the mod for everyone to take a look at. Maybe there's someone else who might like to do the same.
in signup.php add PHP: if(($vars[product_id] == 3) && !$vars[coupon]){ $error [] = 'You must have a VALID coupon code for this product'; } where 3 was my product id.
figured it out. you can see the code in the middle down here. i added the requirement for 3 different products: if (!strlen($vars['pass0'])){ $error[] = _SIGNUP_PLEASE_ENTER_PSWD; } elseif (strlen($vars['pass0']) < $config['pass_min_length']){ $ll = $config[pass_min_length]; $error[] = sprintf(_SIGNUP_INVALID_PASS_1,$ll); } if ($vars['pass0'] != $vars['pass1']){ $error[] = _SIGNUP_INVALID_PASS_2; } if(($vars[product_id] == 3) && !$vars[coupon]){ $error [] = 'You must have a VALID coupon code for this product'; } if(($vars[product_id] == 4) && !$vars[coupon]){ $error [] = 'You must have a VALID coupon code for this product'; } if(($vars[product_id] == 5) && !$vars[coupon]){ $error [] = 'You must have a VALID coupon code for this product'; } $error = array_merge($error, plugin_validate_signup_form($vars)); return !count($error); } ############################################################################### # SHOW_PAYMENT_FORM # # get vars from database and plugins # display $GLOBAL[error] if it set # substitute previous entered parameters using Smarty # function show_payment_form(){
Bo this doesn't work for amember v4. Here is how you can add such validation: http://www.amember.com/docs/How_to_add_special_validation_for_some_fields_on_signup_form
Will this be in effect for every signup form? What if we have created a special signup form for this particular product? The form is only accessible via a 'secret' URL. We want to share that link with some people and allow them free and instant access via a coupon code.
yes this hook will be applied to all forms. But inside your hook you have an access to $form object so can check it type etc...
Thank you. Does this mean I can add the form's 'secret code' to the site.php file to make the validation only apply to it? Where does it go if so? And is making the coupon field the one to validate as simple as changing 'email' in your linked example to 'coupon'?