Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 32

Thread: Programmatically Adding To the Cart

  1. #21
    Join Date
    Feb 2008
    Location
    Davao City, Philippines
    Posts
    32

    Default

    Quote Originally Posted by tcezeaux View Post
    Weird error. I followed the information in this thread, and it worked - but not fully.

    If I have a URL of /addtocart.aspx?ProductID=1&VariantID=1&Quantity=1 it works fine. Different quantities, no problem.

    However, if I change the ProductID to anything except 1, it goes to the ShoppingCart.aspx page, but no product is added.

    The product can be manually added to the cart (through the normal shopping process), but to do it programmatically just doesn't work.

    Any ideas would be helpful.

    Thanks
    probably VariantID 1 is not joined to the new ProductID
    <O HAI!11!1111 />

    Everything in between

    Moushie's Blog
    http://www.moushigo.com/

    My Online English-To-LOLspeak Translator!
    http://www.moushigo.com/index.php/the-loler-project/

    <KBYTHX!!11!!11 />

  2. #22
    Join Date
    Apr 2008
    Posts
    10

    Default Variant required?

    Partial success.

    If I explicitly put the VariantID onto the QueryString, then it works.

    However, if I don' t have the variantid, then the Default Variant is not used.

    Is there a way to obtain the Default Variant ID based on the Product ID?

  3. #23
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    Well, odd, it looks like we won't create the default variantid if it's passed in as 0 ( or missing). I think we should , I'll report over to dev.

    For now, just pass in the correct VariantID that you want added. thx.
    Last edited by Rob; 04-05-2008 at 10:16 PM.
    AspDotNetStorefront
    Shopping Cart

  4. #24
    Join Date
    Dec 2007
    Posts
    59

    Default

    I'm trying to use this method of adding products to the cart from a list view. I get the following error...

    The page cannot be displayed
    You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.

    Please try the following:

    * Contact the Web site administrator if you believe this directory should allow execute access.

    HTTP Error 403.1 - Forbidden: Execute access is denied.
    Internet Information Services (IIS)


    Is this an SSL issue or a server setting?


    This is my code. It's pulling the right data and creating the correct string.
    HTML Code:
    <a href="/addtocart.aspx?productid={aspdnsf:GetMLValue(ProductID)}&amp;variantid={aspdnsf:GetMLValue(VariantID)}">
    addToCart</a>

  5. #25
    Join Date
    Dec 2007
    Posts
    59

    Default

    Also, can this be done with the Wish List as well?

  6. #26
    Join Date
    Nov 2006
    Posts
    120

    Default

    What would the syntax be to add multiple parts to the cart. Say 2 of widget a and 3 of widget b? If I a getting this correctly I would only have to return the variant ID as well. Correct?
    Shawn

    http://www.FirstChoiceMarine.com

    Currently 7.1 moving to MS9.3

  7. #27
    Join Date
    Dec 2008
    Posts
    1

    Default Changing colour of link

    I have used this code to make an embedded link to add products to the shop without leaving the page. The code used uses php to wrap the values pulled from the database:

    Code:
    	$button = "<a href=\"javascript:void(0);\" class=\"univisted\" onclick=\"this.className='visited';window.location.href='http://www.canonbury.com/addtocart.aspx?productid=";
       		$button .= $productid;
       		$button .= "&variantid=";
       		$button .= $varid;
       		$button .= "&quantity=";
    		$button .= $quantity;
    		$button .= "&color=";
       		$button .= "";
       		$button .= $colour;
       		$button .= "&ReturnURL=http://www.canonbury.com/mytest/query2.php&size=";
       		$button .= $size;
       		$button .= "'\">";
       		$button .= "buy now";
       		$button .= "</a>";
    The problem is that it once it has added doesn't change colour like a normal link as doesn't 'go anywhere'. I'd be grateful if anyone had any ideas on how to change the colour of the link to show that a product has been added to the cart.

  8. #28
    Join Date
    Sep 2008
    Location
    Florida
    Posts
    60

    Talking Gift or Wishlist too?

    Does anyone know if this same thing could be applied to the Gift or Wishlist?

  9. #29
    Join Date
    Nov 2009
    Posts
    1

    Post adding more than one product to cart

    i am trying to add more than one product to cart from the product details page. Is it possible?

    My scenario is like i have one product (one variant). It has 2 colors (red, green) and 3 sizes (small, medium, large). Now i want to add 2 products for red (small), and 1 product for red (large).

    I have the source code so i was planning to modify the form for add to cart. Currently it has one Color, one Size and one Quantity fields and when we post this to addtocart.aspx, it adds the product to cart perfectly.
    Now, if i create more Size, Color and Quantity fields in that form and then post it to addtocart.aspx. What changes do i have to do to addtocart.aspx so that it handles this multi add request.

    Is this the proper way to do this kind of thing? If not then please suggest some workaround.

    thanks

  10. #30
    Join Date
    Nov 2009
    Posts
    4

    Default

    Is there any analogous process for StoreFront/DNN? And question 2, can I redirect to another page (show cart page) after adding to cart, and ensure all products for the "user" whose cart I am manipulating in code, are in that cart?


    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •