//General contact
Mage::getStoreConfig('trans_email/ident_gerneral/name');
Mage::getStoreConfig('trans_email/ident_gerneral/email');
//Sales Representative
Mage::getStoreConfig('trans_email/ident_sales/name');
Mage::getStoreConfig('trans_email/ident_sales/email');
//Customer Support
Mage::getStoreConfig('trans_email/ident_support/name');
Mage::getStoreConfig('trans_email/ident_support/email');
//Custom email1
Mage::getStoreConfig('trans_email/ident_custom1/name');
Mage::getStoreConfig('trans_email/ident_custom1/email');
//Custom email2
Mage::getStoreConfig('trans_email/ident_custom2/name');
Mage::getStoreConfig('trans_email/ident_custom2/email');
Search This Blog
Friday, July 15, 2011
Tuesday, July 12, 2011
Magento get path id or getpathids function to get parent category untill or upto root category
Magento get path id or getpathids function to get parent category untill or upto root category
getPathIds ()
Get array categories ids which are part of category path Result array contain id of current category because it is part of the path
Returns:
array
Definition at line 584 of file Category.php.
00585 {
00586 $ids = $this->getData('path_ids');
00587 if (is_null($ids)) {
00588 $ids = explode('/', $this->getPath());
00589 $this->setData('path_ids', $ids);
00590 }
00591 return $ids;
00592 }
getPathIds ()
Get array categories ids which are part of category path Result array contain id of current category because it is part of the path
Returns:
array
Definition at line 584 of file Category.php.
00585 {
00586 $ids = $this->getData('path_ids');
00587 if (is_null($ids)) {
00588 $ids = explode('/', $this->getPath());
00589 $this->setData('path_ids', $ids);
00590 }
00591 return $ids;
00592 }
magento reference doc or documents or docs
magento reference doc or documents or docs
http://freegento.com/doc/
http://freegento.com/doc/
Friday, July 8, 2011
Magento sql queries or queries or query in magento
getConnection('core_read');
//make connection
$qry = "select name FROM user_data WHERE id=1 LIMIT 1 "; //query
$res = $read->fetchRow($qry); //fetch row
$name = $res['name']; //outputs name
//other form
$qry = "select name FROM user_data WHERE namer LIKE '%a%' ";//query
$res = $read->fetchAll($qry); //get array
//Insert query
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "INSERT INTO user_data values (?,?)"; //insert query
$write->query($sql, array('name','pass')); //write to database
?>
//make connection
$qry = "select name FROM user_data WHERE id=1 LIMIT 1 "; //query
$res = $read->fetchRow($qry); //fetch row
$name = $res['name']; //outputs name
//other form
$qry = "select name FROM user_data WHERE namer LIKE '%a%' ";//query
$res = $read->fetchAll($qry); //get array
//Insert query
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "INSERT INTO user_data values (?,?)"; //insert query
$write->query($sql, array('name','pass')); //write to database
?>
Tuesday, July 5, 2011
Magento get root category id or magento getRootCategory or function to get root category id or magento getRootCategory()
Mage::app()->getWebsite(true)->getDefaultStore()->getRootCategoryId()
magento get parent category of or from current category
You can get current category from the following code:
$currentCategory = Mage::registry('current_category');
You can get the parent category from the following code:
/**
* You want the parent category of a sub-category
* Let the sub-category be $subCategory
*/
$parentCategory = Mage::getModel('catalog/category')->load($subCategory->getParentId());
$currentCategory = Mage::registry('current_category');
You can get the parent category from the following code:
/**
* You want the parent category of a sub-category
* Let the sub-category be $subCategory
*/
$parentCategory = Mage::getModel('catalog/category')->load($subCategory->getParentId());
Wednesday, June 1, 2011
Magento - How to run a SQL query against the database
$db = Mage::getResourceSingleton('core/resource')->getConnection('core_write');
$result = $db->query('SELECT 'entity_id' FROM 'catalog_product_entity');
if(!$result) {
return FALSE;
}
$rows = $result->fetch(PDO::FETCH_ASSOC);
if(!$rows) {
return FALSE;
}
print_r($rows);
$result = $db->query('SELECT 'entity_id' FROM 'catalog_product_entity');
if(!$result) {
return FALSE;
}
$rows = $result->fetch(PDO::FETCH_ASSOC);
if(!$rows) {
return FALSE;
}
print_r($rows);
Subscribe to:
Posts (Atom)