Author Topic: How to set cookie domain  (Read 4550 times)

Offline Ollie

  • Sr. Member
  • ****
  • Posts: 253
  • Karma: +27/-1
    • View Profile
    • Assistech
How to set cookie domain
« on: November 08, 2016, 08:13:56 AM »
For some reason, credit card data is not passing to my language subdomains (which are hosted by a company other than my web host). The company explained that I need to set cookie domain so the data transfers from mydomain.com to mysubdomain.com. My coder says I cannot simply change the url to a relative one because it is generated with built-in function: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_authorizenet_aim/storefront/view/default/template/responses/default_authorizenet_aim.tpl#L88 According to him, this function generates the URL based on server configuration: https://github.com/abantecart/abantecart-src/blob/master/public_html/core/engine/html.php#L179

I posted a question the other day in this forum and one of the core developers suggested replacing "null" on line 364 with my domain name. I tried this, but it didn't work: https://github.com/abantecart/abantecart-src/blob/master/public_html/core/engine/language.php#L364

How can I set cookie domain in AbanteCart? Any help will be greatly appreciated.
« Last Edit: November 08, 2016, 08:16:04 AM by Ollie »
Assistive technologies for people with special needs:
https://assistech.com/store/

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: How to set cookie domain
« Reply #1 on: November 08, 2016, 09:52:56 AM »
Why did you deleted your original topic?
i already suggested solution before.

You should to set domain that cover all your subdomains into your cookies.
For details please read about function "setcookie" and it's "domain" parameter http://php.net/manual/en/function.setcookie.php

You should to replace "null" in parameters with your main domain in this function call inside your AbanteCart,
for ex. in file core/engine/language.php
Code: [Select]
setcookie('language',
$lang_code,
time() + 60 * 60 * 24 * 30,
dirname($request->server['PHP_SELF']),
null,
(defined('HTTPS') && HTTPS)
);
and other places.

Then DELETE ALL COOKIES for YOUR DOMAIN and subdomains in browser and check.


“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline Ollie

  • Sr. Member
  • ****
  • Posts: 253
  • Karma: +27/-1
    • View Profile
    • Assistech
Re: How to set cookie domain
« Reply #2 on: November 10, 2016, 01:18:26 PM »
Why did you deleted your original topic?
i already suggested solution before.

As I explained in this post, the solution you suggested earlier did not work for me. I waited for a solution for several days, nobody responded; that's why I deleted the original post. Are you proposing the same solution or is this something new? I'm not clear what you mean by "other places". Can you be more specific? Thank you.
« Last Edit: November 10, 2016, 01:23:03 PM by Ollie »
Assistive technologies for people with special needs:
https://assistech.com/store/

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: How to set cookie domain
« Reply #3 on: November 11, 2016, 03:28:28 AM »
.... I'm not clear what you mean by "other places". Can you be more specific? Thank you.

yes. sure.
Please check this https://github.com/abantecart/abantecart-src/search?utf8=%E2%9C%93&q=setcookie
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

 

Powered by SMFPacks Social Login Mod