Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 7 of 7

Thread: help adding items programatically

  1. #1
    GCR is offline Junior Member
    Join Date
    May 2009
    Posts
    8

    Default help adding items programatically

    Hello.

    I am developing an ASP.NET website that sells soft-goods (mostly documents), and I'm using AspDotNetStorefront as my shopping cart and payment processing.
    It's a pretty simple concept, really. Everyone is anonymous. There are no shipping addresses. There is no registration or logging in. They just browse my site, and sometimes they will want to buy a document or 2, and I want to use AspDotNetStorefront for this part.

    I am having trouble getting everything "plugged in."

    I have added all of our items to the storefront database. No problem.

    The Storefront site works fine my itself as a whole, but I'm trying to only use pieces and parts of it, and without any documentation, it's a little difficult.

    Here's where I am stuck right now:
    When a user goes through my site and finally clicks that they want to buy a document, I dynamically add an anonymous Customer, and then I add (using "aspdnsf_AddItemToCart") an item to the shopping cart using ths CustomerID I just created. This seems to work fine (it shows up in the ShoppingCart table). BUT, when I send the user to ...shoppingcart.aspx, the cart is empty.
    Obsviously, I'm missing some parameters, or cookies, or whatever "hook" shoppingcart.aspx is looking for, but I don't know how to find out what it's looking for.

    Can someone point me in the right direction?

    Thanks in advance for any help.
    Jay.

  2. #2
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    are you using our WSI web service automation interface or just trying to call addtocart.aspx?
    AspDotNetStorefront
    Shopping Cart

  3. #3
    GCR is offline Junior Member
    Join Date
    May 2009
    Posts
    8

    Default

    I'm trying to just call aspdnsf_AddItemToCart directly, and then I'd like to go to ShoppingCart.aspx and see what I just added.

    The way I'm trying to do it is to add a new anonymous Customer, and with his CustomerID, I call aspdnsf_AddItemToCart. Then I'd like to go to ShoppingCart.aspx, pass it my customer id somehow, and see the item(s) I just added. The problem is that I can't find any documentation on how to pass CustomerID to ShoppingCart.aspx.

    The WSI interface is really overkill for what I'm trying to do.

    Thanks,
    Jay.

  4. #4
    GCR is offline Junior Member
    Join Date
    May 2009
    Posts
    8

    Arrow

    I am not using the WSI stuff because it seems like an added layer of abstraction that I don't really need.

    Currently, I'm adding an anonymous customer to the Customer table in the database, and then I'm adding an item to the shopping cart using your stored procedure "aspdnsf_AddToCart." This seems to work just fine. The problem comes when I try to go to ShoppingCart.aspx....I don't know how to show the shopping cart for my newly created CustomerID. Looking in the database, everything I added to the cart is in there, but I don't know how to tell ShoppingCart.aspx what Customer I'm dealing with.

    You mentioned AddToCart.aspx. Can you elaborate on that? Should I be using that instead? Is this how everyone else does it?

    Thanks,
    Jay.

  5. #5
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    addtocart.aspx is the best way to do it, because in order to tie the item to a shoppingcart to a customer there needs to be a record in the customersession table pertaining to that particular customer. If you utilize addtocart.aspx, all of this occurs automatically and you save yourself the trouble of re-inventing the wheel. Basically, the click for the user for buying the document should link to addtocart.aspx?productid=#&variantid=#&quantity=# where the #'s are the id of the product (from the database), the id of the variant (from the database), and the number of documents being purchased.
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  6. #6
    GCR is offline Junior Member
    Join Date
    May 2009
    Posts
    8

    Default

    Thanks for the reply, George!

    Of course, your answer opens up a few more questions about this...

    Currently, I am using stored procedures to add a Customer record and then I use that CustomerID to add stuff to the shopping cart. This SEEMS to be working fine, but I don't feel like it's the "right" way.

    If I were to use AddToCart.aspx, how would I pass it my CustomerID? Or is there maybe something else that needs to happen, and I missed it while I was busy reinventing the wheel? Also, calling AddToCart.aspx seems to take a WHOLE LOT longer than just running a quick stored procedure.

    The way my site works, I just want you to visit my website; I don't care who you are. I want you to add a few documents into your shopping cart, and then checkout, and I'll email you links to those documents. Everything is sort of anonymous. When you leave the site and come back, I'm not trying to remember what you had in your cart or anything like that. This whole idea seems simple (I can explain it in 3 minutes or less ), but I'm just having a hard time deciding which parts of ADNSF need to be used and what is the best way to access these parts.


    Thanks again,
    Jay.

  7. #7
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    Yes, add to cart does a WHOLE lot more than run a sql statement LOL (checking permissions, start dates, coupon validity, inventory status, updates pricing, and about 10 other things) to ensure a valid "add"...
    AspDotNetStorefront
    Shopping Cart