Jump to content

How to include shopping cart and retain session id outside of prestashop subdirectory


Recommended Posts

]Hi. I have my store within a 'store' subdirectory. I want to include certain things like the shopping cart on all of the pages on my site, including those outside of the 'store' directory. I've tried doing this as a server side include but it doesn't work. I've included the config.inc.php and the init. php in the head of the page and the file I've included in the body is the cart.php. Are these the correct files? What is it that I'm actually doing wrong? I've tried using an iframe and that hasn't worked either. I would really appreciate help with this because I cant seem to find any information on it anywhere. Thanks in advance.

Daniel

Link to comment
Share on other sites

Thanks for the tip. Do you know how i would go about maintaining the session id of the customer as they move around the pages of my site outside of the 'store'? Also do you know which files need to be installed outside of the 'store' for the shopping cart to work on other pages? Thanks

Link to comment
Share on other sites

Yeah, basically i want the customer to be able to view how many items they have in their basket on any page in the site, even outside of the actual store. Sorry to be a nuisance but how i go about initialising the class system? Sorry if i'm being dumb! Nice pic btw ruilong!

Link to comment
Share on other sites

  • 1 year later...

Looks like it has been awhile since you were interested in this, but I will bump it just for more feedback on it. I created this little "minicart.php" which seems to work ok. Can't yet get the ajax smooth up down portion to work yet but haven't given that arrow much thought. It's a very rough option but it does work.

<?php
require_once(dirname(__FILE__).'/config/config.inc.php');
require_once(dirname(__FILE__).'/init.php');
?>
[removed]
var baseDir = '';
var static_token = '';
var token = '';
[removed]
<?
include(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php');
?>
<?
$smarty->display(dirname(__FILE__).'/modules/blockcart/blockcart.tpl');
?>



Would love to add those baseDir, static_token and token variables but just having them declared gets rid of any errors. Like I said "rough" but bare with me I have only been working with prestashop code for about a week now off and on.

FYI the removed portions in the code above were the opening and closing script tags.

Link to comment
Share on other sites

×
×
  • Create New...