Redirect logged in customer to account page when accessing a cms page

1. Call a custom template from your cms/page.

{{block type="core/template" name="visitor_page" template="YourTemplateFolder/TemplateFileName.phtml"}}

2. Then in your .phtml add the following code. For example

$logged_in = Mage::getSingleton('customer/session' )->isLoggedIn();
if ($logged_in){
$url = Mage::getUrl('customer/account');

Magento 2 Enterprise Database Scaling

Magento 2 EE design give more importance to how magento can scale without much effort.  As a part this, magento 2 database can be split into 3 master databases.

  • One master database for checkout tables
  • One master database for order management system (OMS) tables
  • One master database for the remainder of the Magento 2 application tables

Checkout, orders, and product data can all each use a separate master databases that you can optionally replicate. This separation independently scales load from website checkouts, order management activities, website browsing, and merchandising activities, depending on your needs. These changes provide considerable flexibility in how the database tier can be scaled.Splitting of database also helps in managing the databases like backup, restoring etc, for a single large databases these tasks are tedious.

For scaling further more you can add slave databases for each master DB and so you can scale to any limit in server clusters using load balancers. This feature is not available in Magento 2 community edition 🙁


Different product types in Magento

Magento has various product types which all have completely or slightly different functions.Sometimes you might stuck between different products types, being confused which exactly is needed.It’s nice to take them all in consideration before choosing the Magento product type for your products.
Here’s a quick overview of Magento product types to guide you what product type might be suitable for you.

There are 6 different product types in Magento.

1. Simple Products
2. Grouped Products
3. Configurable Products
4. Virtual Products
5. Bundled Products
6. Downloadable Products

1. Simple Products

As the name suggests simple product is best suited for products that require no-options, that are very basic.There are no options like size or color that the customer can pick during the order.Let’s say you’re selling a Leather Wallet. That’s a simple product.

2. Grouped Products

Grouped product is a collection of simple products that “fit” together.For example, let’s say you want to sell a set of a mobile phone,memory card and wireless charger. Each of those items would be simple products and available for purchase individually. But they are available as a set and are suitable for promotional purposes featuring related items. User may want to take advantage of the mobile phone set’s special price than purchasing all three products separately.

3. Configurable Products

Configurable products are products that have multiple options.For example, a ball comes in three colors and two sizes. Here we will have a single Configurable product with two options: size and color; that ties six simple products.You would create six Simple Products individually and then group these six as a Configurable Product; allowing customers to select which size and color they wish to buy.Stock, price and other product attributes are managed on the simple product’s level.

4. Virtual Products

A virtual product is special type of simple product.They cannot be shipped, downloaded or delivered in any way.It’s designed to be a service that you offer.Services like an online training course,insurance policies and warranty agreements are good examples of virtual products.

5. Bundled Products

A bundled product allows you to build a product, using choices.For example if someone is buying a Customizable Computer System then user must have some options to select Ram and Hard Disc size,processors and configuration according to his/her choice before buying it.In other words Bundle product is like a set of simple/configurable products,but you cannot skip any of its components.Bundled Products allow discounts on the underlying Simple Products.The final price of the product will depend on what the customer selects as options.

6. Downloadable Products

Magento Downloadable products are products that can be downloaded from your website. It can be anything from an eBook to a power point presentation.Downloadable Products are similar to Virtual Products, with the option to add one or more files for download.This category might include products such as: Music/MP3s, Computer Software, ebooks, emagazines, Magento extensions etc.


I hope this helps!!!

How to access magento functions in a file that is residing outside of magento folder?

In order to do this we have to include the Mage.php(app/Mage.php) file residing in app folder of magento to our file which resides outside of magento folder.

// Include Magento application
require_once ( “/var/www/your-magento-directory/app/Mage.php” );

// Initialize Magento

// You have two options here,
// “frontend” for frontend session or “adminhtml” for admin session
Mage::getSingleton(“core/session”, array(“name” => “frontend”));

For example here i will demonstrate how we can check a whether a magento customer is logged in or logged out .

$session = Mage::getSingleton(“customer/session”);

echo “Logged in”;
echo “Not logged in”;

Hope this helped you a lot!!!!!!!!

How to get common URLS in Magento?

By calling the magento function with proper argument we can get our required Urls(Mage::getBaseUrl(argument)).

Example :
To get Baseurl

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
// http://siteaddress/

To get Skinurl

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
// http://siteaddress/skin/

To get Mediaurl

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
// http://siteaddress/media/

To get baseurl with index.php

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
// http://siteaddress/index.php/

To get Jsurl

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
// http://siteaddress/js/