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

Playlist-Modul - Probleme mit neuem Element
 
Christian Philipp
Jr. Member
 
Total Posts:  10
Joined:  2008-10-17
Aachen, Germany
 

Aloha Leutz,

ich entwickle gerade ein Modul für Magento um Playlisten (für CDs o. ä.) darstellen zu können.
Jetzt scheitere ich leider gerade schon an den einfachsten Sachen.
Wenn ich ein neues Element, also eine neue Playlist im Backend anlegen möchte, bekomme ich diese Fehlermeldung:

Fatal error: Call to a member function setData() on a non-object in /data/virtual/magento/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 129

Das hier ist mein Controller (adminController.php):

<?php
class Inmedias_Playlist_AdminController extends Mage_Adminhtml_Controller_Action
{
    
public function indexAction()
    
{
        $this
->loadLayout()
            ->
_addContent($this->getLayout()->createBlock('playlist/admin_main'))
            ->
renderLayout();                                    
    
}
    

    
public function newAction() // Create new element
    
{
        $id     
$this->getRequest()->getParam('id');
        
$model  Mage::getModel('playlist/playlist')->load($id);
        
        
$data Mage::getSingleton('adminhtml/session')->getFormData(true);
        if (!empty(
$data)) {
            $model
->setData($data);
        
}

        Mage
::register('playlist_data'$model);        
        
        
$this->loadLayout();
        
$this->_setActiveMenu('playlist');
        
$this->_addContent($this->getLayout()->createBlock('playlist/admin_edit'));
        
$this->renderLayout();
    
}

das hier ist meine edit.php:

<?php
class Inmedias_Playlist_Block_Admin_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
    
public function __construct()
    
{

        parent
::__construct();
 
        
$this->_blockGroup 'playlist';
        
$this->_mode 'edit';
        
$this->_controller 'admin';
 
        if( 
$this->getRequest()->getParam($this->_objectId) ) {
            $playlistData 
Mage::getModel('playlist/playlist')
                ->
load($this->getRequest()->getParam($this->_objectId));
            
Mage::register('frozen_playlist'$playlistData);
        
}
    }
 
    
public function getHeaderText()
    
{
        
return Mage::helper('playlist')
          ->
__("New/Edit Element");
           
    
}
}

und das hier ist meine form.php

<?php
class Inmedias_Playlist_Block_Admin_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
    
protected function _prepareForm()
    
{
        $form 
= new Varien_Data_Form(array(
            
'id'        => 'edit_form',
            
'action'    => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
            
'method'    => 'post'
        
));

        
$fieldset $form->addFieldset('edit_playlist', array('legend' => Mage::helper('playlist')->__('Element Details')));
 
        
$fieldset->addField('name''text', array(
            
'name'      => 'name',
            
'title'     => Mage::helper('playlist')->__('Name'),
            
'label'     => Mage::helper('playlist')->__('Name'),
            
'maxlength' => '50',
            
'required'  => true,
        ));
 
        
$fieldset->addField('xml_filename''text', array(
            
'name'      => 'tags',
            
'title'     => Mage::helper('playlist')->__('Xml_filename'),
            
'label'     => Mage::helper('playlist')->__('Xml_filename'),
            
'maxlength' => '255',
            
'required'  => true,
        ));

        
$form->setUseContainer(true);
        
//$form->setValues(Mage::registry('frozen_playlist')->getData());
        
$this->setForm($form);
        return 
parent::_prepareForm();
    
}
}

Hat irgendjemand eine Idee, was ich da falsch mache?
Danke!
c

 
Magento Community Magento Community
Magento Community
Magento Community
 
ma-enzo
Jr. Member
 
Total Posts:  4
Joined:  2009-06-16
Germany
 

Hallo Christian,

hast du das Problem gelöst? Oder vielleicht jemand anderes hier im Forum? Ich stehe gerade ratlos vor der gleichen Fehlermeldung, ich will will auch in einem eigenen Modul eine neue insert-operation erstellen und komme überhaupt nicht weiter.

danke im voraus,
larissa

 
Magento Community Magento Community
Magento Community
Magento Community
 
IngGross_de
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2009-03-18
Switzerland
 

Hi

hier hatte ich einen Lösungsansatz gepostet:
http://www.magentocommerce.com/boards/viewthread/56955/

viel Erfolg!

Gruß
Res

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