Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:10:46+00:00 2026-06-18T04:10:46+00:00

We have a site that uses ExpressionEngine as the CMS. We also use Magento’s

  • 0

We have a site that uses ExpressionEngine as the CMS. We also use Magento’s cart in the e-commerce part of our site. I’m having difficulties with cookies and making them accessible in different areas.

We use a cookie for search selections so when the user returns to our schedule page it
remembers the last selection they saved, up to 2 days ago.

I also allow them to use the URL to set them using the URLs shown in the comment below.
The cookie is used to filter items on the schedule based on the last or last 2 segments.

//*****************************************************************************
// This is from an Expressionengine base template to set the cookie before the
// header is sent.
// These are ExpressionEngine tags that evaluate the path segments
// the URL is www.mysite/schedule/CMOL or www.mysite/schedule/CM/TX
//*****************************************************************************
{if segment_1 == "schedule" }
  {if segment_2 != ""}
<?php  
    $state = '{segment_3}'; // Could be empty
    $pro = '';
    //*******************************************************
    // clear the searchItems cookie
    // this doesn't actually clear the cookie for some reason.
    //*******************************************************
    setcookie("searchItems", "", time()-7200, '/schedule/');
    {if segment_2 == 'CMOL'}
        $state = 'OL';
        $pro = '21_FUN,22_HAN,23_MEA,24_FSR,25_ADM';
    {/if}
    {if segment_2 == "CM"}
        $pro = '21_FUN,22_HAN,23_MEA,24_FSR,25_ADM';
    {/if}
    $cookie = '2013][][0][25]['.$state.']['.$pro.'][true';

    //*******************************************************
    // Now reset it to the pro and/or state selection expires 
    // 2 days from now.
    //*******************************************************
    setcookie("searchItems", $cookie, time()+172800, '/schedule/');
?>  
  {/if}

Now, on the schedule page, I have some javascript to set the cookie in the window.onUnload
to set the cookie for their search preferences. The code and value used to set the cookie in javascript looks like this:

// Values
// c_name  = "searchItems"
// c_value = "2013%5D%5B%5D%5B0%5D%5B25%5D%5BOL%5D%5B16_FUN%2C17_HAN%2C18_MEA%2C19_FSR%2C20_ADM%5D%5Btrue; path=/schedule/;;  expires=Sat, 26 Jan 2013 17:09:37 GMT"

//*******************************************************   
// Function to set the search preference cookie
//*******************************************************   
function setCookie(c_name,value,exdays) {
    var exdate=new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value=escape(value) + '; path=/schedule/;' + ((exdays==null) ? "" : "");
    if(remember_params_flag) {
        c_value += " expires="+exdate.toUTCString();
    }
    document.cookie=c_name + "=" + c_value+';';
}

What am I doing wrong as far as cookies go in order to make them work across all browsers? They do not have to share this information between browsers, only browser sessions.

BTW, due to the inconsistencies between the SESSION handling in Magento and ExpressionEngine, I can not accept a PHP SESSION option.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:10:47+00:00Added an answer on June 18, 2026 at 4:10 am

    I went through and double checked all the places I was writing and reading the cookies. I made sure they were all written in the same manner, using the domain and making sure that the expiration was all set the the same value.

    Everything looks like it’s working now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that uses the default SqlMembershipProvider and FormsAuthentication. I can use
I have a site that uses a large centered background image, which naturally loads
I have a site that uses a menu control tied to a sitemapdatasource which
Ok, so I have a site that uses the google maps API, and I
I have a PHP site that uses a fairly common authentication scheme. The entire
I have an application that uses Django 1.3 installed in python's site-packages. I want
I have a site that uses cURL to access some pages, stores the returned
I have a site that uses classic ASP and a database in Access 2007
I have a site that currently uses images on a file server. The images
I have a secure site with private information that uses https. We have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.