Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

error: call non objective function setData in model
 
Bostwicksurya
Jr. Member
 
Total Posts:  10
Joined:  2013-04-25
 

i have make a model for save data from admin form, but it give “error: call non objective function setData “

My code is:

static protected $_singletonFlag false;
 
    
/**
     * This method will run when the product is saved from the Magento Admin
     * Use this function to update the product model, process the
     * data or anything you like
     *
     * @param Varien_Event_Observer $observer
     */
    
public function saveProductTabData(Varien_Event_Observer $observer)
    
{
        
if (!self::$_singletonFlag{
            self
::$_singletonFlag true;
             
            
$product $observer->getEvent()->getProduct();
$data = array('customer_id'=>2,'product_id'=>3); 
             
Mage::app();
             
$model Mage::getModel('Customtabs/catalog_customer_product')->setData($data);
         
            try 
{
              
                
//$customFieldValue =  $this->_getRequest()->getPost('product_cutomers');
 
               
                
$model>save();
            
}
            
catch (Exception $e{
                Mage
::getSingleton('adminhtml/session')->addError($e->getMessage());
            
}

Any one can tell me what is wrong in this code.

Thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top