0

I created my custom grid in an extension but I don't know if it is something with permission or not that a button is not showing up in grid customization: enter image description here

it should have add attribute column like this: enter image description here

controller:

class Lenmar_Lightbulbs_Adminhtml_LightbulbsController extends Mage_Adminhtml_Controller_action
{
protected function _isAllowed()
    {
        return Mage::getSingleton('admin/session')->isAllowed('lightbulbs/lightbulbs');
    }

public function indexAction() {

    $this->loadLayout();
    $this->getLayout()->createBlock('lightbulbs/adminhtml_lightbulbs');
    $this->renderLayout();

}

public function gridAction()
    {

        $this->getResponse()->setBody(
        $this->getLayout()->createBlock('lightbulbs/adminhtml_lightbulbs_grid')->toHtml()
        );
    }   


}

my cache is disabed and I reindexed it didn't help even I copy pasted my other extension which has this button and again rename everything it didn't work

I have the buttons comming from T:\app\code\community\BL\CustomGrid\Block\Widget\Grid\Columns\Config.php

here is the function:

public function getAddColumnButtonHtml()
{
    return parent::getButtonHtml($this->__('Add Attribute Column'), $this->getJsObjectName().'.addColumn();', 'scalable add');
}

also I can rename other ones and they will be changed in button text

also I found the condition! that when to show it:

   <?php if ($this->canDisplayColumnsConfig()): ?>
                                <?php if ($_gridModel->canHaveAttributeColumns()): ?>
                                    <span class="field-row">
                                        <?php echo $this->getAddColumnButtonHtml() ?>
                                    </span>
                                <?php endif ?>

I commented out this if condition and add attribute column showed up but I cannot do it it would affect other areas where add column shouldn't be there it seems I have some permission problem which I dont know how to figure out for this extension

  • Flush cache and reindex data then relogin once this may help. – dh47 Nov 14 '14 at 1:58
  • Please add some code on how you implemented this. – Anna Völkl Nov 14 '14 at 6:48
  • my cache is disabled – Nickool Nov 14 '14 at 15:43
  • Anna which part of extention you like to see? controller?grid? what? – Nickool Nov 14 '14 at 15:44
  • If you make a random change to artificial properties is this reflected in your admin (lets say.. renaming one of the other buttons)? – hownowbrowncow Nov 14 '14 at 18:59
2

I figured it out: I should add the type of grid and then it will be addable

T:\app\code\community\BL\CustomGrid\Model\Grid\Type\Product.php

public function isAppliableToGrid($type, $rewritingClassName)
{
return $type == 'lightbulbs/adminhtml_lightbulbs_grid';
}
1

Solved:

app\code\community\BL\CustomGrid\Model\Grid\Type\Product.php

public function isAppliableToGrid($type, $rewritingClassName){

    return (($type == 'adminhtml/catalog_product_grid')
        || ($type == 'adminhtml/catalog_category_tab_product')
        || ($type == 'adminhtml/catalog_product_edit_tab_related')
        || ($type == 'adminhtml/catalog_product_edit_tab_upsell')
        || ($type == 'adminhtml/catalog_product_edit_tab_crosssell')
        || ($type == 'lightbulbs/adminhtml_lightbulbs_grid'));
}

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.