I have an installation with 20 products. 10 products are electronic (ie. online only) and 10 products are physical (ie. require shipping a product to the customer). I would like to only display the address fields on the signup form if the user is purchasing a physical product. Any suggestions on how to do this? A change to the signup form? If so, any code examples you can share?
Try to add this to signup.php after config.inc.php include: PHP: if($_REQUEST['price_group'] == -1) $config['use_address_info'] = 0; this should disable address fields for signup form with price_group =-1
Thanks Alexander, was hoping to be able to do this via plugin but this certainly does the trick. Is there a similar method by which I can disable field validation for address fields on a price_group by price_group basis? Using the above code hides the address fields from the signup page, but when "use address" in admin is set to required (for when a price group requires it) AND the fields are hidden (using the above technique) the user is given an error that the fields need to be filled out (despite not being displayed)
To disable validation change member.inc.php PHP: function vsf_address($vars, $is_signup = true){ $err = array(); if (is_field_can_be_changed('street', $is_signup) && $vars['street'] == '') $err[] = _SIGNUP_ENTER_STREET; if (is_field_can_be_changed('city', $is_signup) && $vars['city'] == '') $err[] = _SIGNUP_ENTER_CITY; if (is_field_can_be_changed('state', $is_signup) && ($vars['country'] == 'US' || $vars['country'] == 'CA') && ($vars['state'] == '')) $err[] = _SIGNUP_ENTER_STATE; if (is_field_can_be_changed('zip', $is_signup) && $vars['zip'] == '') $err[] = _SIGNUP_ENTER_ZIP; if (is_field_can_be_changed('country', $is_signup) && $vars['country'] == '') $err[] = _SIGNUP_ENTER_COUNTRY; return $err;} to PHP: function vsf_address($vars, $is_signup = true){ $err = array(); if($GLOBALS[config][use_address_info] != 1) return; if (is_field_can_be_changed('street', $is_signup) && $vars['street'] == '') $err[] = _SIGNUP_ENTER_STREET; if (is_field_can_be_changed('city', $is_signup) && $vars['city'] == '') $err[] = _SIGNUP_ENTER_CITY; if (is_field_can_be_changed('state', $is_signup) && ($vars['country'] == 'US' || $vars['country'] == 'CA') && ($vars['state'] == '')) $err[] = _SIGNUP_ENTER_STATE; if (is_field_can_be_changed('zip', $is_signup) && $vars['zip'] == '') $err[] = _SIGNUP_ENTER_ZIP; if (is_field_can_be_changed('country', $is_signup) && $vars['country'] == '') $err[] = _SIGNUP_ENTER_COUNTRY; return $err;}
Thanks again Alexander. This works great. In the future it would be ideal if there was a way to do this via plugin to prevent modification to core code.
I was also going to update my amShipping plugin to add a screen before the thank you page to display the address and ask them to fill it in or confirm it is correct (if they are returning customers). But this information is helpful. As long as you only put your physical products in negative price groups and let them have their own signup urls this will work nicely.