0

I have created a admin page with grid for listing the content from a custom table. The data is displaying correctly. Now i need to add edit functionality.

I have added the code for showing the edit page in Grid.php

<?php
class Buildnext_Producteditrequest_Block_Adminhtml_Producteditrequest_Grid 
      extends Mage_Adminhtml_Block_Widget_Grid
{
    public function __construct()
    {
        parent::__construct();
        $this->setId('producteditrequestGrid');
        // This is the primary key of the database
        $this->setDefaultSort('pdt_edit_id');
        $this->setDefaultDir('ASC');
        $this->setSaveParametersInSession(true);
    }

    protected function _prepareCollection()
    {
        $collection = Mage::getModel('producteditrequest/producteditrequest')
        ->getCollection()-> addCustomerNameToSelect();


        //echo $collection->getSelect();
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

    protected function _prepareColumns()
    {
        $this->addColumn('pdt_edit_id', array(
                'header'    => Mage::helper('producteditrequest')->__('ID'),
                'align'     =>'right',
                'width'     => '50px',
                'index'     => 'pdt_edit_id',
        ));

        $this->addColumn('product_code', array(
                'header'    => Mage::helper('producteditrequest')->__('Product Code'),
                'align'     =>'right',
                'width'     => '50px',
                'index'     => 'product_code',
        ));

        $this->addColumn('fullname', array(
            'header' => Mage::helper('producteditrequest')->__('Seller'),
            'align' =>'left',
            'index' => 'seller_id',
            'format' => '$fullname'
        ));

        $this->addColumn('action',
                array(
                        'header'    => Mage::helper('producteditrequest')->__('Action'),
                        'width'     => '50px',
                        'type'      => 'action',
                        'getter'     => 'getId',
                        'actions'   => array(
                                array(
                                        'caption' => Mage::helper('producteditrequest')->__('View'),
                                        'url'     => array(
                                                'base'=>'*/*/edit',
                                        ),
                                        'field'   => 'pdt_edit_id'
                                )
                        ),
                        'filter'    => false,
                        'sortable'  => false,
                        'index'     => 'pdt_edit_id',
                ));

        return parent::_prepareColumns();
    }

    public function getRowUrl($row)
    {
        return $this->getUrl('*/*/edit', array('id' => $row->getId()));
    }
}

When i click on a row to edit. I'm getting following error.

Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found  in /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/opt/lampp/htdo...', 450, Array)
#1 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Model/Layout/Update.php(450): simplexml_load_string('/**\n * Buildnex...', 'Mage_Core_Model...')
#2 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Model/Layout/Update.php(275): Mage_Core_Model_Layout_Update->getFileLayoutUpdatesXml('frontend', 'buildnext', 'brick', '1')
#3 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Model/Layout/Update.php(347): Mage_Core_Model_Layout_Update->fetchFileLayoutUpdates()
#4 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Model/Layout/Update.php(246): Mage_Core_Model_Layout_Update->fetchPackageLayoutUpdates('default')
#5 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Model/Layout/Update.php(224): Mage_Core_Model_Layout_Update->merge('default')
#6 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(306): Mage_Core_Model_Layout_Update->load()
#7 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Cms/Helper/Page.php(109): Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
#8 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
#9 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
#10 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->noRouteAction()
#11 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
#12 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /opt/lampp/htdocs/buildnext/marketplace/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#14 /opt/lampp/htdocs/buildnext/marketplace/magento/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#15 /opt/lampp/htdocs/buildnext/marketplace/magento/index.php(87): Mage::run('', 'store')
#16 {main}

Is there any additional configuration file that i need to add. Also is there a good tutorial for creating edit page.

1 Answer 1

1

The error you are getting has nothing todo with the code you showed.

As it says, a layout xml update cannot be parsed.

In your extension, you would have defined a layout update xml file. Your problem is with that file and malformed xml.

Don't literally expect a missing < (but could be) You can, for example, have a missing closing " somewhere.

Good luck.

1
  • Great. Please accept answrrs if they solved the issue. Helps with stck stats.
    – ProxiBlue
    Commented Feb 8, 2016 at 6:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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