Announcement

Collapse
No announcement yet.

Empty the cart when the customers session times out.

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

    Empty the cart when the customers session times out.

    A client has different shipping rates for different Availability groups. He finds some customers have figured that out. They login to get their shopping discount, then log out to get a different shipping rate.

    It's easy enough to empty a basket when they click a log-out, but what do I do if there login session times out?



    Ray Yates
    "If I have seen further, it is by standing on the shoulders of giants."
    --- Sir Isaac Newton

    #2
    write cookie when logged in and check it during the checkout?
    if not logged in + cookie exists = empty basket + clear cookie

    Comment


      #3
      Well I thought the first par of this was going to be simple by adding some coding to the LOGOUT page template. But nooooo.

      By the time that page loads, I can't lookup the Availability Group because they are already logged out. <facepalm /> Thinking...

      I'll go with the cookie idea or a custom basket field.
      Ray Yates
      "If I have seen further, it is by standing on the shoulders of giants."
      --- Sir Isaac Newton

      Comment


        #4
        BTW, custom basket field is a way better solution, as customers are not able to modify it :-)

        Comment


          #5
          Thanks for the feed back. On the the LOGOUT page

          Code:
          <mvt:item name="customfields" param="Read_Basket( 'cid', g.basket:cust_id)" />
          <mvt:item name="ry_toolbelt" param="availgroup|Customer_Find|g.agfound|'Pro'" />
          <mvt:if expr="g.agfound">
              <mvt:item name="ry_toolbelt" param="BasketEmpty" />
          </mvt:if>
          <mvt:item name="customfields" param="Write_Basket( 'cid', '')" />
          Ray Yates
          "If I have seen further, it is by standing on the shoulders of giants."
          --- Sir Isaac Newton

          Comment


            #6
            What about just using page headers to flush out the session cookies...that'd kill the baskets...
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment


              #7
              Still have to store a flag variable somewhere to define whose session to flush

              Comment


                #8
                hmmm, not sure. if you just wipe the session cookies (which you'd only have access to the current ones assigned to the browser session) that should cause miva to create new ones...however, have not tested this specifically.
                Bruce Golub
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment


                  #9
                  I just added the code below to the top of the BASK, OCST, and ACLN pages. That let me know who was logging out so I could take the appropriate action on the LOGOUT page. It seemed, like the simplest and most secure solution.

                  As for the session timing out in the original question, I realized later that the session and basket both time out at the same time.
                  Code:
                  <mvt:item name="customfields" param="Write_Basket( 'cid', g.basket:cust_id)" />
                  Ray Yates
                  "If I have seen further, it is by standing on the shoulders of giants."
                  --- Sir Isaac Newton

                  Comment


                    #10
                    Ray, does this snippet effectively remove all shopper data from the logged out basket?

                    We don't want the previous items or address showing if someone logs out... but walks away from the computer.
                    Miva just reported that behavior is not a bug... but I differ with them. Anything that leaves names address and items chosen available after specifically chooseing to "log out" seems a bit buggy to me.

                    Comment


                      #11
                      The short answer is Yes.

                      When you Logout, the Action LOGO clears the customer information associated with the basket, however it does not do anything with the basket items.

                      The command <mvt:item name="ry_toolbelt" param="BasketEmpty" /> does NOT simply reset the session cookie. It makes an API call that deletes (from the database) all of the items from the customer basket which is why it needs g.basket:cust_id to work.

                      I can't speak to any other coding that restores the customer information when you go the OCST page. I have seen scripting in some Readythemes that seems to restore a customers previously entered information but I have never really looked at what its doing.
                      Ray Yates
                      "If I have seen further, it is by standing on the shoulders of giants."
                      --- Sir Isaac Newton

                      Comment

                      Working...
                      X