Announcement

Collapse
No announcement yet.

When does BasketInfo get deleted?

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

    When does BasketInfo get deleted?

    I'm working on a project that uses BasketInfo to store data about a customer's eligibility for certain types of discounts. Since customers remain logged in after completing a purchase, we want to preserve this BasketInfo status as well. I started by adding a system action, triggered by AUTH, to save the BasketInfo data in a global variable. That allows it to be preserved when the store deletes all the basket-related data from the DB. Now I just need to read that variable and create a new BasketInfo record, at some point later in the process. But I can't figure out when that is?

    I thought that Merchant cleared the basket during processing of a successful AUTH, but that doesn't seem to be the case. A debug message inserted into LogModule_Screen() shows that the BasketInfo records still exist when this function is executed for INVC. But after completing a purchase, when I click to any other page in the store, the BasketInfo is gone. When did it get deleted? I've been through the LSK, but I can't seem to find the code that does this.

    Thanks --
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    #2
    Re: When does BasketInfo get deleted?

    If the BasketInfo record's clronmod flag is 1, the record is deleted by Basket_Reset_Contents, which is called near the end of AUTH action processing.

    Otherwise, it is deleted by Basket_Reset_Basket, which is called after the order_invoice exception is thrown to render the INVC page. This is done after SystemModule_Screen is called for the INVC screen.

    Comment


      #3
      Re: When does BasketInfo get deleted?

      Hi Burch, thanks for the quick reply.

      I looked at some more LSK files, and it seems that I still have a problem. The Basket_Reset_Contents() doesn't happen until after the INVC page has been completely rendered, and the log modules have been called. As a result, there seems to be no way for any module or template script to create a BasketInfo record that will persist beyond the INVC page.

      As a work-around, I suppose can do either of the following:

      - Create a new table for this data, keyed by session ID, instead of using BasketInfo

      - Create a custom order field with the same field code, so that the store will automatically capture the data.

      For a complete solution, I also need to create some code that runs on every page load, which will check for this saved data, convert it to a BasketInfo, and then delete the saved data so that it won't be used again on the next page load.

      Does that make sense?

      Thanks again --
      Kent Multer
      Magic Metal Productions
      http://TheMagicM.com
      * Web developer/designer
      * E-commerce and Miva
      * Author, The Official Miva Web Scripting Book -- available on-line:
      http://www.amazon.com/exec/obidos/IS...icmetalproducA

      Comment


        #4
        Re: When does BasketInfo get deleted?

        Kent,

        In one application I base64 encoded the basket data and saved it as a session cookie. I was then able to read that on later page loads. I can easily delete the cookie as needed or, after the customer closes the browser or leaves the site, the cookie expires.

        I use Miva API functions in the LSK to ensure compatibility.
        Ray Yates
        "If I have seen further, it is by standing on the shoulders of giants."
        --- Sir Isaac Newton

        Comment


          #5
          Re: When does BasketInfo get deleted?

          Cookies, yeah, that would work too. Thanks!

          BTW -- does Miva still work for users who've disabled cookies in their browser? I remember that used to be a concern. But I don't hear much buzz about cookies in the media these days; I guess people aren't as scared of them as they used to be.
          Kent Multer
          Magic Metal Productions
          http://TheMagicM.com
          * Web developer/designer
          * E-commerce and Miva
          * Author, The Official Miva Web Scripting Book -- available on-line:
          http://www.amazon.com/exec/obidos/IS...icmetalproducA

          Comment

          Working...
          X