Categories
E-commerce Technology Web Development

Set cookie domain for CS-Cart

If your are using CS-Cart eCommerce software, you might need to configure CS-Cart to set its cookies to a specific domain or subdomain.
To do this, you need to modify a bit the “CORE” of CS-Cart.

  1. Edit the file :
<CS-CART_ROOT>/core/fn.common.php
  1. Around lines 2035 to 2044, you will find the fn_set_cookie() function,
  2. Modify the last line of this function from:
 return setcookie($var, $value, $expiry, $current_path);


to

 $current_domain = (defined('HTTPS')) ? Registry::get('config.https_path') : Registry::get('config.http_path');
 if ($current_domain != ''){
    return setcookie($var, $value, $expiry, $current_path, $current_domain);
 }else{
    return setcookie($var, $value, $expiry, $current_path);
 }

Happy creating!