Ovi Posted August 25, 2010 Share Posted August 25, 2010 I'm having the following structure on my website:root--file.php----- /prestashop------ prestashop files hereCan i somehow include informations from Prestashop in my "file.php" that sits outside prestashops install dir and has nothing to do with the Prestashop install? I only want to show if user is logged in/out ,and maybe cart total ...Maybe including <header.php> or something?Thanks in advance for all the help! Link to comment Share on other sites More sharing options...
Bruno Leveque Posted August 25, 2010 Share Posted August 25, 2010 Hi,You can try to include init.php (not header.php) but not sure it'll work.You can also try to include the Cookie.php class and then do: $cookie = new Cookie('ps'); Regards, Link to comment Share on other sites More sharing options...
Ovi Posted August 25, 2010 Author Share Posted August 25, 2010 Thanks for the reply, i tried this: <? include ('catalog/init.php'); ?> Doesn't seem to work, i get black page. If include would work, would i be able to use smarty code outside Prestashops install dir ? Something like this: {if $logged} {$cookie->customer_lastname} {$cookie->customer_firstname|substr:0:1}. {/if} Link to comment Share on other sites More sharing options...
Ovi Posted August 25, 2010 Author Share Posted August 25, 2010 I also tried this after reading http://www.nethercottconstructions.com/content/28-prestashop-cookie-structure <? include_once('catalog/config/settings.inc.php'); include_once('catalog/classes/Cookie.php'); $cookie = new Cookie('ps'); ?> but i get:Fatal error: Class 'SubDomain' not found in /home/profsh/public_html/tertia.ro/catalog/classes/Cookie.php on line 75 1 Link to comment Share on other sites More sharing options...
Bruno Leveque Posted August 25, 2010 Share Posted August 25, 2010 You can try to include the SubDomain.php class too and also the Blowfish class.You won't be able to use Smarty outside, but you can still do: echo $cookie->customer_lastname; Link to comment Share on other sites More sharing options...
Ovi Posted August 25, 2010 Author Share Posted August 25, 2010 <html> <body> <? include_once('catalog/config/settings.inc.php'); include_once('catalog/classes/Cookie.php'); include_once('catalog/classes/ObjectModel.php'); include_once('catalog/classes/Db.php'); include_once('catalog/classes/SubDomain.php'); include_once('catalog/classes/Blowfish.php'); $cookie = new Cookie('ps'); ?> <? echo $cookie->customer_lastname;?> </body> </html> After including everything where i got error, i don't get anymore errors but ECHO won't display anything Link to comment Share on other sites More sharing options...
MrBaseball34 Posted August 25, 2010 Share Posted August 25, 2010 Just use PHP's cookie mechanisms to get the cookie info. Link to comment Share on other sites More sharing options...
Ovi Posted August 25, 2010 Author Share Posted August 25, 2010 Just use PHP's cookie mechanisms to get the cookie info. Well i guess that's complicated?If only the tutorial from Rocky's website would have worked for me Link to comment Share on other sites More sharing options...
rocky Posted August 26, 2010 Share Posted August 26, 2010 Thanks for letting me know that my code doesn't work. I wrote that code without testing it. I'll check whether it works now.EDIT: I managed to read the cookie externally, but it is missing most of the information including the customer last name. The problem that is authentication.php that puts customer_lastname in the cookie after successfully logging in. I suppose this makes sense. You shouldn't be able to access any of the customer's private information without having their password. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now