1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34:
35: class Mage_Adminhtml_Block_Catalog_Search_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36: {
37: 38: 39: 40:
41: public function __construct()
42: {
43: parent::__construct();
44: $this->setId('catalog_search_form');
45: $this->setTitle(Mage::helper('catalog')->__('Search Information'));
46: }
47:
48: 49: 50: 51: 52:
53: protected function _prepareForm()
54: {
55: $model = Mage::registry('current_catalog_search');
56:
57:
58: $form = new Varien_Data_Form(array(
59: 'id' => 'edit_form',
60: 'action' => $this->getData('action'),
61: 'method' => 'post'
62: ));
63:
64: $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('catalog')->__('General Information')));
65:
66: $yesno = array(
67: array(
68: 'value' => 0,
69: 'label' => Mage::helper('catalog')->__('No')
70: ),
71: array(
72: 'value' => 1,
73: 'label' => Mage::helper('catalog')->__('Yes')
74: ));
75:
76: if ($model->getId()) {
77: $fieldset->addField('query_id', 'hidden', array(
78: 'name' => 'query_id',
79: ));
80: }
81:
82: $fieldset->addField('query_text', 'text', array(
83: 'name' => 'query_text',
84: 'label' => Mage::helper('catalog')->__('Search Query'),
85: 'title' => Mage::helper('catalog')->__('Search Query'),
86: 'required' => true,
87: ));
88:
89: if (!Mage::app()->isSingleStoreMode()) {
90: $field = $fieldset->addField('store_id', 'select', array(
91: 'name' => 'store_id',
92: 'label' => Mage::helper('catalog')->__('Store'),
93: 'title' => Mage::helper('catalog')->__('Store'),
94: 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(true, false),
95: 'required' => true,
96: ));
97: $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
98: $field->setRenderer($renderer);
99: }
100: else {
101: $fieldset->addField('store_id', 'hidden', array(
102: 'name' => 'store_id'
103: ));
104: $model->setStoreId(Mage::app()->getStore(true)->getId());
105: }
106:
107: if ($model->getId()) {
108: $fieldset->addField('num_results', 'text', array(
109: 'name' => 'num_results',
110: 'label' => Mage::helper('catalog')->__('Number of results'),
111: 'title' => Mage::helper('catalog')->__('Number of results (For the last time placed)'),
112: 'note' => Mage::helper('catalog')->__('For the last time placed.'),
113: 'required' => true,
114: ));
115:
116: $fieldset->addField('popularity', 'text', array(
117: 'name' => 'popularity',
118: 'label' => Mage::helper('catalog')->__('Number of Uses'),
119: 'title' => Mage::helper('catalog')->__('Number of Uses'),
120: 'required' => true,
121: ));
122: }
123:
124: $fieldset->addField('synonym_for', 'text', array(
125: 'name' => 'synonym_for',
126: 'label' => Mage::helper('catalog')->__('Synonym For'),
127: 'title' => Mage::helper('catalog')->__('Synonym For'),
128: 'note' => Mage::helper('catalog')->__('Will make search for the query above return results for this search.'),
129: ));
130:
131: $fieldset->addField('redirect', 'text', array(
132: 'name' => 'redirect',
133: 'label' => Mage::helper('catalog')->__('Redirect URL'),
134: 'title' => Mage::helper('catalog')->__('Redirect URL'),
135: 'class' => 'validate-url',
136: 'note' => Mage::helper('catalog')->__('ex. http://domain.com'),
137: ));
138:
139: $fieldset->addField('display_in_terms', 'select', array(
140: 'name' => 'display_in_terms',
141: 'label' => Mage::helper('catalog')->__('Display in Suggested Terms'),
142: 'title' => Mage::helper('catalog')->__('Display in Suggested Terms'),
143: 'values' => $yesno,
144: ));
145:
146: $form->setValues($model->getData());
147: $form->setUseContainer(true);
148: $this->setForm($form);
149:
150: return parent::_prepareForm();
151: }
152: }
153: