Here you go guys
Go to Session.pm file, which is located under Original.
We'll requre to edit some field, to be able read and write values from the xml and store it in session, for further processing:
starting from line: 30
# XML main entry names
#
$Session::XML_ROOT = 'SessionFile'; # the root XML entry
$Session::XML_URLINFO = 'URLInfo';
$Session::XML_CHECKOUTINFO = 'CheckoutInfo';
$Session::XML_SHOPPINGCART = 'ShoppingCart';
add your own XML_NODE, where you'll be locating your values, I potentially required to store Client's Credit Card details, thus I named it:
$Session::XML_CCDETAILS = "CCDetails";
then in Init Base structure, line 138
add your initialization of the node
$Self->{_SESSIONINFO}->SetTextNode($Session::XML_CCDETAILS, "");
then you need to creat a function, which will return you the node object, we need our node XML_CCDETAILS, thus add anywhere
sub GetCCInfo
{
my $Self = shift;
return $Self->{_SESSIONINFO}->GetChildNode($Session::XML_CCDETAILS);
}
and we need to write two other functions, for writing and reading, which will be storing our values under XML_CCDETAILS node, and retrieve them later.
Writing function:
sub SetCCValue
{
my $Self = shift;
my $CCParam = shift;
my $CCValue = shift;
$Self->GetCCInfo()->SetTextNode($CCParam, $CCValue);
}
as you see, takes two arguments, CCParam , which is the name of the param, and CCValue - Value of the object.
To retrieve your values, we need to create read function:
sub GetCCValue
{
my $Self = shift;
my $CCParam = shift;
my $CCValue = $Self->GetCCInfo()->GetChildNode($CCParam)->GetNodeValue();
return $CCValue;
}
you can add additional checkings for pottnetional null and etc.
That's it, that all changes you are making to Session.pl, then at any place, in OrderScripting, or PSP templates, you have an access to $::Session
because it is initialized by Actinic, and is Global.
So, to Store the values we need, just simply writing:
$::Session->SetCCValue('CCNumber','1231231232');
$::Session->SetCCValue('TEST1','one two three');
$::Session->SetCCValue('TEST2','gold');
you'll have this values in your *.session file:
<CCDetails>
<CCNumber>1231231232</CCNumber>
<TEST1>one two three</TEST1>
<TEST2>gold</TEST2>
</CCDetails>
to retrieve them back:
use my $variable = $::Session->GetCCValue('CCNumber');
where $variable will have the value 1231231232;
YOu can do encryption and whatever you want. So Use it
And remember, try do the minimum changes in system files, 'cause this potentially gives you the possibilty to experience troubles after updating Actinic version.
Go to Session.pm file, which is located under Original.
We'll requre to edit some field, to be able read and write values from the xml and store it in session, for further processing:
starting from line: 30
# XML main entry names
#
$Session::XML_ROOT = 'SessionFile'; # the root XML entry
$Session::XML_URLINFO = 'URLInfo';
$Session::XML_CHECKOUTINFO = 'CheckoutInfo';
$Session::XML_SHOPPINGCART = 'ShoppingCart';
add your own XML_NODE, where you'll be locating your values, I potentially required to store Client's Credit Card details, thus I named it:
$Session::XML_CCDETAILS = "CCDetails";
then in Init Base structure, line 138
add your initialization of the node
$Self->{_SESSIONINFO}->SetTextNode($Session::XML_CCDETAILS, "");
then you need to creat a function, which will return you the node object, we need our node XML_CCDETAILS, thus add anywhere
sub GetCCInfo
{
my $Self = shift;
return $Self->{_SESSIONINFO}->GetChildNode($Session::XML_CCDETAILS);
}
and we need to write two other functions, for writing and reading, which will be storing our values under XML_CCDETAILS node, and retrieve them later.
Writing function:
sub SetCCValue
{
my $Self = shift;
my $CCParam = shift;
my $CCValue = shift;
$Self->GetCCInfo()->SetTextNode($CCParam, $CCValue);
}
as you see, takes two arguments, CCParam , which is the name of the param, and CCValue - Value of the object.
To retrieve your values, we need to create read function:
sub GetCCValue
{
my $Self = shift;
my $CCParam = shift;
my $CCValue = $Self->GetCCInfo()->GetChildNode($CCParam)->GetNodeValue();
return $CCValue;
}
you can add additional checkings for pottnetional null and etc.
That's it, that all changes you are making to Session.pl, then at any place, in OrderScripting, or PSP templates, you have an access to $::Session
because it is initialized by Actinic, and is Global.
So, to Store the values we need, just simply writing:
$::Session->SetCCValue('CCNumber','1231231232');
$::Session->SetCCValue('TEST1','one two three');
$::Session->SetCCValue('TEST2','gold');
you'll have this values in your *.session file:
<CCDetails>
<CCNumber>1231231232</CCNumber>
<TEST1>one two three</TEST1>
<TEST2>gold</TEST2>
</CCDetails>
to retrieve them back:
use my $variable = $::Session->GetCCValue('CCNumber');
where $variable will have the value 1231231232;
YOu can do encryption and whatever you want. So Use it
And remember, try do the minimum changes in system files, 'cause this potentially gives you the possibilty to experience troubles after updating Actinic version.
Comment