Public Member Functions | |
_prepareLayout () | |
getSearchableAttributes () | |
getAttributeLabel ($attribute) | |
getAttributeValidationClass ($attribute) | |
getAttributeValue ($attribute, $part=null) | |
getAvailableCurrencies () | |
getCurrencyCount () | |
getCurrency ($attribute) | |
getAttributeInputType ($attribute) | |
getAttributeSelectElement ($attribute) | |
getAttributeYesNoElement ($attribute) | |
getModel () | |
getSearchPostUrl () | |
getDateInput ($attribute, $part= 'from') | |
Protected Member Functions | |
_getSelectBlock () | |
_getDateBlock () |
Definition at line 34 of file Form.php.
_getDateBlock | ( | ) | [protected] |
_getSelectBlock | ( | ) | [protected] |
_prepareLayout | ( | ) |
Preparing global layout
You can redefine this method in child classes for changin layout
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 36 of file Form.php.
00037 { 00038 if ($headBlock = $this->getLayout()->getBlock('head')) { 00039 $headBlock->setTitle(Mage::helper('catalogsearch')->__('Catalog Advanced Search')); 00040 } 00041 00042 // add Home breadcrumb 00043 if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) { 00044 $breadcrumbs->addCrumb('home', array( 00045 'label'=>Mage::helper('catalogsearch')->__('Home'), 00046 'title'=>Mage::helper('catalogsearch')->__('Go to Home Page'), 00047 'link'=>Mage::getBaseUrl() 00048 ))->addCrumb('search', array( 00049 'label'=>Mage::helper('catalogsearch')->__('Catalog Advanced Search') 00050 )); 00051 } 00052 return parent::_prepareLayout(); 00053 }
getAttributeInputType | ( | $ | attribute | ) |
Retrieve attribute input type
$attribute |
Definition at line 149 of file Form.php.
00150 { 00151 $dataType = $attribute->getBackend()->getType(); 00152 $imputType = $attribute->getFrontend()->getInputType(); 00153 if ($imputType == 'select' || $imputType == 'multiselect') { 00154 return 'select'; 00155 } 00156 00157 if ($imputType == 'boolean') { 00158 return 'yesno'; 00159 } 00160 00161 if ($imputType == 'price') { 00162 return 'price'; 00163 } 00164 00165 if ($dataType == 'int' || $dataType == 'decimal') { 00166 return 'number'; 00167 } 00168 00169 if ($dataType == 'datetime') { 00170 return 'date'; 00171 } 00172 00173 return 'string'; 00174 }
getAttributeLabel | ( | $ | attribute | ) |
Retrieve attribute label
$attribute |
Definition at line 72 of file Form.php.
00073 { 00074 return Mage::helper('catalog')->__($attribute->getFrontend()->getLabel()); 00075 }
getAttributeSelectElement | ( | $ | attribute | ) |
Definition at line 176 of file Form.php.
00177 { 00178 $extra = ''; 00179 $options = $attribute->getSource()->getAllOptions(false); 00180 00181 $name = $attribute->getAttributeCode(); 00182 00183 // 2 - avoid yes/no selects to be multiselects 00184 if (is_array($options) && count($options)>2) { 00185 $extra = 'multiple="multiple" size="4"'; 00186 $name.= '[]'; 00187 } 00188 else { 00189 array_unshift($options, array('value'=>'', 'label'=>Mage::helper('catalogsearch')->__('All'))); 00190 } 00191 00192 00193 00194 return $this->_getSelectBlock() 00195 ->setName($name) 00196 ->setId($attribute->getAttributeCode()) 00197 ->setTitle($this->getAttributeLabel($attribute)) 00198 ->setExtraParams($extra) 00199 ->setValue($this->getAttributeValue($attribute)) 00200 ->setOptions($options) 00201 ->setClass('multiselect') 00202 ->getHtml(); 00203 }
getAttributeValidationClass | ( | $ | attribute | ) |
Retrieve attribute input validation class
$attribute |
Definition at line 83 of file Form.php.
00084 { 00085 return $attribute->getFrontendClass(); 00086 }
getAttributeValue | ( | $ | attribute, | |
$ | part = null | |||
) |
Definition at line 88 of file Form.php.
00089 { 00090 $value = $this->getRequest()->getQuery($attribute->getAttributeCode()); 00091 if ($part && $value) { 00092 if (isset($value[$part])) { 00093 $value = $value[$part]; 00094 } 00095 else { 00096 $value = ''; 00097 } 00098 } 00099 00100 if (!is_array($value)) { 00101 $value = htmlspecialchars($value); 00102 } 00103 return $value; 00104 }
getAttributeYesNoElement | ( | $ | attribute | ) |
Definition at line 205 of file Form.php.
00206 { 00207 $options = array( 00208 array('value' => '', 'label' => Mage::helper('catalogsearch')->__('All')), 00209 array('value' => '1', 'label' => Mage::helper('catalogsearch')->__('Yes')), 00210 array('value' => '0', 'label' => Mage::helper('catalogsearch')->__('No')) 00211 ); 00212 00213 $name = $attribute->getAttributeCode(); 00214 return $this->_getSelectBlock() 00215 ->setName($name) 00216 ->setId($attribute->getAttributeCode()) 00217 ->setTitle($this->getAttributeLabel($attribute)) 00218 ->setExtraParams("") 00219 ->setValue($this->getAttributeValue($attribute)) 00220 ->setOptions($options) 00221 ->getHtml(); 00222 }
getAvailableCurrencies | ( | ) |
Definition at line 106 of file Form.php.
00107 { 00108 $currencies = $this->getData('_currencies'); 00109 if (is_null($currencies)) { 00110 $currencies = array(); 00111 $codes = Mage::app()->getStore()->getAvailableCurrencyCodes(true); 00112 if (is_array($codes) && count($codes)) { 00113 $rates = Mage::getModel('directory/currency')->getCurrencyRates( 00114 Mage::app()->getStore()->getBaseCurrency(), 00115 $codes 00116 ); 00117 00118 foreach ($codes as $code) { 00119 if (isset($rates[$code])) { 00120 $currencies[$code] = $code; 00121 } 00122 } 00123 } 00124 00125 $this->setData('currencies', $currencies); 00126 } 00127 return $currencies; 00128 }
getCurrency | ( | $ | attribute | ) |
Definition at line 135 of file Form.php.
00136 { 00137 return Mage::app()->getStore()->getCurrentCurrencyCode(); 00138 00139 $baseCurrency = Mage::app()->getStore()->getBaseCurrency()->getCurrencyCode(); 00140 return $this->getAttributeValue($attribute, 'currency') ? $this->getAttributeValue($attribute, 'currency') : $baseCurrency; 00141 }
getCurrencyCount | ( | ) |
Definition at line 130 of file Form.php.
00131 { 00132 return count($this->getAvailableCurrencies()); 00133 }
getDateInput | ( | $ | attribute, | |
$ | part = 'from' | |||
) |
Definition at line 258 of file Form.php.
00259 { 00260 $name = $attribute->getAttributeCode() . '[' . $part . ']'; 00261 $value = $this->getAttributeValue($attribute, $part); 00262 00263 return $this->_getDateBlock() 00264 ->setName($name) 00265 ->setId($attribute->getAttributeCode() . '_' . $part) 00266 ->setTitle($this->getAttributeLabel($attribute)) 00267 ->setValue($value) 00268 ->setImage($this->getSkinUrl('images/calendar.gif')) 00269 ->setFormat('%m/%d/%y') 00270 ->setClass('input-text') 00271 ->getHtml(); 00272 }
getModel | ( | ) |
Retrieve advanced search model object
Definition at line 248 of file Form.php.
00249 { 00250 return Mage::getSingleton('catalogsearch/advanced'); 00251 }
getSearchableAttributes | ( | ) |
Retrieve collection of product searchable attributes
Definition at line 60 of file Form.php.
00061 { 00062 $attributes = $this->getModel()->getAttributes(); 00063 return $attributes; 00064 }
getSearchPostUrl | ( | ) |