Loading external PHP scripts into C5
Permalink
Hi Everybody,
I've been trying to implement jCart (yes I know it's old and no longer maintained) into a c5.6 build, but regardless of what I try, I just can't get the session data to persist properly.
So far, the cart will render, and I can add things to it, but it only shows one item in the basket at a time. Moreover the stored data is replaced rather than added to when another item is added, or the page is reloaded.
Nearest as I can tell, the script wants to be included before a session_start. I've tried putting that include in an on_start method for the controller of that page type, it doesn't work. Calling the session_start manually loads the basket, but only goes as far as the problem itself (as described above). When I dump the session for the cart, I get
After about 5 days of bashing my head against a wall, I eventually conceded and tried to roll my own as it can't be that hard right? Apparently it was becase even after going as far as to kickstart using one of Franz's old tutorials: (https://www.concrete5.org/documentation/how-tos/developers/shopping_cart_tutorial/) I couldn't even get that working. I've searched and googled myself in circles trying to find an answer and all I know is that people seem to have a lot of trouble battling with sessions, so I've even started to wonder if it is actually me doing something wrong.
I'm tearing my hair out here, I've overrun my deadline, and it is really starting to stress the crap out of me. I haven't slept in a week, my wife has threatened to leave me and take the kids, the mortgage hasn't been paid, HMRC full audit pending...
Okay I'm exaggerating a bit :) but my client is understandably getting quite annoyed, and I really have run out of ideas about what to do. If anybody has any even the slightest idea of what I'm doing wrong, and/or something to try next I'd be super grateful.
Thanks for any help dudes
:)
I've been trying to implement jCart (yes I know it's old and no longer maintained) into a c5.6 build, but regardless of what I try, I just can't get the session data to persist properly.
So far, the cart will render, and I can add things to it, but it only shows one item in the basket at a time. Moreover the stored data is replaced rather than added to when another item is added, or the page is reloaded.
Nearest as I can tell, the script wants to be included before a session_start. I've tried putting that include in an on_start method for the controller of that page type, it doesn't work. Calling the session_start manually loads the basket, but only goes as far as the problem itself (as described above). When I dump the session for the cart, I get
$_SESSION['jcart'] object(__PHP_Incomplete_Class)#11 (9) { ["__PHP_Incomplete_Class_Name"]=> string(5) "Jcart" ...(followed by the data it could retrieve)
After about 5 days of bashing my head against a wall, I eventually conceded and tried to roll my own as it can't be that hard right? Apparently it was becase even after going as far as to kickstart using one of Franz's old tutorials: (https://www.concrete5.org/documentation/how-tos/developers/shopping_cart_tutorial/) I couldn't even get that working. I've searched and googled myself in circles trying to find an answer and all I know is that people seem to have a lot of trouble battling with sessions, so I've even started to wonder if it is actually me doing something wrong.
I'm tearing my hair out here, I've overrun my deadline, and it is really starting to stress the crap out of me. I haven't slept in a week, my wife has threatened to leave me and take the kids, the mortgage hasn't been paid, HMRC full audit pending...
Okay I'm exaggerating a bit :) but my client is understandably getting quite annoyed, and I really have run out of ideas about what to do. If anybody has any even the slightest idea of what I'm doing wrong, and/or something to try next I'd be super grateful.
Thanks for any help dudes
:)