thanks for your quick feedback, Smurkas.
I have tried to clean all session before calling magento mage functions.
public function init(){
Session::clear_all();
//docroot
$site_path=realpath(dirname(__FILE__) . '/../..' );
//init magento connection
require_once "$site_path/shop/app/Mage.php";
Mage::app('default');
umask(0);
$session = Mage::getSingleton('customer/session');
var_dump(Mage::getSingleton('customer/session')->isLoggedIn());
$customer_data = Mage::getModel('customer/customer')->$session->id;
Debug::show(var_dump(Session::get_all()));
//CHECK IF LOGGED IN
if(Mage::getSingleton('customer/session')->isLoggedIn()){
Debug::show( 'Welcome ' .$session = Mage::getSingleton('customer/session')->getCustomer()->getName());
}
}
however, it still return flase by some resaon.
well, i have just pick up a interesting stuff by relevant to the problem.
on my standalone test.php (which worked) :
i try to dump the session core
echo var_dump($_SESSION['core']);
it looks like :
array(6) { ["_session_validator_data"]=> array(4) { ["remote_addr"]=> string(9) "127.0.0.1" ["http_via"]=> string(0) "" ["http_x_forwarded_for"]=> string(0) "" ["http_user_agent"]=> string(63) "Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0" } ["session_hosts"]=> array(1) { ["testdomain.dev"]=> bool(true) } ["messages"]=> object(Mage_Core_Model_Message_Collection)#38 (2) { ["_messages:protected"]=> array(0) { } ["_lastAddedMessage:protected"]=> NULL } ["just_voted_poll"]=> bool(false) ["visitor_data"]=> array(19) { [""]=> NULL ["server_addr"]=> int(2130706433) ["remote_addr"]=> int(2130706433) ["http_secure"]=> bool(false) ["http_host"]=> string(15) "testdomain.dev" ["http_user_agent"]=> string(63) "Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0" ["http_accept_language"]=> string(14) "en-gb,en;q=0.5" ["http_accept_charset"]=> string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.7" ["request_uri"]=> string(14) "/shop/customer" ["session_id"]=> string(26) "a1tdof021stiagvq158m7m1770" ["http_referer"]=> string(0) "" ["first_visit_at"]=> string(19) "2011-08-28 22:58:10" ["is_new_visitor"]=> bool(false) ["last_visit_at"]=> string(19) "2011-08-28 23:12:05" ["visitor_id"]=> string(2) "41" ["last_url_id"]=> string(3) "794" ["do_customer_login"]=> bool(false) ["customer_id"]=> string(1) "1" ["customer_log_id"]=> string(1) "5" } ["last_url"]=> string(46) "http://testdomain.dev/shop/cms/index/noRoute/" }
but if i do the same in silverstripe end inside init();
it returns only part of the obejct. strange @@
array(2) { ["core"]=> array(2) { ["_session_validator_data"]=> array(4) { ["remote_addr"]=> string(9) "127.0.0.1" ["http_via"]=> string(0) "" ["http_x_forwarded_for"]=> string(0) "" ["http_user_agent"]=> string(63) "Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0" } ["session_hosts"]=> array(1) { ["nelsonhoney.dev"]=> bool(true) } } }