I’m trying to integrate into Modx the jquery shopping cart jCart and can’t seem to get the sessions working correctly. The cart work and you can add products to it but as soon as you leave the page and come back to it all the items in the cart are gone. As soon as you add one more item they all come back.
Demo page
http://f3.hexagone.ca/produits.html?recherche=&business_dept=Footwear&sub_dept=&gender=
I’ve created a snippet with the following code. I’ve commented out the Session_start since it is already started by Modx.
<?php
// INCLUDE JCART BEFORE SESSION START
include 'assets/snippets/jcart/jcart.php';
// START SESSION
//session_start();
// INITIALIZE JCART AFTER SESSION START
$cart =& $_SESSION['jcart']; if(!is_object($cart)) $cart = new jcart();
$cart->display_cart($jcart);
?>
I’ve tried moving the include to be run before any HTML output at the top of the template file but get a parse error instead.
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
PHP error debug
Error: extract() [function.extract]: First argument should be an array
Error type/ Nr.: Warning - 2
File: /home/hexagone/public_html/f3/assets/snippets/jcart/jcart.php
Line: 244
Line 244 source: extract($jcart);
Parser timing
MySQL: 0.1998 s (38 Requests)
PHP: 0.2750 s
Total: 0.4748 s
Thanks for any help you can provide.