|
I am using Magento version 1.2.1.1. By dropping this code into “/app/etc/modules” I am able to update the Customer Group during registration. (Actually, I added it to MyCompany_All.xml at the global level.)
<?xml version="1.0"?> <config> <global> <fieldsets> <customer_account> <group_id><create>1</create><update>1</update></group_id> </customer_account> </fieldsets> </global> </config>
That is all it took. I can now allow the user to select to be included in the Members Group by adding this checkbox to “app/design/frontend/default/my_default_theme/template/customer/form/register.phtml”:
<li> <input type="checkbox" name="group_id" id="group_id" value="4" title="<?php echo $this->__('Membership') ?>" <?php if($this->getFormData()->getGoupId() == 4): ?>checked="checked"<?php endif ?> /> <label for="group_id"><?php echo $this->__('I wish to take advantage of Member Discount Pricing') ?></label> </li>
This works just fine.
But, I would like to give the customer a second chance to join the Members Group if they didn’t selct it at registration.
Placing this code in “app/design/frontend/default/my_default_theme/template/customer/form/edit.phtml” under Edit Account Information does not work:
<li> <input type="checkbox" name="group_id" id="group_id" value="4" title="<?php echo $this->__('Membership') ?>" <?php if($this->getCustomer()->getGroupId() == 4): ?>checked="checked"<?php endif ?> /> <label for="group_id"><?php echo $this->__('I wish to take advantage of Member Discount Pricing') ?></label> </li>
I am able to read the group_id with getGroupId(), but the checkbox does not update the database.
I know that the two forms are different, register.phtml uses “/customer/account/createpost/” and edit.phtml uses “customer/account/editPost”. So, obviously I have more work to do to add this field to the form.
Does anyone know how to allow an existing customer to select the Customer Group from a checkbox once they have already created their account?
|