Last active
August 23, 2019 00:41
-
-
Save aleron75/190b25ea621c14a21d6b to your computer and use it in GitHub Desktop.
Magento runtime for Customer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Prevent this script to be called via HTTP | |
if (isset($_SERVER['REQUEST_METHOD'])) | |
{ | |
die('Permission denied.'); | |
} | |
// Avoid any time limit | |
set_time_limit(0); | |
// Avoid any memory limit | |
ini_set('memory_limit', -1); | |
// Include bootstrap code and Mage class | |
require_once 'app/Mage.php'; | |
// Enable developer mode | |
Mage::setIsDeveloperMode(true); | |
// Set the default file creation mask | |
umask(0); | |
// Init application with default store | |
Mage::app(); | |
// Load frontend config area | |
Mage::app()->loadArea(Mage_Core_Model_App_Area::AREA_FRONTEND); | |
// Initialize customer session | |
$userModel = Mage::getModel('customer/customer'); | |
$customer = $userModel->load(1); // change customer id here | |
$customerSession = Mage::getSingleton('customer/session'); | |
$customerSession->setCustomerAsLoggedIn($customer); | |
$customerSession->renewSession(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment