Jump to content

Including Prestashop cookies/info outside header.tpl


Recommended Posts

I'm having the following structure on my website:

root
--file.php
----- /prestashop
------ prestashop files here

Can 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

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

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

  • Like 1
Link to comment
Share on other sites

<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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...