Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 修改magento扩展以使用wysiwyg编辑器,现在文本已赢得';救不了_Sql_Magento_Magento 1.6_Php - Fatal编程技术网

Sql 修改magento扩展以使用wysiwyg编辑器,现在文本已赢得';救不了

Sql 修改magento扩展以使用wysiwyg编辑器,现在文本已赢得';救不了,sql,magento,magento-1.6,php,Sql,Magento,Magento 1.6,Php,我最近修改了Magento视频扩展,使其中一个字段使用了WYSIWYG编辑器,而不仅仅是纯文本,但现在没有输入任何内容 该字段最初称为“内容”,因此我必须将其更改为“说明”,以便所有内容都能正确显示,并确保在我认为需要的任何地方(在design/…/模板/文件夹中调用属性,在表单中创建属性)都将“内容”更改为“说明” WYSIWYG编辑器现在显示正确,但它已删除所有原始描述,不允许我再保存(如果我键入新描述并按“保存”,当我返回视频设置时,描述不在那里) 我认为扩展名中“content”一词的任

我最近修改了Magento视频扩展,使其中一个字段使用了WYSIWYG编辑器,而不仅仅是纯文本,但现在没有输入任何内容

该字段最初称为“内容”,因此我必须将其更改为“说明”,以便所有内容都能正确显示,并确保在我认为需要的任何地方(在design/…/模板/文件夹中调用属性,在表单中创建属性)都将“内容”更改为“说明”

WYSIWYG编辑器现在显示正确,但它已删除所有原始描述,不允许我再保存(如果我键入新描述并按“保存”,当我返回视频设置时,描述不在那里)

我认为扩展名中“content”一词的任何剩余实例都与该属性无关,因为它们成对出现(例如,两个文件,一个videocontroller.php,一个videocategorycontroller.php,都以相同的方式使用,但“video category”页面从未以与视频页面相同的方式使用“content”)

我认为唯一可以对其进行排序的其他文件是SQL安装文件,其中包含:

