Jump to content

Recommended Posts

Hi all,

I'm trying to develop a new Prestashop module for our business. Everything works exactly as I need. I tried module Validator and I'm getting only one error: "The use of $_COOKIE is forbidden; use Context::getContext()->cookie instead". It's pretty obvious what the problem is (superglobal arrays are forbidden). But here's a thing.

We have custom javascript included in templates and this javascript communicates with Facebook and stores user's facebook id in cookie. This cookie is accessible with $_COOKIE but it is not accessible from your object "Context::getContext()->cookie" - this object contains different values than superglobal array. 

Is there any other option how to pass cookie from JS to PHP? I can't think of any other way from my perspective. Does this error means that we won't be able to publish our module on Marketplace? 

Thanks a lot for any help.

Share this post

Link to post
Share on other sites

Hi ! I think this is a usecase that the prestashop did not think about ;) maybe you can find a solution by looking into the code and finding how this Context::getContext()->cookie is created ?

Also I think you can open an issue on github (https://github.com/PrestaShop/PrestaShop/) to tell them about your usecase, they might help you finding a solution or handle it in the next version

  • Like 1

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More