8 Replies Latest reply on Oct 15, 2007 11:56 AM by Günter Schenk

    Post to a Session rather than DB via  ADDT

    Level 1
      Hello
      Is there the means to Post to a Session via the ADDT ?

      I've been using the extensions for a month or so and find the means to update Database values a breeze but I do not see any options for dealing with a Session value.

      I've got a page the does a Horizontal Looper and displays 6 products per page. I want to have the ability to update a Session to save selected models much like a shopping cart. Then on a final checkout page I would like to display the results and then allow a checkbox for each value saved. Deselecting a checkbox removes it from the values submitted via email to a predetermined address.

      I'm using a Javascript function to post the value of a selection via a URL String and then displaying that value on a pop-up page to confirm their addition to the session. So far no problems.
      But now I want to take the known value and insert it into a running session that will store all the inserted values.

      Do I have to hand code this or is there an extension value I am not seeing or can I specify a Session and post to that rather than the DB table?
      Or is the case that I should be using a temp table in the DB to store these values and then use a recordset to display the saved values?

      Basically I do not want to commit the values until I allow the user to review and manage their saved items via checkboxes.

      Any tutorials on this or advice from others that have done something similar , perhaps in a shopping cart?

      Regards,

      Steve

      PHP, MySQL DW CS3, ADDT 1.0
        • 1. Re: Post to a Session rather than DB via  ADDT
          Günter Schenk Level 4
          Hi Steve,

          ADDT has no inbuilt features which would let you save to a session rather than a DB -- a real shopping cart would assumingly be more appropriate for this scenario.

          Your idea to store the list values in a (temporary or not) table could probably make some sense, as you´d "simply" need to pass the values to a "confirm your selection" page, which, behind the scenes, provides an "Insert Record" form to e.g. store the selected items values, the "kt_login_id" session variable plus an automatically generated MySQL timestamp value.

          Would that make sense ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Post to a Session rather than DB via  ADDT
            Level 1
            Thanks for the reply Günter,

            Of the alternative methods both create additional hardships. The Temp DB method seems like it could have problems with clean up and simultaneous users. Using a "real" shopping cart brings lots of additional overhead that I am trying to stay away from. For instance I started to create a Shopping Cart with the WA eCart extensions but it ends up creating many pages when the task is rather simple in scope.

            Looks like storing and retrieving to either a Session or Cookie via JavaScript is the best way.

            I was hoping that the ADDT had a means to segment out these parts just like if you were creating a shopping cart which I expect is very common.

            Maybe they will add it in a latter version? Do you have the ear of the Developers working on the next version of ADDT?

            Is or are there Developers hard at work on the next version?
            • 3. Re: Post to a Session rather than DB via  ADDT
              Günter Schenk Level 4
              Hi Steve,

              if you want this feature added to a future version, please feel free to submit a feature request using the ADOBE wishform : http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

              It´s users such as you who might get heard, not me -- I don´t have anyone´s ear when it comes to considering additional features or not.

              However, dedicated shopping carts might still be the better & more professional solution IMHO -- retrieving cookies or session variables with javascript is quite insecure/unreliable in itself, I personally wouldn´t consider that.

              I thought about your scenario some more, and it´s clear you would need a better and unique detection of the current user who might not even have an account at your site, means who can´t be detected via ADDT´s "kt_login_id" session variable :: when user X enters your home-made "shopping cart", you can create a random numeric ID and assign this one to a session variable -- this one can be used in whatever other cart page and finally also stored in the DB respectively (on the checkout page) used for creating the query which will send the list of ordered items and a confirmation using ADDT´s Send Email behaviour. More info on this truly interesting approach here: http://msconline.maconstate.edu/tutorials/PHP/ECommerce/php00-08.php

              ------
              The Temp DB method seems like it could have problems with clean up
              ------

              Is "cleaning up" really the the right thing to do ? After all, you respectively the customer might want to track his ordering transactions done in the past.

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Post to a Session rather than DB via  ADDT
                Level 1
                There is a nice article in the Dreamweaver Application development area that uses a cart table to store session values and items in a shopping cart manner:

                http://www.adobe.com/devnet/dreamweaver/articles/php_cart.html

                It works nicely and you could even clean out the temp type files in your final checkout page IF the submission of data happens. That would relieve my concerns about saving temp data and not providing a mean to cleanup after use of the cart feature.

                I think I may try to rewrite the cart using ADDT features as I get an error as if there is already a session in place the first time an item is added to the session:
                "Notice: A session had already been started - ignoring session_start() "

                Reference test files:
                http://www.retailertoolkit.com/inventest.php
                Add to cart to test...
                • 5. Re: Post to a Session rather than DB via  ADDT
                  Level 1
                  Günter,
                  ______ you wrote: _______
                  Is "cleaning up" really the the right thing to do ? After all, you respectively the customer might want to track his ordering transactions done in the past.
                  _____________

                  Yes, you would want to clean up any cases where an order or final submission is not submitted. No need to save session and cart data on people that do not complete the full ordering process which would then take their personal and pertinent information and save it to the DB in a more organized and concise manner.

                  My whole point of not going with a full-on cart extension like WA eCommerse is to try to keep the application as clean and devoid of non pertinent pages and data as possible.

                  Also I am looking to see and make sure I can write applications "as required" rather than as predetermined by someone else. The other side of the coin is the continued learning of how to hand code the same features but not loose the benefit of rapid development via ADDT and other similar extensions...
                  • 6. Re: Post to a Session rather than DB via  ADDT
                    Günter Schenk Level 4
                    Hi Steve,

                    thanks for the link to that great tutorial -- didn´t even know it exists.

                    Just went to your test page, and it seems that you´re about to nail it down right. However there´s a little pitfall in there :: I reckon you might need to examine the cart´s current content also on the inventory page and to display a "remove from cart" button in case a certain property ID has already been added to the cart -- right now clicking the "add to cart" button will delete the property from the cart.

                    Cheers,
                    Günter Schenk
                    Adobe Community Expert, Dreamweaver
                    • 7. Re: Post to a Session rather than DB via  ADDT
                      Level 1
                      Günter,
                      I believe you are talking about the condition when you select an item already in the cart, the switch case conditions then delete the item from the cart on the cart page..

                      I guess there are two different ways to approach this.
                      1) ignore the re-request to add. Maybe an Alert that notes the item is already saved.
                      2) poll the cart on the inventory page and hide the add to cart button if and after a model/item has been selected and is in the cart.

                      The remove from cart function exists on the cart page in case someone changes their mind about a preselected item.

                      Good fun :)
                      • 8. Re: Post to a Session rather than DB via  ADDT
                        Günter Schenk Level 4
                        Hi Steve,

                        I think that 2) is way to go -- rather than just hiding the "add to cart" button, I´d personally display a different "already in cart" button then to retain the layout

                        Cheers,
                        Günter Schenk,
                        Adobe Community Expert, Dreamweaver