checkout - magento changing customer group of guest user -


i have custom field in onepage checkout, used in model\observer.php set customer group using following:

$customer = mage::getsingleton("customer/session")->getcustomer(); $customer->setgroupid($newgroupid)->save(); 

this works great, , i'm doing change tax in cart.

however, people checking out guest throws error:

customer email required 

is there way of setting customer group guest, second not logged in group example?

check user session set customer email address.

  $session = mage::getsingleton('customer/session');     $customer = $session->getcustomer();     if($session->isloggedin()) {        $customer->setgroupid($newgroupid)->save();     } else {        $customer->setemail($customer->getdata('email'));       $customer->setgroupid('2'); // assuming 'guest' groupd id 2      $customer->save();   }   

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -