Hello Everyone

I am new to Magento and have been having trouble performing basic CRUD
operations , specifically Update..

The Scenario

There are two radio buttons (ON, OFF) when a user clicks the off button it he should be moved to the General customer group in the db
Likewise when the user clicks ON he should be moved to the Auto customer group in the db

NOTE: these operations need to happen on the user click

The Code
view.phtml located /magento/app/design/frontend/default/MAGXXXXX/template/autorefill

<form action="???" method="post">
    <input type="radio" name="auto-refill" value="On" onClick = "<?php echo Mage::getUrl('test/index/save') ?>" />On<br>
    <input type="radio" name="auto-refill" value="Off" onClick = "???" />Off

AutoFillUpdate.php located /magento/app/code/local/AppName/AutoFillUpdate/Model


class AppName_AutoFillUpdate  {
} ?>

IndexController.php located in /magento/app/code/local/Custom123Recycle/AutoFillUpdate/controllers

class Custom123Recycle_AutoFillUpdate extends Mage_Core_Controller_Front_Action

  public function indexAction()

  public function saveAction()
    //Might be where update customer group should happen

   $customer = Mage::getSingleton('customer/session')->getCustomer();
   $groupId = $customer->getGroupId();
   $group = Mage::getModel('customer/group')->load($groupId);
   $groupCode = $group->getCode();

 if (groupCode == 'General')



What I Know

I was told in order to manipulate the db I would need
to create a new module which I have done its called AutoFillUpdate which resides in /magento/app/code/local/AppName/AutoFillUpdate

Inside this folder is are the basic Magento folders (Block, Helper, Model, controllers, etc, sql)

Points of Confusion

I am interested in updating the customer DB..so I would think I would be okay getting the module using Mage:getModel('customer/session') and then just updating that specific customer if they click the button, Why would I need to create a new module if the customer that has the db resides in core ? OR am I mistaken..

I am confused on how to my created module links with the view.phtml template

What value/string should go in the form action & onClick elements in view.phtml

Should the update functionality happen inside the controller indexController.php?

Would implementing listeners be more suitable ?

Any guidance of any complexity is welcomed, Thanks in advance

closed as too broad by Anna Völkl, Marius Jan 8 '15 at 21:09

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • could you please add information, how much you know about javascript, javascript events and doing ajax requests? – Flyingmana Dec 22 '14 at 1:41
  • @Flyingmana I know I good amount of javascript, havent heard of javascript events and have done limited work with ajax requests – Rstack Dec 22 '14 at 2:08