magento - including php file in the root folder -
i have product page in magento have drop down menu , submit button. when choose value drop down menu , click submit, send request file called other.php in root of magento installation.
this fine.
on page set session variable $_session['mygroupid'] , have echoed out know that's ok.
when go redirect referring page, $_session['mygroupid']
not persisting. have included session_start();
on required pages.
i suspect it's because i'm breaking out of magento's world here, off php file created in root , again page in magento's world.
can tell me need in order "teach" magento other.php file part of overall set up, , need include allow session variable persist across pages?
i saw link looks similar problem, i'm new magento , don't quite understand information in it.
https://magento.stackexchange.com/questions/8147/adding-magentos-required-structure-to-a-php-file
you need add below code @ top of external file.
<?php require_once('app/mage.php'); //path magento umask(0); mage::app('default'); //get session object $session = mage::getsingleton("core/session", array("name"=>"frontend")); $groupid = $session->getmygroupid();
you need define session in page
$data = 'groupid'; mage::getsingleton('core/session')->setmygroupid($data);
let me know if having issues.
Comments
Post a Comment