I have added an upsell like grid to the simple products tab conditionally trough an observer like this:

$block = $observer->getEvent()->getBlock();
        if ($block instanceof Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs) {
            if ((Mage::app()->getRequest()->getActionName() == 'edit' || Mage::app()->getRequest()->getParam('type')) && Mage::registry('current_product')->getTypeId() == "simple") {
                    $product_content = $block->getLayout()->createBlock('mymodule/adminhtml_catalog_product_edit_tab_relationsimpleproducts', 'catalog.product.edit.tab.mymodule.simplerelation')->toHtml();
                    $serialize_block = $block->getLayout()->createBlock('adminhtml/widget_grid_serializer');
                    $serialize_block->initSerializerBlock('catalog.product.edit.tab.mymodule.simplerelation', 'getSelectedMymoduleProducts', 'links[mymodule]', 'products_mymodule');
                    $product_content .= $serialize_block->toHtml();
                    $block->addTab('simpleproductslink', array(
                        'label' => Mage::helper('adminhtml')->__('MyLabel'),
                        'title' => Mage::helper('adminhtml')->__('MyLabel'),
                        'content' => $product_content,

As it stands, for pagination, a serialiser grid on a productspage calls a controller for pagination / showing more products.

The problem is this block isnt even listed in $this->getLayout()->getAllblocks(); while it is listed when i load the grid from the layout.xml.

So the standard

             ->setProductsMymodule($this->getRequest()->getPost('products_Mymodule', null));

Does not work, any ideas on how i still can adress the serializer block and set the products would be appreciated.

P.S.: Just switching to the normal way of loading a serializer grid is not an option. I need this loaded dynamically, there is another check included to see if the tab can be shown or not.

Kind regards


After some debugging it turned out that I needed to approach things more like a regular ajax call and just recreate the block.

    $this->getResponse()->setBody($this->getLayout()->createBlock('mymodule/adminhtml_catalog_product_edit_tab_relationsimpleproducts', 'catalog.product.edit.tab.mymodule.simplerelation')->toHtml());

Now the grid is dynamicly loaded in the tab and all pagination functions work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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