Announcement

Collapse
No announcement yet.

Domain-wide cookie for the cart...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Domain-wide cookie for the cart...

    Have just implemented GBradley's MiniCart javascript on our site, and in the process noticed something... s'not a biggie, but a fix would be useful.

    As some are aware, our store resides on http://store.over-clock.com, and cgi scripts reside on http://www.over-clock.com/cgi-bin

    http://store.over-clock.com = http://www.over-clock.com/acatalog/

    Now, when you add an item to your cart, the cart summary is displayed fine showing however many items and their value in the cart. BUT, once the cart has then forwarded the user back to the http://store.over-clock.com/ based URL to continue shopping, the cookie path becomes invalid... and the cart summary reverts back to showing 0 items and 0 value (and thus so does the MiniCart script).

    AKA - the "usual" problem that folks have when they have a mix of http://domain.com and http://www.domain.com in network settings, however, in my case, this setup is entirely intentional and somewhat necessary... our store has resided at http://store.over-clock.com for years, and to change it now would cause complications for us.

    So... how does one set the actinic cookie to be a domain-wide cookie assigned to .over-clock.com (& thus including ALL subdomains - both www. & store.) rather than allowing it to default (to www.over-clock.com)?

    As standard in actiniccore.js, the domain field isn't used, so it defaults to the path of the cgi script that set it... thus www.over-clock.com

    Have tried appending as follows in actiniccore.js...
    Code:
    Function setCookie(sName, sValue, sExpire)
    	{
    	var sCookie = sName + "=" + escape(sValue) +"; path=/"; domain=".over-clock.com";
    But nada.

    I recall going thru all this YEARS ago with Actinic v4 for a client rather than ourselves, and someone at Actinic (John someone-or-other - doesn't work there anymore) sorted it out for me, and it was a farily minor change...
    Cheers!
    Marci - <a href="http://www.Over-Clock.co.uk" target="_blank">www.Over-Clock.co.uk</a>

    #2
    Aha! KNEW there was an official hint to doing this somewhere...

    http://knowledge.actinic.com/acatalo...394.html#a1097

    To resolve this problem the Perl Script Actinic.pm needs to be modified to write the domain name as a parameter when saving the Cookie.

    - Locate the file Actinic.pm in the site folder.
    - Edit the file using a text editor such as Notepad.
    - Search for…

    Print cart cookies

    - A few lines after this line you should see…

    print "Set-Cookie: " . $sCartCookie . # set the cookie
    "; EXPIRES=" . $sCartExpiry .
    "; PATH=/;\r\n";

    - Replace the line…

    "; PATH=/;\r\n";

    - with…

    "; PATH=/; domain=<server_address>;\r\n";

    - Replace <server_address> with the site server address e.g.

    "; PATH=/; domain=www.actinic.com;\r\n";

    - Save the file and exit.
    - Update the site.
    In theory (shall test in a mo...)

    Code:
    "; PATH=/; domain=www.actinic.com;\r\n";
    simply needs the www dropping off the front, but the first . leaving, giving

    Code:
    "; PATH=/; domain=.actinic.com;\r\n";
    And for those who want it to work with (for instance) http://www.blah.com and http://blah.com, it'd be...

    Code:
    "; PATH=/; domain=actinic.com;\r\n";
    Someone correct me if I'm wrong...
    Cheers!
    Marci - <a href="http://www.Over-Clock.co.uk" target="_blank">www.Over-Clock.co.uk</a>

    Comment


      #3
      Yep - the above works fine...!
      Cheers!
      Marci - <a href="http://www.Over-Clock.co.uk" target="_blank">www.Over-Clock.co.uk</a>

      Comment


        #4
        Thanks for posting the solution to your problem, it will be useful.

        Kind regards,
        Bruce King
        SellerDeck

        Comment


          #5
          What about using a direct IP address instead. like 123.24.35.1 or whatever.. that way whatever .com/co.uk it would go to the IP rather that the URL. but the URL would be masked so user would never see it anyway. If you host a server getting the ip is normally an easy process.

          Dan

          Comment


            #6
            Not how cookies work... the browser searches for local cookies based on the domain name of the site / path used to access the site. If the user types the IP into the browser to get to the site then it'd work... but who's gonna go about doing that when they have the domain name?

            Also, this would possibly cause a security risk on a shared server that had multiple sites hosted. Any of the other sites on the server would be able to retrieve and utilise the cookie as it would be a native cookie to every site.
            Cheers!
            Marci - <a href="http://www.Over-Clock.co.uk" target="_blank">www.Over-Clock.co.uk</a>

            Comment


              #7
              You know what, lol I now have the same problem.. heres mine..

              my server is hosted to a free domain name i picked (i already bought the one i wanted) so I have FREENAME.COM with the hosting package. and OTHERURL.COM forwarding to the server. now when I go to purchase and then to contin shopping the cart empties to 0 0

              I have not added anything to the site just using actinics build in cart.

              any ideas?

              Comment


                #8
                Originally posted by danlou84
                You know what, lol I now have the same problem.. heres mine..

                my server is hosted to a free domain name i picked (i already bought the one i wanted) so I have FREENAME.COM with the hosting package. and OTHERURL.COM forwarding to the server. now when I go to purchase and then to contin shopping the cart empties to 0 0

                I have not added anything to the site just using actinics build in cart.

                any ideas?
                Actually the basket in my template shows empty but if you add again and that then takes you to the basket its still there and adds another one.

                So I guess my problem is with the show cart code in my template which is.


                <Actinic:Variable Name="ShoppingCartSummary"/>

                thats the code used..

                basically I want in that corner of the template to display the item num : 4 and the price £156 and then view cart as a link (currently dont have this)

                Comment


                  #9
                  It could be the way your forwarding is set up.

                  Within Actinic, the product pages and checkout need to live on the same domain (that includes domain and www.domain.)

                  Thus you must ensure all forwarding takes the visitor to the domain where actinic lives and they shop, add to basket on the correct domain

                  Comment


                    #10
                    Thats all setup right it just takes you to the website like if you used the standard domain and the problem also accurs when using the normal domain too. Dan

                    Comment


                      #11
                      would you like to furnuish us with the domain names in question otherwise we are speculating?

                      Comment


                        #12
                        Originally posted by pinbrook
                        would you like to furnuish us with the domain names in question otherwise we are speculating?
                        Furnuish? I dont understand that word.

                        Well basically as the websites not live I'm just testing it at the mo.

                        I want to get it fully working before I release it.

                        I think its either a problem with that code or the cookie....

                        Dan

                        Comment


                          #13
                          I think its either a problem with that code or the cookie....
                          1. Go back to the original code. If that doesn't fix it then the altered code isn't the problem.

                          2. Cookie. A cookie problem could be the browser, firewall, domain, forwarding, PC, server or just the way you've accessed your site. The people here will help you identify it, but can't help without seeing the problem first hand.

                          Mike
                          -----------------------------------------

                          First Tackle - Fly Fishing and Game Angling

                          -----------------------------------------

                          Comment

                          Working...
                          X