magento Примечание: массив для преобразования строк lib \ Varien \ Data \ Form \ Element \ Image.php в строке 57

Я использую magento 1.7, вот какая-то проблема, я не могу понять, что у меня есть расширение для создания и использование поля типа изображения в форме, когда я выбираю изображение, а затем сохраняю это успешно, но когда я редактирую и не делаю изменения, нажмите «Сохранить», эта следующая ошибка у вас есть решение для этого

Notice: Array to string conversion  in D:\wamp\www\easyshop\lib\Varien\Data\Form\Element\Image.php on line 57

#0 D:\wamp\www\easyshop\lib\Varien\Data\Form\Element\Image.php(57): mageCoreErrorHandler(8, 'Array to string...', 'D:\wamp\www\eas...', 57, Array)
#1 D:\wamp\www\easyshop\app\design\adminhtml\default\default\template\widget\form\renderer\fieldset\element.phtml(40): Varien_Data_Form_Element_Image->getElementHtml()
#2 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(241): include('D:\wamp\www\eas...')
#3 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml\defau...')
#4 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#5 D:\wamp\www\easyshop\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#6 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#7 D:\wamp\www\easyshop\app\code\core\Mage\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element.php(52): Mage_Core_Block_Abstract->toHtml()
#8 D:\wamp\www\easyshop\lib\Varien\Data\Form\Element\Abstract.php(223): Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element->render(Object(Varien_Data_Form_Element_Image))
#9 D:\wamp\www\easyshop\lib\Varien\Data\Form\Element\Abstract.php(233): Varien_Data_Form_Element_Abstract->getHtml()
#10 D:\wamp\www\easyshop\lib\Varien\Data\Form\Element\Fieldset.php(90): Varien_Data_Form_Element_Abstract->toHtml()
#11 D:\wamp\www\easyshop\app\design\adminhtml\default\default\template\widget\form\renderer\fieldset.phtml(49): Varien_Data_Form_Element_Fieldset->getChildrenHtml()
#12 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(241): include('D:\wamp\www\eas...')
#13 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml\defau...')
#14 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#15 D:\wamp\www\easyshop\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#16 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#17 D:\wamp\www\easyshop\app\code\core\Mage\Adminhtml\Block\Widget\Form\Renderer\Fieldset.php(51): Mage_Core_Block_Abstract->toHtml()
#18 D:\wamp\www\easyshop\lib\Varien\Data\Form\Element\Abstract.php(223): Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset->render(Object(Varien_Data_Form_Element_Fieldset))
#19 D:\wamp\www\easyshop\lib\Varien\Data\Form\Element\Abstract.php(233): Varien_Data_Form_Element_Abstract->getHtml()
#20 D:\wamp\www\easyshop\lib\Varien\Data\Form.php(244): Varien_Data_Form_Element_Abstract->toHtml()
#21 D:\wamp\www\easyshop\lib\Varien\Data\Form.php(256): Varien_Data_Form->toHtml()
#22 D:\wamp\www\easyshop\app\code\core\Mage\Adminhtml\Block\Widget\Form.php(108): Varien_Data_Form->getHtml()
#23 D:\wamp\www\easyshop\app\design\adminhtml\default\default\template\widget\form.phtml(28): Mage_Adminhtml_Block_Widget_Form->getFormHtml()
#24 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(241): include('D:\wamp\www\eas...')
#25 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml\defau...')
#26 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#27 D:\wamp\www\easyshop\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#28 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#29 D:\wamp\www\easyshop\app\code\local\Easyshop\Slider\Block\Adminhtml\Slider\Edit\Tabs.php(19): Mage_Core_Block_Abstract->toHtml()
#30 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Abstract.php(862): Easyshop_Slider_Block_Adminhtml_Slider_Edit_Tabs->_beforeToHtml()
#31 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Text\List.php(43): Mage_Core_Block_Abstract->toHtml()
#32 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#33 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#34 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#35 D:\wamp\www\easyshop\app\design\adminhtml\default\default\template\page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left')
#36 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(241): include('D:\wamp\www\eas...')
#37 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml\defau...')
#38 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#39 D:\wamp\www\easyshop\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#40 D:\wamp\www\easyshop\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#41 D:\wamp\www\easyshop\app\code\core\Mage\Core\Model\Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#42 D:\wamp\www\easyshop\app\code\core\Mage\Core\Controller\Varien\Action.php(390): Mage_Core_Model_Layout->getOutput()
#43 D:\wamp\www\easyshop\app\code\local\Easyshop\Slider\controllers\Adminhtml\SliderController.php(44): Mage_Core_Controller_Varien_Action->renderLayout()
#44 D:\wamp\www\easyshop\app\code\core\Mage\Core\Controller\Varien\Action.php(419): Easyshop_Slider_Adminhtml_SliderController->editAction()
#45 D:\wamp\www\easyshop\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('edit')
#46 D:\wamp\www\easyshop\app\code\core\Mage\Core\Controller\Varien\Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#47 D:\wamp\www\easyshop\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#48 D:\wamp\www\easyshop\app\Mage.php(683): Mage_Core_Model_App->run(Array)
#49 D:\wamp\www\easyshop\index.php(88): Mage::run('', 'store')
#50 {main}

и я использую следующий код для добавления поля типа изображения

  $fieldset->addField('filename', 'image', array(
      'label'     => Mage::helper('slider')->__('File'),
      'required'  => false,
      'name'      => 'filename',
  ));

Пожалуйста, помогите мне решить эту проблему.

2
добавлено
Просмотры: 1
de

1 ответы

Just try code like following. because in edit mode when user nothing did with image not select for deletion nor selected new image then you must be remove element from data so magento will ignore image field and this issue will be resolved. i have same problem so that i know solutions after tried several r&d

if (isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
    /* 
        Move uploaded file logic when user select a image
    */
} else {

    if(isset($data['filename']['delete']) && $data['filename']['delete'] == 1) {
        /*
            When user click on checkbox for deletion
        */
        $data['filename'] = '';
    } else {
        /* 
            in edit mode when user nothing did with image not 
            select for deletion nor selected new image then you must 
            be remove element from data so magento will ignore image 
            field and this issue will be resolved
        */
        unset($data['filename']);
    }
}
2
добавлено
X-Ref, поскольку ответ на его собственные листья открываются концами здесь и там: Общие проблемы пользовательского модуля Magento Admin (декабрь 2012)
добавлено автор hakre, источник