How to create cms pages dynamically

Here is code for CMS Pages dynamically…. $magentoCms = array( ‘title’ => ‘Magento CMS Page’, ‘identifier’ => ‘magento-cms’, ‘content’ => ‘Magento CMS Page Magento CMS Page Magento CMS Page Magento CMS Page’, ‘is_active’ => 1, ‘sort_order’ => 0, ‘stores’ => array(0), ‘root_template’ => ‘three_columns’ ); Mage::getModel(‘cms/page’)->setData($magentoCms)->save(); Hope it will work.

Continue Reading

How to show Top Menu Alphabetically in Magento?

This is very simple just copy below code and paste in topmenu.phtml. Here will show up to third level. If don’t need third level just remove sub sub category code. <?php # get category list ?> <?php $_helper = Mage::helper(‘catalog/category’) ?> <?php $_categories = $_helper->getStoreCategories() ?> <?php function array_sort($array, $on, $order=SORT_ASC) { $new_array = array(); $sortable_array = array(); if (count($array) …

Continue Reading

How to change hello from My Dashboard in Magento?

This is very simple change.Please follow below step: Please go to below file: \app\design\frontend\<Your_Theme>\template\customer\account\dashboard\hello.phtml You will get line:28 Change from: <h2><?php echo $this->__(‘hello,%s!’, $this->htmlEscape($this->getCustomerName())) ?></h2> Change to: <h2><?php echo $this->__(‘WelCome %s!’, $this->htmlEscape($this->getCustomerName())) ?></h2> // You can change with your suitable string like “Welcome” or others Hope it will work.

Continue Reading

How to show Subcategory Alphabetically in Magento?

Just copy and paste in your page like list.phtml or home.phtml <?php $cats = Mage::getModel(‘catalog/category’)->load(51)->getChildren(); $catIds = explode(‘,’,$cats); $categories = array(); foreach($catIds as $catId) { $category = Mage::getModel(‘catalog/category’)->load($catId); $categories$category->getName() = $category->getUrl(); } ksort($categories, SORT_STRING); ?> <ul> <?php foreach($categories as $name => $url): ?> <li> <a href=”<?php echo $url; ?>”><?php echo $name; ?></a> </li> <?php endforeach; ?> </ul> Hope it will …

Continue Reading

How do I call a static block inside top.phtml

This is very simple call to a static block in top.phtml. At first create a static block from magento admin panel.Like block identifer name is “speciall_message”. Now go to your top.phtm file and paste below code. <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘speciall_message’)->toHtml() ?> Hope it will work.  

Continue Reading

Check condition for login-logout in magento

Check condition for login-logout in magento This is very simple login and logout condition in magento. Just understand this code. First if condition for login area And else condition for logout area. <?php if (! Mage::getSingleton(‘customer/session’)->isLoggedIn()): ?> <a href=”<?php echo Mage::helper(‘customer’)->getLoginUrl(); ?>”><?php echo $this->__(‘Login’) ?></a> // this is login area. you can add you custom code with alter anchor link. …

Continue Reading

How to add custom message in success page in magento.

How to add custom message in success page in magento. IT is very simple.You can costum message  add in your success page. Please goto app\design\frontend\<your theme>\template\checkout\success.phtml If not get success.phtml in your theme please go base theme and copy success.phtml and paste in your theme checkout folder. add following code or your custom message. Like as <p><?php echo $this->__(‘<a href=”mailto:borntowinanwar@gmail.com”> …

Continue Reading

How to enable template path hints in Magento?

How to enable Template Path Hints in Magento? Template Path Hints is the one of the most important Feature in Magento for Developer and Designer .If you want to Modify of a Magento template then Template Path Hints will help you to find the actual location where the .phtml file located. Please follow below step. In admin panel Go to …

Continue Reading