0

Added custom element to my adminhtml form. It works perfectly fine on my developement site but it won't on production .... the only difference was on dev i made it as a module while on production I just copied core files into local and made all the changes.But then I cleaned it up and installed module to make sure everything is "identical" but it still won't work. Once I enable renderer -> blank page. Disabled renderer is giving me a standard text/input element. This is my form custom element

$mySlides = $fieldset->addField('mySlides', 'text',
        array(
            'name'      => 'mySlides',
            'note'      => 'pafka',
    ));
    $renderer = new Mage_Adminhtml_Block_Cms_Block_Edit_Table_Renderer;
    $mySlides->setRenderer($renderer);  

and my renderer:

class Mage_Adminhtml_Block_Cms_Block_Edit_Table_Renderer extends arien_Data_Form_Element_Abstract
{
    public function render(Varien_Object $row)
    {
    $collection = Mage::getModel( 'cms/block' )
        ->getCollection()
        //->addAttributeToSelect('position')
        ->addFieldToFilter( 'is_active', 1 )
        ->addFieldToFilter( 'is_slide', 1 )
    ;
    $collection->setOrder('position','ASC');

    $style = '<style>
        #Slides li { float: left;margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; }
        li:hover {cursor: pointer;}
        </style>';
    $jquery = '<script src="jquery.min.js"></script><script>$.noConflict();</script><script src="jquery-ui.js"></script>';
    $tableTop = '<ul id="Slides">';
    $media = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
    foreach($collection as $id){
        $slitle = $id->getTitle();
        $slid = $id->getID();
        $simage = str_replace(' ','',$id->getData('mobileslide'));
        $tableMid .= '<li id="'.$slid.'">'.$id->position.'<img width="100px" src="'.$media.$simage.'"/><li>';
    }
    $tableEnd = '</ul>';
    $script = '<script>
        ...
        </script>';
    $slides = $style.$jquery.$tableTop.$tableMid.$tableEnd.$script;
    $this->_slides = $slides;
    return $slides;
}

}

renderer is placed in: /app/code/local/Mage/Adminhtml/Block/Cms/Block/Edit/Table file name is Renderer.php

Any ideas ?? that's how it look like on my dev: enter image description here

Not sure where to look as there is no errors or anything what can point me to the issue. How can I find what is the problem ? I think the only problem can be a admin path but have no clue how to check it. Please help! found something in the meantime: h t t p s ://mywebsite/index.php/eska/cms_block/edit/block_id/317/key/59aabbdd1385e396f..........108bb/ 500 (Internal Server Error) when the renderer is called aparently, but still can not find what cause this issue. There is no errors in code.

2

You mag typo Misses 'V' in class name arien_Data_Form_Element_Abstract

class Mage_Adminhtml_Block_Cms_Block_Edit_Table_Renderer extends Varien_Data_Form_Element_Abstract

  • @RobD.A. Did you cleared cache? – Serhii Havrylchuk Feb 11 at 13:09
  • @RobD.A. By the way I don`t have Mage_Adminhtml_Block_Cms_Block_Edit_Table_Renderer in my magento installation. where do you find this file? – Serhii Havrylchuk Feb 11 at 13:14
  • So it will not work that way. you should create module for this. – Serhii Havrylchuk Feb 11 at 13:19
  • It is not best practice and also when you do direct changes in core files, they can be overwritten when magento will be updated. so all changes you should do in custom module. more information is here excellencemagentoblog.com/blog/2014/03/03/… – Serhii Havrylchuk Feb 11 at 13:28
  • if you put files in local that don`t exist in core then magento will not see them. – Serhii Havrylchuk Feb 11 at 13:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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