Duozhasht Posted December 5, 2012 Share Posted December 5, 2012 Well, im developing a CMS based form with a copy-center-system (http://www.papelariaveloso.com/content/8-C%C3%B3pias), but i need the $cookie->id_customer. But i get an error: Fatal error: Call to a member function isLogged() on a non-object in /home/papelari/public_html/modules/mymodule/submit.php on line 13 <?php /* $con = mysql_connect("localhost","user","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("papelari_Veloso", $con); */ global $cookie; if(!$cookie->isLogged()) { echo 'Please login'; exit; } else { echo 'Hi, ' . $cookie->customer_firstname. ' ' .$cookie->customer_lastname . '<br/>'; echo 'We contact to you: '. $cookie->email; } /* $sql="INSERT INTO ps_copias (id_customer, file, cor, copias, pags, papel, gramagem, flag) VALUES('$cookie->id_customer','$_POST[file]','$_POST[cor]','$_POST[copias]','$_POST[pags]','$_POST[papel]','$_POST[gramagem]', 0)"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Succeful"; mysql_close($con); */ ?> Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted December 5, 2012 Share Posted December 5, 2012 Hi, try to include this: require(dirname(__FILE__).'/config/config.inc.php'); Regards 1 Link to comment Share on other sites More sharing options...
El Patron Posted December 5, 2012 Share Posted December 5, 2012 that won't work in 1.5, it's nice when you all post what ps version you are working on...but's lets assume it's 1.5... for 1.4 if ($cookie->isLogged() for 1.5 if (Context::getContext()->customer->isLogged() 3 Link to comment Share on other sites More sharing options...
Duozhasht Posted December 5, 2012 Author Share Posted December 5, 2012 Thank you for help... Now i have other issue, i lost my shooping cart, can you check what happened? http://www.papelariaveloso.com/ Link to comment Share on other sites More sharing options...
El Patron Posted December 5, 2012 Share Posted December 5, 2012 Thank you for help... Now i have other issue, i lost my shooping cart, can you check what happened? http://www.papelariaveloso.com/ we still don't know what version you are using....but if it's 1.5 you can not use $cookie..so you are probably taking an error, again assuming 1.5... you need to use context...read more here http://doc.prestashop.com/display/PS15/Using+the+Context+Object Link to comment Share on other sites More sharing options...
guille334 Posted September 3, 2014 Share Posted September 3, 2014 I have the same problem but in PS 1.6 you can help me? Link to comment Share on other sites More sharing options...
El Patron Posted September 3, 2014 Share Posted September 3, 2014 for 1.4 if ($cookie->isLogged() for 1.5 and higher (latest release at time of this post 1.6.0.9) if (Context::getContext()->customer->isLogged() closing topic, post new topic if you have similar question. Link to comment Share on other sites More sharing options...
Recommended Posts