我创建了一个自定义扩展,我需要在我的自定义表单中添加一个“条件规则选项卡”字段。规则选项卡已显示但无法工作。当我签入 firebuger 时,将给出以下信息。ReferenceError:未定义 VarienRulesForm 我的代码是
protected function _prepareForm()
{
$model = Mage::getModel('callforprice/callforprice')->load();
$form = new Varien_Data_Form();
$helper = Mage::helper('callforprice');
$renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')
->setTemplate('promo/fieldset.phtml')
->setNewChildUrl($this->getUrl('callforprice/adminhtml_callforprice/newConditionHtml', array(
'form' => 'css_conditions_fieldset',
'prefix' => 'css',
'rule' => base64_encode('callforprice/callforprice_product_rulecss'))));
$fieldset = $form->addFieldset('css_conditions_fieldset', array(
'legend' => $this->__('Conditions (leave blank for all products)')
))->setRenderer($renderer);
$rule = Mage::getModel('callforprice/callforprice_product_rulecss');
$rule->getConditions()->setJsFormObject('css_conditions_fieldset');
$rule->getConditions()->setId('css_conditions_fieldset');
$rule->setForm($fieldset);
if ($model->getData('conditions_serialized') && is_array($model->getData('conditions_serialized')->getData('conditions'))) {
$conditions = $model->getData('conditions_serialized')->getData('conditions');
$rule->getConditions()->loadArray($conditions, 'css');
$rule->getConditions()->setJsFormObject('css_conditions_fieldset');
}
$fieldset->addField('css_conditions', 'text', array(
'name' => 'css_conditions',
'label' => $this->__('Apply To'),
'title' => $this->__('Apply To'),
'required' => true,
))->setRule($rule)->setRenderer(Mage::getBlockSingleton('rule/conditions'));
$form->setValues($model->getData());
$this->setForm($form);
return parent::_prepareForm();
}