joomla lost data in jos_session - joomla

$session = JFactory::getSession();
$session->set('domain_name', $domain_name, 'dominiForm');
then the table jos_session contains ...__dominiForm|a:2:{s:11:"domain_name";s:16:"safafasfsadfsfds";s:15:"tld_da_comprare";a:1:{i:0;s:3:".com";}}
I have checked that session life is 45mins in joomla control panel.
However without using set() or clear() it randomly(i think after a few minutes of pause) when i click "next" i end up with the database containing only this ...__dominiForm|a:0:{}
This happends both with 1.5 and 2.5.

I believe your problem exists with parts of the code that you haven't shown. It sounds like the $session->set() is getting called during a point when you aren't expecting it to be called, and it is empty at that point so it is overwriting the stored value with an empty value. Post more of your code and I may be able to point out where the issue is.

Related

Why I can't add a new variable to the Session in Classic ASP?

So, I thought that I could add a new element to the user Session to add some functionality.
I honestly thought I could do this:
SomeFunction(param1, NEWparam)
{
Session("MyNewParam") = NEWparam;
//So this would create a new session element called 'MyNewParam', right..?
...
}
That gets called when the user presses a button and then another webpage loads up.
The result, with this new line of code: The next web page doesn't load. Nothing happens.
Any and all comments are welcomed.
Solutions or helpful comments would be great.
Your syntax is right. However, I've run into an issue before where Classic ASP didn't want to take a session variable if it wasn't explicitly typed though. I'm not sure why this is, but it's worked for me in the past.
Session("MyNewParam") = parseInt(NEWparam);
Obviously, you could use String(), parseFloat()... or whatever. As I said, the syntax is right otherwise, so if the code isn't working you may want to start looking at other parts of the function that might be causing the problem.

Magento store view redirects not working in 1.8.0.0

I have a store I'm developing that has two store views, one for each language I'm supporting. The products and categories have localized url keys.
In 1.7.0.2 my language switcher would redirect correctly (for ones that had "Create Permanent Redirect" as well as ones with out) but after upgrading to 1.8.0.0, it did not work any more.
Problem
There is a regression in 1.8.0.0, they updated Mage_Core_Controller_Varien_Front to use ::_getRequestRewriteController() in ::dispatch() previously it used Mage_Core_Model_Url_Rewrite and now it uses Mage_Core_Model_Url_Rewrite_Request
On line 143 of app/code/core/Mage/Core/Model/Url/Rewrite/Request.php it has $stores = $this->_app->getStores(); which returns an array of store_id index stores, but it goes on to check if the store it goes on to check with $fromStore, which is a variable from the GET params, ___from_store, which contains the store views key (e.g. default, french, etc), obviously this has problems looking up using a alpha key in a numericly index array.
Solution
The offending line is again, #143 in app/code/core/Mage/Core/Model/Url/Rewrite/Request.php, by simpling changing it to $stores = $this->_app->getStores(false, true) it will work, as the 2nd parameter being true (defaults to false) returns the array with store view codes as the array key.
Hope this helps someone, and if anyone knows the best way to pass this on to the Magento developers, I would appreciate it, as I said, the issue reporting just posted to the home page, which doesn't seem to work.
Edit: I would also like to point out as 1.8.1.0 this is still an issue.

Google Analytics not tracking conversions in Magento 1.7

I'm using Magento's built in Googleanalytics module which is working fine for page views, but not for conversions. The account is set up fine on Google, but it's not adding the addTrans part in the checkout/onepage/success page.
I've done a lot of digging this morning, and found that the observer does observe the "checkout_onepage_controller_success_action" correctly, and does indeed run. It does the following:
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('google_analytics');
if ($block) {
$block->setOrderIds($orderIds);
}
I've done some echoing, and it does retrieve the block, and it also sets the order ids correctly. However, in the block itself, if I echo out $this->getOrderIds(); its empty.
My next thought was that perhaps it could be using two GA blocks on the page, and maybe its passing the data to the first one but echoing the HTML of the 2nd one, but I've no clue how to start checking that! The Googleanalytics.xml file only has one block it in, and I don't use that block name anywhere else!
Anyone experienced similar? Or have any idea where I can go from here?
EDIT:
The Ga.php block includes the transaction code if $this->getOrderIds() returns an array, which it is not doing. However, the observer is doing $block->setOrderIds($order_ids); which is passing through an array containing an order id. So the observer is passing the ids to the block, and the block is receiving them (setting up a method of setBlockIds and echoing out the argument, does show the array), but when the block tries to access its own data, it's suddenly not there ($block->getData() returns an array of properties but there is no order_ids property).
I also figured maybe it could be that its echoing the blocks HTML before setting the order id, so I added some variables in to check that and it's not that - its definitely setting the order_ids before trying to get them again, but its still not working!
I'm completely stumped! My only idea now is to modify the Ga.php block to use Magento's registry instead of it's own _data property, which is really not a nice way of doing it!
I think i've been an utter tool. Magento wasn't tracking conversions on the live site because I hadn't put the account code in the configuration part, but I had on my test site.
I had previously put my own analytics code in the template, so I had tracked page views.
When I saw no conversions (despite putting the account code in my test site), I started making orders on the test site and then viewing the source of the order success page. Firefox loads its source as a new request...which automatically goes to the empty basket page. So obviously, it wasn't showing the addTrans or anything, because it had already done that.
A quick check in firebug revealled it was working as it should.
So in the end, after a day of searching, I had to change "No" to "Yes" in the admin, and type in the account code. Great.

