2

I am creating a custom module collection which has content as product grid serialization. I have referred article How to create the Product Grid Serializer Block In Custom module.

I use Mage::registry('current_[entity]')->getId(); to get the id. In my case I have used Mage::registry('current_collections')->getId(); But i am getting error:

Fatal error: Call to a member function getId() on a non-object in ..Tab/Product.php file.

How can I get current collections id from registry?

1 Answer 1

4

Take a look at /app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php

/**
 * Initialize order model instance
 *
 * @return Mage_Sales_Model_Order || false
 */
protected function _initOrder()
{
    ....

    Mage::register('sales_order', $order);
    Mage::register('current_order', $order);
    return $order;
}

In order to use Mage::registry('current_order') it must first be set (Mage::register('current_order', $order);) some where , else you going to get a Fatal error

3
  • thank, i registered collections. Now it is showing error Fatal error: Call to a member function setCollectionsProducts() on a non-object in CollectionsController.php also i am not finding any method with name setCollectionsProducts Nov 15, 2014 at 11:43
  • I think i am unable to access object of layout block in function productsAction() in controller. Error found for code $this->getLayout()->getBlock('collections.edit.tab.product') Here it returns Boolean false. Nov 15, 2014 at 12:32
  • In order to keep this site clean, can you just create a new question and add code from your controller, layout.xml and config Nov 15, 2014 at 13:00

Your Answer

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

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