本文整理汇总了PHP中Mage_Adminhtml_Block_Catalog_Form::_prepareLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_Catalog_Form::_prepareLayout方法的具体用法?PHP Mage_Adminhtml_Block_Catalog_Form::_prepareLayout怎么用?PHP Mage_Adminhtml_Block_Catalog_Form::_prepareLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Adminhtml_Block_Catalog_Form
的用法示例。
在下文中一共展示了Mage_Adminhtml_Block_Catalog_Form::_prepareLayout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareLayout
/**
* Load Wysiwyg on demand and prepare layout
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
if (Mage::helper('Mage_Catalog_Helper_Data')->isModuleEnabled('Mage_Cms') && Mage::getSingleton('Mage_Cms_Model_Wysiwyg_Config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
}
示例2: _prepareLayout
/**
* Load Wysiwyg on demand and Prepare layout
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
}
示例3: _prepareLayout
public function _prepareLayout()
{
parent::_prepareLayout();
$form = new Varien_Data_Form();
$form->setDataObject($this->getCategory());
$fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('catalog')->__('Custom Design')));
$this->_setFieldset($this->getCategory()->getDesignAttributes(), $fieldset);
$form->addValues($this->getCategory()->getData());
$form->setFieldNameSuffix('general');
$this->setForm($form);
}
示例4: _prepareLayout
public function _prepareLayout()
{
parent::_prepareLayout();
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('_general');
$form->setDataObject($this->getCategory());
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('catalog')->__('General Information')));
$this->_setFieldset($this->getCategory()->getAttributes(true), $fieldset);
if (!$this->getCategory()->getId()) {
$fieldset->addField('path', 'select', array('name' => 'path', 'label' => Mage::helper('catalog')->__('Parent Category'), 'value' => base64_decode($this->getRequest()->getParam('parent')), 'values' => $this->_getParentCategoryOptions()), 'name');
}
$form->addValues($this->getCategory()->getData());
$form->setFieldNameSuffix('general');
$this->setForm($form);
}
示例5: _prepareLayout
public function _prepareLayout()
{
parent::_prepareLayout();
$form = new Varien_Data_Form();
$form->setDataObject($this->getCategory());
$model = new Varien_Object();
$attributes = $this->getCategory()->getAttributes();
/*********** CATEGORY *************/
$fieldset = $form->addFieldset('category', array('legend' => Mage::helper('seo')->__('SEO of Nested (Child) Categories')));
$fieldset->addField('category_meta_title_tpl', 'text', array('label' => Mage::helper('seo')->__('Meta Title'), 'name' => 'category_meta_title_tpl', 'value' => $model->getCategoryMetaTitleTpl(), 'note' => ''))->setEntityAttribute($attributes['category_meta_title_tpl']);
$fieldset->addField('category_meta_description_tpl', 'textarea', array('label' => Mage::helper('seo')->__('Meta Description'), 'name' => 'category_meta_description_tpl', 'value' => $model->getCategoryMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['category_meta_description_tpl']);
$fieldset->addField('category_meta_keywords_tpl', 'textarea', array('label' => Mage::helper('seo')->__('Meta Keywords'), 'name' => 'category_meta_keywords_tpl', 'value' => $model->getCategoryMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['category_meta_keywords_tpl']);
$fieldset->addField('category_title_tpl', 'text', array('label' => Mage::helper('seo')->__('H1'), 'name' => 'category_title_tpl', 'value' => $model->getCategoryMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['category_title_tpl']);
$fieldset->addField('category_description_tpl', 'textarea', array('label' => Mage::helper('seo')->__('SEO description'), 'name' => 'category_description_tpl', 'value' => $model->getCategoryMetaDescriptionTpl(), 'note' => '<b>Template variables</b><br>
[category_name], [category_description], [category_url], [category_parent_name], [category_parent_url], [category_parent_parent_name], [category_page_title], [store_name], [store_url], [store_address], [store_phone], [store_email]'))->setEntityAttribute($attributes['category_description_tpl']);
/*********** FILTER *************/
$fieldset = $form->addFieldset('filter', array('legend' => Mage::helper('seo')->__('SEO of Nested (Child) Layered Navigation')));
$fieldset->addField('filter_meta_title_tpl', 'text', array('label' => Mage::helper('seo')->__('Meta Title'), 'name' => 'filter_meta_title_tpl', 'value' => $model->getFilterMetaTitleTpl(), 'note' => ''))->setEntityAttribute($attributes['filter_meta_title_tpl']);
$fieldset->addField('filter_meta_description_tpl', 'textarea', array('label' => Mage::helper('seo')->__('Meta Description'), 'name' => 'filter_meta_description_tpl', 'value' => $model->getFilterMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['filter_meta_description_tpl']);
$fieldset->addField('filter_meta_keywords_tpl', 'textarea', array('label' => Mage::helper('seo')->__('Meta Keywords'), 'name' => 'filter_meta_keywords_tpl', 'value' => $model->getFilterMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['filter_meta_keywords_tpl']);
$fieldset->addField('filter_title_tpl', 'text', array('label' => Mage::helper('seo')->__('H1'), 'name' => 'filter_title_tpl', 'value' => $model->getFilterMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['filter_title_tpl']);
$fieldset->addField('filter_description_tpl', 'textarea', array('label' => Mage::helper('seo')->__('SEO description'), 'name' => 'filter_description_tpl', 'value' => $model->getFilterMetaDescriptionTpl(), 'note' => '<b>Template variables</b><br>
[category_name], [category_description], [category_url], [category_parent_name], [category_parent_url], <br>
[filter_selected_options], [filter_named_selected_options]<br>
[store_name], [store_url], [store_address], [store_phone], [store_email]'))->setEntityAttribute($attributes['filter_description_tpl']);
/*********** PRODUCT *************/
$fieldset = $form->addFieldset('product', array('legend' => Mage::helper('seo')->__('SEO of Nested (Child) Products')));
$fieldset->addField('product_meta_title_tpl', 'text', array('label' => Mage::helper('seo')->__('Meta Title'), 'name' => 'product_meta_title_tpl', 'value' => $model->getProductMetaTitleTpl(), 'note' => ''))->setEntityAttribute($attributes['product_meta_title_tpl']);
$fieldset->addField('product_meta_description_tpl', 'textarea', array('label' => Mage::helper('seo')->__('Meta Description'), 'name' => 'product_meta_description_tpl', 'value' => $model->getProductMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['product_meta_description_tpl']);
$fieldset->addField('product_meta_keywords_tpl', 'textarea', array('label' => Mage::helper('seo')->__('Meta Keywords'), 'name' => 'product_meta_keywords_tpl', 'value' => $model->getProductMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['product_meta_keywords_tpl']);
$fieldset->addField('product_title_tpl', 'text', array('label' => Mage::helper('seo')->__('H1'), 'name' => 'product_title_tpl', 'value' => $model->getProductMetaDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['product_title_tpl']);
$fieldset->addField('product_short_description_tpl', 'textarea', array('label' => Mage::helper('seo')->__('ShortDescription'), 'name' => 'product_short_description_tpl', 'value' => $model->getProductShortDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['product_short_description_tpl']);
$fieldset->addField('product_full_description_tpl', 'textarea', array('label' => Mage::helper('seo')->__('Description'), 'name' => 'product_full_description_tpl', 'value' => $model->getProductFullDescriptionTpl(), 'note' => ''))->setEntityAttribute($attributes['product_full_description_tpl']);
$fieldset->addField('product_description_tpl', 'textarea', array('label' => Mage::helper('seo')->__('SEO description'), 'name' => 'product_description_tpl', 'value' => $model->getProductMetaDescriptionTpl(), 'note' => '<b>Template variables</b><br>
[product_<product field or attribute>] (e.g. [product_name], [product_price], [product_color]) <br>
[category_name], [category_description], [category_url], [category_parent_name], [category_parent_url], <br>
[store_name], [store_url], [store_address], [store_phone], [store_email]'))->setEntityAttribute($attributes['product_description_tpl']);
$form->addValues($this->getCategory()->getData());
$form->setFieldNameSuffix('general');
$this->setForm($form);
}
示例6: _prepareLayout
public function _prepareLayout()
{
parent::_prepareLayout();
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('_general');
$form->setDataObject($this->getCategory());
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('catalog')->__('General Information')));
if (!$this->getCategory()->getId()) {
// $fieldset->addField('path', 'select', array(
// 'name' => 'path',
// 'label' => Mage::helper('catalog')->__('Parent Category'),
// 'value' => base64_decode($this->getRequest()->getParam('parent')),
// 'values'=> $this->_getParentCategoryOptions(),
// //'required' => true,
// //'class' => 'required-entry'
// ),
// 'name'
// );
if ($this->getRequest()->getParam('parent')) {
$fieldset->addField('path', 'hidden', array('name' => 'path', 'value' => $this->getRequest()->getParam('parent')));
} else {
$storeId = (int) $this->getRequest()->getParam('store');
$fieldset->addField('path', 'hidden', array('name' => 'path', 'value' => 1));
}
} else {
$fieldset->addField('id', 'hidden', array('name' => 'id', 'value' => $this->getCategory()->getId()));
$fieldset->addField('path', 'hidden', array('name' => 'path', 'value' => $this->getCategory()->getPath()));
}
$this->_setFieldset($this->getCategory()->getAttributes(true), $fieldset);
if ($this->getCategory()->getId()) {
if ($this->getCategory()->getLevel() == 1) {
$fieldset->removeField('url_key');
$fieldset->addField('url_key', 'hidden', array('name' => 'url_key', 'value' => $this->getCategory()->getUrlKey()));
}
}
$form->addValues($this->getCategory()->getData());
$form->setFieldNameSuffix('general');
$this->setForm($form);
}
示例7: _prepareLayout
public function _prepareLayout()
{
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Google Optimizer Scripts')));
if ($this->getCategory()->getStoreId() == '0') {
Mage::helper('Mage_GoogleOptimizer_Helper_Data')->setStoreId(Mage::app()->getDefaultStoreView());
} else {
Mage::helper('Mage_GoogleOptimizer_Helper_Data')->setStoreId($this->getCategory()->getStoreId());
}
$disabledScriptsFields = false;
$values = array();
if ($this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getData()) {
$disabledScriptsFields = true;
$values = $this->getGoogleOptimizer()->getData();
$checkedUseDefault = true;
if ($this->getGoogleOptimizer()->getStoreId() == $this->getCategory()->getStoreId()) {
$checkedUseDefault = false;
$disabledScriptsFields = false;
$fieldset->addField('code_id', 'hidden', array('name' => 'code_id'));
}
// show 'use default' checkbox if store different for default and product has scripts for default store
if ($this->getCategory()->getStoreId() != '0') {
$fieldset->addField('store_flag', 'checkbox', array('name' => 'store_flag', 'value' => '1', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Use Default'), 'class' => 'checkbox', 'required' => false, 'onchange' => 'googleOptimizerScopeAction()'))->setIsChecked($checkedUseDefault);
}
}
$fieldset->addField('conversion_page', 'select', array('name' => 'conversion_page', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page'), 'values' => Mage::getModel('Mage_GoogleOptimizer_Model_Adminhtml_System_Config_Source_Googleoptimizer_Conversionpages')->toOptionArray(), 'class' => 'select googleoptimizer validate-googleoptimizer', 'required' => false, 'onchange' => 'googleOptimizerConversionPageAction(this)'));
//Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL)
if ($this->getCategory()->getStoreId() == '0' && !Mage::app()->isSingleStoreMode()) {
$fieldset->addField('conversion_page_url', 'note', array('name' => 'conversion_page_url', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page URL'), 'text' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Please select store view to see the URL')));
} else {
$fieldset->addField('conversion_page_url', 'text', array('name' => 'conversion_page_url', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page URL'), 'class' => 'input-text', 'readonly' => 'readonly', 'required' => false, 'note' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Please copy and paste this value to experiment edit form')));
}
$fieldset->addField('export_controls', 'text', array('name' => 'export_controls'));
$fieldset->addField('control_script', 'textarea', array('name' => 'control_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Control Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
$fieldset->addField('tracking_script', 'textarea', array('name' => 'tracking_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Tracking Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
$fieldset->addField('conversion_script', 'textarea', array('name' => 'conversion_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
if (Mage::helper('Mage_GoogleOptimizer_Helper_Data')->getConversionPagesUrl() && $this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getConversionPage()) {
$form->getElement('conversion_page_url')->setValue(Mage::helper('Mage_GoogleOptimizer_Helper_Data')->getConversionPagesUrl()->getData($this->getGoogleOptimizer()->getConversionPage()));
}
if ($disabledScriptsFields) {
foreach ($fieldset->getElements() as $element) {
if ($element->getType() == 'textarea' || $element->getType() == 'select') {
$element->setDisabled($disabledScriptsFields);
}
}
}
$fakeEntityAttribute = Mage::getModel('Mage_Catalog_Model_Resource_Eav_Attribute');
$readonly = $this->getCategory()->getOptimizationReadonly();
foreach ($fieldset->getElements() as $element) {
$element->setDisabled($readonly);
if ($element->getId() != 'store_flag') {
$element->setEntityAttribute($fakeEntityAttribute);
}
}
$form->getElement('export_controls')->setRenderer($this->getLayout()->createBlock('Mage_GoogleOptimizer_Block_Adminhtml_Catalog_Form_Renderer_Import'));
$form->addValues($values);
$form->setFieldNameSuffix('googleoptimizer');
$this->setForm($form);
return parent::_prepareLayout();
}