In this tutorial, we are going to see all the different form fields we can use in admin forms.
Magento has many different type of field available by default, so lets see the syntax of using each of these fields. This tutorial is in continuation of the previous tutorial so the same classes will be used as in the previous post.
All the code’s written below are written in the class Excellence_Form_Block_Adminhtml_Form_Edit_Tab_Form inside the _prepareForm() function as shown in previous tutorial. All the different type of form fields available in magento are located in folder lib\Varien\Data\Form\Element
http://www.excellencemagentoblog.com/magento-admin-form-field
Search This Blog
Monday, April 2, 2012
Friday, February 17, 2012
change address bar search to google
change address bar search to google
1. In Firefox type about:config in the address bar and press ENTER.
2. Locate and double-click the entry for keyword.URL
3. Set the value based on which search provider you would like to use for your address bar searches. Here are a few search strings you can use.
Yahoo: http://search.yahoo.com/search?p=
Ask: http://www.ask.com/web?q=
Bing: http://www.bing.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=
Google: http://www.google.com/search?&q=
1. In Firefox type about:config in the address bar and press ENTER.
2. Locate and double-click the entry for keyword.URL
3. Set the value based on which search provider you would like to use for your address bar searches. Here are a few search strings you can use.
Yahoo: http://search.yahoo.com/search?p=
Ask: http://www.ask.com/web?q=
Bing: http://www.bing.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=
Google: http://www.google.com/search?&q=
Tuesday, February 14, 2012
mysql IN query without changing the order and maintaining the input order
mysql IN query without changing the order
e.g
SELECT FROM emp WHERE (id in ('10001', '10004','10003','10025')) ORDER BY FIELD (id,'10001', '10004','10003','10025')
this will maintain the order of 1,4,3,5
instead of the regular 1,3,4,5
e.g
SELECT FROM emp WHERE (id in ('10001', '10004','10003','10025')) ORDER BY FIELD (id,'10001', '10004','10003','10025')
this will maintain the order of 1,4,3,5
instead of the regular 1,3,4,5
Friday, February 10, 2012
Magento retrive product attribute like image
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('image')
->addFieldToFilter('sku', 'mysku');
$productsName = array();
foreach($products as $p){
$productsName[] = $p->getData('image');
}
print_r($productsName);
->getCollection()
->addAttributeToSelect('image')
->addFieldToFilter('sku', 'mysku');
$productsName = array();
foreach($products as $p){
$productsName[] = $p->getData('image');
}
print_r($productsName);
Thursday, January 19, 2012
Extrending helper class in magento or creating magento helper object or over riding magneto helper class or object
In the config file of the class e.g catalog.xml
below example if i want to over right catalog helper class of core top my custom made class
Mymodule_Catalog_Helper_Myclass // for Myclass.php in catalog
below example if i want to over right catalog helper class of core top my custom made class
Wednesday, January 18, 2012
Save single,one,few,array of attributes or single attribute or attributes without the entire whole product or saving a product without sql queries
Save single,one,few,array of attributes or single attribute or attributes without the entire whole product or saving a product without sql queries
$pidArray[]=array(1=>"181");
Mage::getSingleton('catalog/product_action')
->updateAttributes($pidArray, array('name' => 'name of product'), 0);
$pidArray[]=array(1=>"181");
Mage::getSingleton('catalog/product_action')
->updateAttributes($pidArray, array('name' => 'name of product'), 0);
Thursday, January 12, 2012
magento select multiple coloumn with like attribute from a table using magento query colelction
magento select multiple coloumn with like attribute from a table using magento query colelction
If I want to select a value from 2 or more columns i will use the below code in magento collection
$collection = Mage::getModel('module/module')->getCollection()->addAttributeToSelect('*')->addFieldToFilter(array(0=>'col1',1=>'col2'),array(0=>array('like' => '%'.$cond.'%'),1=>array('like' => '%'.$cond.'%')));
The result
SELECT `main_table`.`*` FROM `table` AS `main_table` WHERE (((col1 like '%cond%') or (col2 like '%cond%')))
If I want to select a value from 2 or more columns i will use the below code in magento collection
$collection = Mage::getModel('module/module')->getCollection()->addAttributeToSelect('*')->addFieldToFilter(array(0=>'col1',1=>'col2'),array(0=>array('like' => '%'.$cond.'%'),1=>array('like' => '%'.$cond.'%')));
The result
SELECT `main_table`.`*` FROM `table` AS `main_table` WHERE (((col1 like '%cond%') or (col2 like '%cond%')))
Subscribe to:
Posts (Atom)