0

I have 3 customer groups and my store already sets the customer to their group automaticly. What I'm trying to do is allow the customer in group 2 change their group to 3 (and vice-versa) clicking a button in the cart page. Is it possible? I'm trying to use:

$customer = Mage::getSingleton('customer/session')->getCustomer();
$customer->setData( 'group_id', 3 );
$customer->save();

But how can I save this changes?

I'm using version 1.9.3

0
  1. You have to create a controller then you put your code inside.

  2. You call your controller in a button like this: $this->getUrl('modulefontname/modulename/action');

  3. Your button should look like this:

    <button type="button" onclick="setLocation('<?php echo Mage::getUrl('modulefontname/modulename/action'); ?>')"><?php echo $this->__('Change customer group') ?></button>
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.