如果我理解正确,只需检查客户是否已登录,但为了使用 PHP,您将不得不使用模板系统并创建一个模块,或者生成您自己的“独立页面”如果您走模块路线:
if ($this->helper('customer')->isLoggedIn()){
//show page contents or do whatever ..
}
else{
header( 'Location: http://www.yoursite.com/customer/account/login/' ) ;
}
就是你所需要的。如果你走独立路线:
//LOAD MAGENTO
require_once 'YOUR_PATH_TO_MAGENTO/app/Mage.php';
umask(0);
Mage::app('YOUR_WEBSITE_CODE', 'website');
//GET SESSION DATA
Mage::getSingleton('core/session', array('name'=>'frontend'));
$session = Mage::getSingleton('customer/session', array('name'=>'frontend'));
$customer_data = Mage::getModel('customer/customer')->$session->id);
//CHECK IF LOGGED IN
if($session->isLoggedIn()){
echo 'Welcome ' . $customer_data->firstname . " " . $customer_data->lastname;
} else {
echo "Access Denied: Sorry, but this page is for registered members only.";
exit;
}
希望有帮助