Daily Archives: June 16, 2013

Magento

How to get logged in user details in Magento?

Hello friends today I will explain you how to check the user is logged in or not and if it it logged in then how to fetch the detail of user in Magento.

For that you have to follow below code

<?php
 $CusSession=mage::getSingleton('customer/session');
    //Checking customer is logged in or not
    if($CusSession->isLoggedIn())
    {
        $customer    = $CusSession->getCustomer();    //get Customer object		
        $name        = $customer->getName();		
		$customerEmail = $customer->getEmail();
		$customerFirstname = $customer->getFirstname();
		$customerLastname = $customer->getLastname();		
		echo $customercustomername;
    }	
	else
	{
		echo "Customer is not logged in";
	}
?>

Hope it is helpful to you find customer details

Advertisements

Rules For Magento Developers.

The Rules are design by the Magento Commerce. So if you follow the below rules then it will help to developing a magento Application.

  • Rule 1: Do NOT edit the files in the base package
  • Rule 2: Do not create a custom theme inside of the base package
  • Rule 3: Create your customized themes inside of their own design package. Make directories atapp/design/frontend/your_custom_package/default andskin/frontend/your_custom_package/default and build your custom theme there.
  • Rule 4: Do not copy all the files from base/default into your custom package. Copy only the files that you modify.
  • Rule 5: Do not create your custom theme inside of the default/default directories, even though there are old instructions that may tell you to do so. This approach was never recommended.
  • Rule 6: Do not copy all the files from default/default into your custom package as a starting point, even though there are old instructions that may tell you to do so. This approach has been deprecated.
  • Exception to Rule 6: Because base/default does not contain full CSS files, you may want to copy the CSS from one of the demo themes into your new custom themes as a starting point. Many designers and developers prefer to start with nothing and build their CSS from scratch though, so you can do this too. In general, if you do copy over CSS and image files to your new custom package, the blank theme (default/blank) provides the leanest CSS.
  • 2nd Exception to Rule 6: Enterprise customers for now DO need to copy the files from enterprise/default into their custom package as a starting point. In a future release, the Enterprise files will be folded into the base/default directories but they are not in EEv1.8.
  • Rule 7: Break the rules if you have to, just do so knowingly.

All rules are taken from the 

http://www.magentocommerce.com/knowledge-base/entry/magentos-theme-hierarchy

Magento

Magento Fall-Back Hierarchy

Hello friends today I have write a article on Magento Fall-Back Hierarchy.

Magento is use fall-back hierarchy for rendering theme. Now a days it will also use the base package theme for rendering theme.

Lets take one example like in your magento custom theme folder there is one css folder custom.css  file. If any reason the magento will not got the custom.css file then it will check into custom theme default theme folder and if custom.css file fetch then it will render this css file otherwise it will go to the base package and find the custom.css file and render this file.  If in base folder the custom.css file is not found then it will shows the error message in console like “custom.css not found(404)“.

Step 1 : Magento first Look for requested file in

  • app/design/frontend/custom_package/custom_theme/
  • skin/frontend/custom_ package/custom_theme

Step 2 :If magento could not found, then look for requested file in

  • app/design/frontend/custom_package/default
  • skin/frontend/custom_package/default

Step 3 :If magento could not found, then look for requested file in

  • app/design/frontend/base/default
  • skin/frontend/base/default

Step 4 :If magento could not found, then it will rendering error will occur.

The Activity Flow of the Fall-Back Hierarchy

Fall-Back Hierarchy