<?php
$installer = $this;
$installer->startSetup();
$installer->run("
-- DROP TABLE IF EXISTS {$this->getTable('video')};
CREATE TABLE {$this->getTable('video')} (
`video_id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`filename` varchar(255) NOT NULL default '',
`video_category_ids` varchar(255) NOT NULL default '',
`description` text NOT NULL default '',
`status` smallint(6) NOT NULL default '0',
`created_time` datetime NULL,
`update_time` datetime NULL,
PRIMARY KEY (`video_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;");

$installer->endSetup();
编辑:code\community\Aurora\Videoblog\Block\Adminhtml\Video\edit\form.php:

类Aurora\u Videoblog\u Block\u Adminhtml\u Video\u Edit\u Form扩展了Mage\u Adminhtml\u Block\u Widget\u Form{

protected function _prepareForm() {
    $form = new Varien_Data_Form(array(
        'id' => 'edit_form',
        'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
        'method' => 'post',
        'enctype' => 'multipart/form-data'
            )
    );

    $form->setUseContainer(true);
    $this->setForm($form);
    return parent::_prepareForm();
}

protected function _prepareLayout() {
    parent::_prepareLayout();
    if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
        $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
    }
    }
}
code\community\Aurora\Videoblog\Block\Adminhtml\Video\Edit\Tabs\form.php:

class Aurora\u Videoblog\u Block\u Adminhtml\u Video\u Edit\u Tab\u表单扩展了Mage\u Adminhtml\u Block\u Widget\u表单{
受保护函数_prepareForm(){
$form=新变量数据形式();
$this->setForm($form);
$fieldset=$form->addFieldset('video_form',array('legend'=>Mage::helper('videoblog')->'video');
$fieldset->addField('title','text',数组(
'label'=>Mage::helper('videoblog')->,
“类”=>“必需条目”,
“必需”=>true,
“名称”=>“标题”,
));
$fieldset->addField('filename','text',数组(
'label'=>Mage::helper('videoblog')->,
“类”=>“必需条目”,
“必需”=>true,
“名称”=>“文件名”,
'after_element_html'=>'.Mage::helper('videoblog')->'>'('v='(例如ear2SunyaZE)之后的Youtube视频id)。',
));
$fieldset->addField('video\u category\u id','multiselect',数组(
'label'=>Mage::helper('videoblog')->,
'name'=>'video\u category\u id',
“必需”=>true,
“值”=>“1”,
'values'=>Mage::helper('videoblog')->getCategory(),
));
$fieldset->addField('status','select',array(
'label'=>Mage::helper('videoblog')->,
“名称”=>“状态”,
'值'=>数组(
排列(
“值”=>1,
'label'=>Mage::helper('videoblog')->,
),
排列(
“值”=>2,
'label'=>Mage::helper('videoblog')->\uuuu('Disabled'),
),
),
));
$fieldset->addField('description','editor',array(
“名称”=>“说明”,
'label'=>Mage::helper('videoblog')->\uuuu('Description'),
'title'=>Mage::helper('videoblog')->\uuuu('Description'),
'样式'=>'宽度:500px;高度:200px;',
'config'=>Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
“所见即所得”=>正确,
“必需”=>true,
));
if(Mage::getSingleton('adminhtml/session')->getVideoData()){
$form->setValues(Mage::getSingleton('adminhtml/session')->getVideoData();
Mage::getSingleton('adminhtml/session')->setVideoData(null);
}elseif(Mage::registry('video_data')){
$form->setValues(Mage::registry('video_data')->getData();
}
返回父项::_prepareForm();
}
}

您只需更改form.php文件中内容字段的“标签”

所以你的描述字段看起来像

$fieldset->addField('content', 'editor', array(
    'name' => 'content',
    'label' => Mage::helper('videoblog')->__('Description'),
    'title' => Mage::helper('videoblog')->__('Description'),
    'style' => 'width:500px; height:200px;',
    'config'    => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
    'wysiwyg' => true,
    'required' => true,
));
即使您不想使用内容字段,也可以使用下面的脚本在数据库中创建新字段

创建脚本mysql4-upgrade-0.1.0-0.1.1.php//如果您的模块版本为0.1.0(到脚本文件中的0.1.1更新版本)


能否在“Company/Module/controllers/Adminhtml/nameController.phpAdded to original post”中添加saveAction的代码更改数据库字段名后是否清除了缓存(无论是否禁用了magento缓存)?是的,刷新了缓存,在添加新字段后仍不保存(数据);字段在那里吗?感谢回复,不幸的是,这触发了我最初遇到的问题,导致了这种情况:您出现了什么错误?n您实施的哪个解决方案创建了新字段或只是更改了标签?感谢快速回复,仅更改标签就在我在回复上发布的图像中创建了问题-所有其他字段添加到wysiwyg文本框中。我刚刚创建了更新文件并通过ftp将其发送到服务器,这会立即生效还是需要执行其他操作?目前它仍然没有保存文本有2个form.php文件,因此我发布了bothI。我不太确定“检查更新的字段集”是什么意思,我已经添加了sql更新d刷新了缓存,但仍无法保存
class Aurora_Videoblog_Block_Adminhtml_Video_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {

protected function _prepareForm() {
    $form = new Varien_Data_Form();
    $this->setForm($form);
    $fieldset = $form->addFieldset('video_form', array('legend' => Mage::helper('videoblog')->__('Video')));

    $fieldset->addField('title', 'text', array(
        'label' => Mage::helper('videoblog')->__('Title'),
        'class' => 'required-entry',
        'required' => true,
        'name' => 'title',
    ));

    $fieldset->addField('filename', 'text', array(
        'label' => Mage::helper('videoblog')->__('Video'),
        'class' => 'required-entry',
        'required' => true,
        'name' => 'filename',
        'after_element_html' => '<small style="color: red;display: block">'.Mage::helper('videoblog')->__("Youtube video id after 'v=' (e.g. ear2SunyaZE)").'</small>',
    ));

    $fieldset->addField('video_category_ids', 'multiselect', array(
        'label' => Mage::helper('videoblog')->__('Category'),
        'name' => 'video_category_ids',
        'required' => true,
        'value' => '1',
        'values' => Mage::helper('videoblog')->getCategory(),
    ));

    $fieldset->addField('status', 'select', array(
        'label' => Mage::helper('videoblog')->__('Status'),
        'name' => 'status',
        'values' => array(
            array(
                'value' => 1,
                'label' => Mage::helper('videoblog')->__('Enabled'),
            ),
            array(
                'value' => 2,
                'label' => Mage::helper('videoblog')->__('Disabled'),
            ),
        ),
    ));

    $fieldset->addField('description', 'editor', array(
        'name' => 'description',
        'label' => Mage::helper('videoblog')->__('Description'),
        'title' => Mage::helper('videoblog')->__('Description'),
        'style' => 'width:500px; height:200px;',
        'config'    => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
        'wysiwyg' => true,
        'required' => true,
    ));

    if (Mage::getSingleton('adminhtml/session')->getVideoData()) {
        $form->setValues(Mage::getSingleton('adminhtml/session')->getVideoData());
        Mage::getSingleton('adminhtml/session')->setVideoData(null);
    } elseif (Mage::registry('video_data')) {
        $form->setValues(Mage::registry('video_data')->getData());
    }
    return parent::_prepareForm();
}

}
$fieldset->addField('content', 'editor', array(
    'name' => 'content',
    'label' => Mage::helper('videoblog')->__('Description'),
    'title' => Mage::helper('videoblog')->__('Description'),
    'style' => 'width:500px; height:200px;',
    'config'    => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
    'wysiwyg' => true,
    'required' => true,
));
<?php

$installer = $this;

$installer->startSetup();

$installer->run("
 ALTER TABLE {$this->getTable('video')} ADD   description varchar(255) NULL ;

");

$installer->endSetup();