B-219 Sec-55 Noida, India
+918010221733

Use Magento Outside of Install Directory

One of the coolest parts of using Magento is that it can be accessed from different parts of the server even if you’re not within the Magento root Directory then also you can access it’s functionlity

The main important or you can say life of magento is Mage.php, we need to access Mage.php because It holds the Mage class and defines some of the root functionality of Magento like retrieving the model, setting up the BaseUrl path and calling the rest of the

Create one file called test.php and and add the below code
 

require_once ‘/your-path-upto/Mage.php’;

umask(0);

Mage::app(‘default’);

That’s it Magento will get access from outside and it is ready for work

For Accsssing the Customer login Session we can use

Mage::getSingleton(‘core/session’, array(‘name’ => ‘frontend’));
$session = Mage::getSingleton(‘customer/session’);       
Zend_Debug::dump($session->isLoggedIn());

In this way we can called all product collection,sales model,checkout etc…..

Hope You this will help you!

(Visited 50 times, 1 visits today)

Leave a reply