Is it possible to regenerate Code Igniter sessions manually?

As above: Is it possible to regenerate Code Igniter sessions manually? I'm looking for something similar to session_regenerate_id in PHP sessions, so that I could call it manually when a user went through privilege escalation.
Thanks,
Lemiant
CI automatically regenerates the session id every x seconds, which you can set in your config.
You could create a new function in Session.php the same as sess_update() but with the following removed from the top & the function renamed to regenerate_id().
// We only update the session every five minutes by default
if (($this->userdata['last_activity']+$this->sess_time_to_update) >= $this->now)
{
return;
}
This will regenerate the session id, update users_activity and keep the users data. Just call it by $this->session->regenerate_id();
I know this is an old post, but I came across it, so others might too.
You could also do the following so you don't have to hack the core files at all (making codeigniter more easily upgradable with future releases):
//Setting this to 0 forces the sess_update method to regenerate on the next call
$this->session->sess_time_to_update=0;
//Call the sess_update method to actually regenerate the session ID
$this->session->sess_update();
Credit to the original answer for leading me down this path though, thank you.

Getting a blank data report vb6

I am new to vb6. I am working to create the invoice generation application. I am using data report to show the generated invoice.
The step by step working of process is:
Entering the data in to Invoice and ItemsInvoice tables.
Then getting the maxId using (Adodc) from the data base to show the last generated Invoice.
Then passing the max Id as parameter to the data report which is showing the invoice according to the invoice id.
It is working fine when I first time generate invoice. Now for 2nd invoice without closing application I am getting a blank data report. For data report I am using dataenvironment.
I am guessing the reason the data report is blank is because there was no record for that Id, but actually the record is inserting in the database.
What is going wrong?
I'm not sure how your data set is getting configured, but it sounds like you have a single record in the data and aren't reloading it properly. If your report is manually moving through the recordset and only showing info based on the ID parameter you are passing it and then using the same recordset for the second report, you probably just need to MoveFirst on the recordset to put it back at the beginning.
Load the data environment and refresh the data report.
I am also generating report in the similar fashion. I faced this problem. Here's the solution
Load DataEnvironment1
With DataEnvironment1
'Command1 is the command added to data environment where you fire query or
'set it to point to a table
If .rsCommand1.State <> 0 Then .rsCommand1.Close
.Command1 maxid 'parameter you pass to the recordset
End With
DataReport1.Refresh
DataReport1.Show
Thats it!
You are done. I m sure it will work. Do tell me if it doesn't.
I don't know if the answer will still bother you, but if someone else have the same problem here is a example of how the problem works:
Imagine that there is a gate and a guard looking who is entering, when the first person (the first invoice) comes, the guard registers him, opens the gate (This is the event "Load DataEnvironmet") and then lets the guy pass. The guard believes that no one else would come and lets the door open (the instruction believes that the DataEnvironment ends and the value EOF becomes True), but when the second guy comes (the second invoice) the guard can't ask him who is (has, again, the value and lets it pass without registering him (this is the reason why the second invoice, and subsequent in while invoice would come blank). The solution is to close the gate ("Unload DataEnvironment") after a guy passes (After showing the data report).
The solution is the code given from Sangita above, but just before ending the sub you need to unload the DataEnvironment you were working on.
For me, it works. Sorry if the answer is not what you were looking for (and also if someone else can't understand what I'm writing, my English isn't very good). Just in case I will write the code with the solution
Load DataEnvironment1
With DataEnvironment1
If .rsCommand1.State <> 0 Then
.rsCommand1.Close
End If
.Command1 Value(ID)
End With
DataReport1.Refresh
DataReport1.Show
Unload DataEnvironment1
Try a refresh method like data1.recordset.requery or
Data1.refresh. This should work if you use data controls.

Resources