Posts Tagged Magento
Magento – check if user logged in
Many times, you may want to check if a user is logged in while using Magento, to do so, you could use one of the many helper function to do so. The top class for it is Class Mage_Customer_Helper_Data, the method we are going to use is isLoggedIn(), let’s write a simple script to check if a user is logged in:
<?php
if ($this->helper('customer')->isLoggedIn() ) {
echo "Welcome!";
} else {
echo "Please log in.";
}
?>
Magento Display Product SKU
If you happen to use Magento to develop your e-commerce site, and want to display SKU number on your product page, here is how you can use the magic method getSku to do it. On your app/design/frontend/default/default/template/catalog/product/view.phtml page, add in the line below:
<?php echo 'RN #'.nl2br($_product->getSku()) ?>










































