getConnection('core_write'); // retrieve points $cust_id = $this->getId(); $new_cust_points = 50; if (!$cust_id){ $write->insert('points', array('cust_id'=>$cust_id, 'points'=>$new_cust_points)); } $this->getResource() ->loadAllAttributes() ->save($this); return $this; } }