I created a module with a hook on hookActionCartSave, which work very well.
Then I created a simple php file in same folder has my module that listent to a POST and I try to save a parameter value in global variable that my hook could get back once the use add something to the cart (i.e. tirgger hookActionCartSave).
1. My new file (setParam.php) has the following very simple code, it takes the POST parameter 'param1' and put his value in superglobal $_ENV , var_dump($_ENV["param1"]); show me that it sets it correctly.
<?php
define('_EXTERNAL_SCRIPT_', 'true');
include(dirname(__FILE__).'../../config/config.inc.php');
include(dirname(__FILE__).'../../init.php');
include(dirname(__FILE__).'../../classes/Cookie.php');
$_ENV["param1"] = $_POST['param1'];
var_dump($_ENV["param1"]);
?>
2. But then I my module $_ENV is always empty, it seems that $_ENV is not shared or ...??
...
function hookActionCartSave($params) {
var_dump($_ENV["param1"]);
}
...
I tried with $_COOKIE, $GLOBALS, $_SESSION and I not able to add value to global context from my setParam.php file.
Any idea how I can add value to the current session context from a standalone file that receive a post from the UI (jquery ajax post)?
Thanks - Alain