Digital products registration form at checkout
Hi my store is selling digital music, https:www.danielsanchezmusica.com I have some digital music for free, but when people go to checkout the option for registering as a new user is able with all the form for billing information, since the store is configured for simple registration and the product is free, I will like to supress from the checkout page the the billing info form. I managed to do it like this (please tell me if there is a better way to do it):
In the checkout_form.php file I put the billing information form between this conditional :
<?php if ($WA_Store_Cart->GrandTotal() > 0) { // show if product is not free ?>
<?php } // end conditional show if product is not free ?>
then at the bottom of the page I used the same conditional for the spry validation:
<?php if ($WA_Store_Cart->GrandTotal() > 0) { // show if product is not free ?>
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "none", {validateOn:["blur"]});
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {validateOn:["blur"]});
var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "none", {validateOn:["blur"], maxChars:20, minChars:7});
var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "none", {validateOn:["blur"], minChars:7, maxChars:20, isRequired:false});
var sprytextfield10 = new Spry.Widget.ValidationTextField("sprytextfield10", "none", {validateOn:["blur"]});
var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11", "none", {validateOn:["blur"]});
var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12", "none", {validateOn:["blur"], minChars:1, maxChars:10});
var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {validateOn:["blur"]});
<?php } // end conditional show if product is not free ?>
Then in the process_transaction.php file I used this conditional to stop the server validation on line 183:
if ($WA_Store_Cart->GrandTotal() > 0) { // show if product is not free
$WAFV_Errors .= WAValidateRQ(((isset($_POST["firstname"]))?$_POST["firstname"]:"") . "",true,12);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["lastname"]))?$_POST["lastname"]:"") . "",true,13);
$WAFV_Errors .= WAValidatePN(((isset($_POST["phone"]))?$_POST["phone"]:"") . "",false,true,true,14);
$WAFV_Errors .= WAValidatePN(((isset($_POST["fax"]))?$_POST["fax"]:"") . "",false,true,false,15);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["street1"]))?$_POST["street1"]:"") . "",true,16);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["city"]))?$_POST["city"]:"") . "",true,17);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["postcode"]))?$_POST["postcode"]:"") . "",false,19);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["country"]))?$_POST["country"]:"") . "",true,20);
} // end conditional show if product is not free
Is there a better and simplest way to do it?
Thank you.