• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Session variable not passed to redirected Fabrik pages on first try in a session, subsequent tries a

ronhon

New Member
Hi guys, I hope you can help me,

I connected some Fabric screens with redirects to build a taylor made shopping cart. In the first attempt to register and buy something, a session variable is set in the first page but not accessible in the next pages. However if the shopping cart is selected a second or more times after in the same session, everything runs well. Please find the screen flow below

  1. Start with ?Register as a new Student?
    • After submit, a shopping cart header record is created
    • In a php (end of form submission) plugin the header record id is saved in a session variable:

session_start();

$_SESSION['shoppingcart_id'] = $this->data['cexman_shoppingcart_header___id_raw'];

while (!is_numeric($_SESSION['shoppingcart_id'])) {

$_SESSION['shoppingcart_id'] = $this->data['cexman_shoppingcart_header___id_raw'];

} The While is only for testing, to make absolutely sure that the variable is set.

  • Go to the shopping cart list with a redirect plugin :
    • Jump page: index.php/shopping-cart
    • Append jump url and Use as search data set to No

  1. ?Shopping Cart list?
    • Custom Add url : ./index.php/shopping-cart-filter
  2. ?Shopping Cart filter?
    • Has for the time being a calc element ?Test?. Calculation is:

return $_SESSION['shoppingcart_id'];

The first time in a session I run these screens, value of Test is empty, in subsequent runs in the same session, the right shoppingcart header id is shown. Please have a look at

http://www.aviationcompetencecentre.nl/registration-test/

Can anyone suggest how I can get this work in a first attempt?, thanks.
 
Yes, calc elements settings. There's an additional setting "Calc on load" below.
 
Cant find a setting "Calc on Load" I only see "Only Calc on Save" , plesae find attached screenshot. Am I loooking at the wrong place?
 

Attachments

  • calcsetting.gif
    calcsetting.gif
    12.5 KB · Views: 166
It should be below the "ajax" fields.
If it's not there it seems you aren't running the recent Fabrik3.2?
Backup and update.
 
Ah, I see, thanks for making me aware of the new release. I will upgrade on short notice but I doubt if it is the solution for my problem. As I understand this setting is Ajax related. I did not set ajax calculation to Yes.
I added this testfield just to see what was happening. The initial failure is on a validation of a 'real' database join field, using the session variable to check if an item is not ordered already:

$query = "SELECT cexman_shoppingcart.id FROM cexman_shoppingcart JOIN cexman_examlist_plat ON (cexman_shoppingcart.examinationnum = cexman_examlist_plat.id)
WHERE cexman_shoppingcart.creator = " . $_SESSION['shoppingcart_id'] . "
AND cexman_examlist_plat.module = '{___module}'
AND cexman_examlist_plat.location = '{___location}'
AND cexman_examlist_plat.landescr = '{___language}'
AND cexman_examlist_plat.category = '{___category}'
AND cexman_examlist_plat.codedescr = '{___code}'";

This validation failure was the first indication that $_SESSION['shoppingcart_id'] was empty. I cannot believe that setting the Calc on Load value for the test element will change anything on this.
 
My first suggestion would be to use the J! session API, rather than $_SESSION directly, so stuff like ...

PHP:
$session = JFactory::getSession();
$session->set('your.context.foo', $foo);
$bar = $session->get('your.context.bar');

This avoids some potential gotchas with manipulating $_SESSION directly.

As for upgrading, I would strongly suggest you do this anyway, just so we are all using more or less the same code, and it's just a Good Thing <tm> to do. If you are running a recent github, I can be much more confident that any issues you have are not due to bugs we fixed long ago.

As always, make sure you do a full site backup before any kind of update. Assuming you are running a 3.1 ZIP, you should just be able to upload th current github (see the Wiki for details). Or you could update to 3.2 with J! updater, as that's obviously a fairly recent snapshot of github repo. But there were no database updates between 3.1 and 3.2, so no actual need to run the update process.

-- hugh
 
Hi Hugh, Troester

I first had to finish a running project before trying the new Fabrik release. I did a quick try with the 7 november github version. That did not solve the problem and caused some new issues in the application I was developing. I learned that the issue was not a fabrik one. I set up a production and a test environment in two sub domains of the same domain. It appeared that the issue did not show up in production, only in test. The solution was in setting the cookie domain in the config file for the test environment.

Thanks for your suggestions, it helped me to eliminate some possible causes.

--
Ronald
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top