if(!empty($post)) { $translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false); try { $name = $_POST['name'];
$email = $_POST['email']; $to_admin =
Mage::getStoreConfig('trans_email/ident_general/email'); $name_admin =
Mage::getStoreConfig('trans_email/ident_general/name'); $subject =
'Contact Us'; /*$vars = array('Name'=>$name, 'Email Id' =>$email ); */
//const EMAIL_TEMPLATE_XML_PATH = 'customer/testemail/email_template';
//$templateId = Mage::getStoreConfig(EMAIL_TEMPLATE_XML_PATH);
$templateId=1; $sender = array('name' => $name,'email' => $email);
$translate=Mage::getModel('core/email_template')
->setTemplateSubject($subject) ->sendTransactional($templateId, $sender,
$to_admin, $name_admin, array('data' => $vars));
$translate->setTranslateInline(true);
Mage::getSingleton('core/session')->addSuccess(Mage::helper('customer')->__('Data
Sent Successfully')); $url = Mage::getUrl().'thanks';
Mage::app()->getFrontController()->getResponse()->setRedirect($url); }
catch (Exception $e) {
Mage::getSingleton('core/session')->addError(Mage::helper('customer')->__('Unable
to send email.')); $url = Mage::getUrl().'contactus';
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
return; } }
Search This Blog
Sunday, July 17, 2011
Friday, July 15, 2011
admin store email magento general contacts email or Magento: Store Mail Addresses
//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');
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');
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());
Subscribe to:
Posts (Atom)