Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8614949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:14:59+00:00 2026-06-12T05:14:59+00:00

I have all the necessary files and structures in order to handle CRUD operations

  • 0

I have all the necessary files and structures in order to handle CRUD operations on a table I have added on the database. On the Edit.php file I have the getHeaderText() function that modifies the header that will appear on the edit page when either modifying or adding new set of values to the table.

The problem I’m having is that when the following code is evaluated:

if (Mage::registry('allpages_data')  && Mage::registry('allpages_data')->getId())

It always return NULL so always shows New reference text on the header. Checked and when I’m editing it correctly edits the current set of values and when adding new it adds a new set. Tried several solutions and none worked.

2nd EDIT
Here is my allpages_data var_dump:

object(Dts_Allpages_Model_Referencedpages)[412]
  protected '_eventPrefix' => string 'core_abstract' (length=13)
  protected '_eventObject' => string 'object' (length=6)
  protected '_resourceName' => string 'allpages/referencedpages' (length=24)
  protected '_resource' => null
  protected '_resourceCollectionName' => string 'allpages/referencedpages_collection' (length=35)
  protected '_cacheTag' => boolean false
  protected '_dataSaveAllowed' => boolean true
  protected '_isObjectNew' => null
  protected '_data' => 
    array
      empty
  protected '_hasDataChanges' => boolean false
  protected '_origData' => null
  protected '_idFieldName' => string 'referencedpages_id' (length=18)
  protected '_isDeleted' => boolean false
  protected '_oldFieldsMap' => 
    array
      empty
  protected '_syncFieldsMap' => 
    array
      empty

Here is my Edit.php code file, with the getHeaderText function:

<?php
class Dts_Allpages_Block_Adminhtml_Allpagesbackend_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
    public function __construct(){
        parent::__construct();

        $id = $this->getRequest()->getParam('id');
        $this->_objectId = 'id';
        $this->_blockGroup = 'allpages';
        $this->_controller = 'adminhtml_allpagesbackend';
        $this->_mode = 'edit';

        $this->_addButton('save_and_continue', array(
                'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
                'onclick' => 'saveAndContinueEdit()',
                'class' => 'save',
        ), -100);

        $this->_updateButton('save', 'label', Mage::helper('allpages')->__('Save reference'));

        $this->_formScripts[] = "
                        function toggleEditor() {
                            if (tinyMCE.getInstanceById('form_content') == null) {
                            tinyMCE.execCommand('mceAddControl', false, 'edit_form');
                                } else {
                                    tinyMCE.execCommand('mceRemoveControl', false, 'edit_form');
                                    }
                                }

                        function saveAndContinueEdit(){
                            editForm.submit($('edit_form').action+'back/edit/');
                        }
                ";
    }

    public function getHeaderText()
    {
        if (Mage::registry('allpages_data')  && Mage::registry('allpages_data')->getId()){
            return Mage::helper('allpages')->__('Edit reference');
        } else {
            return Mage::helper('allpages')->__('New reference');
        }
    }

    protected function _prepareLayout()
    {
        if ($this->_blockGroup && $this->_controller && $this->_mode) {
            $this->setChild('form', $this->getLayout()->createBlock($this->_blockGroup . '/' . $this->_controller . '_' . $this->_mode . '_form'));
        }
        return parent::_prepareLayout();
    }
}

And here is my Form.php file code:

<?php
class Dts_Allpages_Block_Adminhtml_Allpagesbackend_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
    protected function _prepareForm()
    {
        $id = $this->getRequest()->getParam('id');
        $params = array('id' => $this->getRequest()->getParam('id'));

        if (Mage::getSingleton('adminhtml/session')->getdata())
        {
            $data = Mage::getSingleton('adminhtml/session')->getdata();
            Mage::getSingleton('adminhtml/session')->getdata(null);
        }
        elseif (Mage::registry('allpages_data'))
        {
            $data = Mage::registry('allpages_data')->getdata();
        }
        else
        {
            $data = array();
        }

//      $entireregistryArray = Mage::getRegistry();
//      var_dump($entireregistryArray);

        $form = new Varien_Data_Form(
                array(
                        'id' => 'edit_form',
                        'action' => $this->getUrl('*/*/save', $params),
                        'method' => 'post',
                        'enctype' => 'multipart/form-data',
                    )
                );

        $form->setUseContainer(true);
        $this->setForm($form);

        $fieldset = $form->addFieldset('allagesbackend_form', array(
                                'legend' =>Mage::helper('allpages')->__('References pages Information')
                            )
                    );

        $fieldset->addField('current_url', 'text', array(
                        'label'     => Mage::helper('allpages')->__('Url'),
                        'class'     => 'required-entry',
                        'required'  => true,
                        'name'      => 'current_url',
                        'note'      => Mage::helper('allpages')->__('The url of the reference.'),
                    )
            );

        $fieldset->addField('search_engine', 'text', array(
                        'label'     => Mage::helper('allpages')->__('Engine'),
                        'class'     => 'required-entry',
                        'required'  => true,
                        'name'      => 'search_engine',
                    )
            );

        $fieldset->addField('description', 'text', array(
                        'label'     => Mage::helper('allpages')->__('Description'),
                        'class'     => 'required-entry',
                        'required'  => true,
                        'name'      => 'description',
                    )
            );

        $form->setValues($data);

        return parent::_prepareForm();
    }
}

Just in case it helps, I’m using CommerceBug tool from AlanStorm.

1st EDIT
Here is a piece of my ActionController code, where I call the Mage::register('allpages_date') prior to the call to renderLayout() as suggested by @benmarks

public function editAction()
    {
        $id = $this->getRequest()->getParam('referencedpages_id', null);
        $model = Mage::getModel('allpages/referencedpages');

        if ($id) {
            $model->load($id);
        }

        if ($model->getId() || $id == 0) {
            $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
            if ($data) {
                $model->setData($data)->setId($id);
            }
        } else {
            Mage::getSingleton('adminhtml/session')->addError(Mage::helper('allpages')->__('Referencedpages table does not exist'));
            $this->_redirect('*/*/');
        }

        Mage::register('allpages_data', $model);

        $this->loadLayout();
        $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
        $this->renderLayout();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:15:01+00:00Added an answer on June 12, 2026 at 5:15 am

    If you aren’t setting that registry key in your action controller prior to renderLayout() then it is not being set in a useful way for block rendering. Consider it like any other variable – there’s no magic there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function in PHP that retrieves all the directories and files from
I'm trying to run MonoDevelop on apple. I have instaled all the necessary SDK
I have designed one sign-up form,in this form after getting all necessary values I
In case I have .NET framework installed in my computer + all the necessary
I am busy recreating a powerpoint with xml. i have added all the neccessary
I have all dates stored as timestamps (int) in the database. how can I
I have an application that receives files with a flat table in DBF, which
I keep all my scripts, stylesheets, and php files in separate folders. Each site
I have all the parameters fixed to describe one plot including oma , mar
I have all my user uploaded pictures in a directory outside of the public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.