Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jun 2014
    Location
    Alicante
    Posts
    15
    Plugin Contributions
    0

    Default Add product to Cart URL?

    I had Zencart 1.3.8a with a jquery code that throw to "index.php?main_page=product_info&cPath=18&products_id=910&action=add_produc t" a post form with all the variables and text attributes and the shopping cart recieved the data and added it correctly.

    Now I'm trying to migrate to Zencart 1.5.1 and I've modified the jquery code with the securityToken, something that before wasn't needed, to do the same add a product through URL "index.php?main_page=product_info&cPath=18&products_id=910&number_of_uploads=0&a ction=add_product".
    But now it doesn't work the variables are sent, but the shopping cart tells that there's no product in the basket.

    And the question are: Can be done what I'm trying in Zencart 1.5.1?
    I'm using these fields of the form:
    <input type="hidden" name="securityToken" value="444444"></input>
    <input type="hidden" name="id[TEXT_PREFIX9]" value="Text"></input>
    <input type="hidden" name="id[TEXT_PREFIX5]" value="_-_-_-_-_-_-_-_-_-_-"></input>
    <input type="hidden" name="id[6]" value="22"></input>
    <input type="hidden" name="id[8]" value="68"></input>
    <input type="hidden" name="id[7]" value="67"></input>
    <input type="hidden" name="cart_quantity" value="1"></input>
    <input type="hidden" name="products_id" value="286"></input>

    Am I missing any field?

  2. #2
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,246
    Plugin Contributions
    58

    Default Re: Add product to Cart URL ZC 1.5.1

    Not a field, but rather a active session I think... without an active session and cookie set things cannot be added to the cart.
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Add product to Cart URL ZC 1.5.1

    Someone (kuroi or DrByte, I forget) posted code a year or two ago that does exactly that, open Zen Cart with a specific product in the cart, so it should be possible.

  4. #4
    Join Date
    Jun 2014
    Location
    Alicante
    Posts
    15
    Plugin Contributions
    0

    Default Re: Add product to Cart URL ZC 1.5.1

    @gjh42 I thing you are pointing to this threat: http://www.zen-cart.com/showthread.p...-via-URL/page2
    I've read and using the info in it but it doesn't work in ZC 1.5.1.

    @mprough You're right. If I take the security token generated by ZC 1.5.1 of a product, and I paste it in a form of a HTML file like this:

    Code:
    <form action="http://localhost:8888/zc15/index.php?main_page=product_info&cPath=18&products_id=910&number_of_uploads=0&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" id="cart_quantity">
    <input type="hidden" name="securityToken" value="6f64e3a15e24fa6d55e1813bc6cf99ec"></input>	
    <input type="hidden" name="id[TEXT_PREFIX9]" value="Text"></input>
    <input type="hidden" name="id[TEXT_PREFIX5]" value="_-_-_-_-_-_-_-_-_-_-"></input>
    <input type="hidden" name="id[6]" value="22"></input>
    <input type="hidden" name="id[8]" value="68"></input>
    <input type="hidden" name="id[7]" value="67"></input>
    <input type="hidden" name="cart_quantity" value="1"></input>
    <input type="hidden" name="products_id" value="910"></input>
    
    <input name="" type="submit" value="submit"></input>
    If I submit that form after pasted the security token in the same browser, ZC 1.5.1 take the product and add it to the cart perfectly.

    The problem is related to the relationship between the security token and the cookie.

  5. #5
    Join Date
    Jun 2014
    Location
    Alicante
    Posts
    15
    Plugin Contributions
    0

    Default Re: Add product to Cart URL ZC 1.5.1

    All right!

    Problem solved. I was passing more attributes to ZC 1.5.1 than the attributes the product has.

    Solution was:

    Include with the ZC 1.5.1 function
    Code:
    zen_draw_hidden_field('securityToken', $_SESSION['securityToken'])
    the value of securityToken in the form.

    Code:
    <form action="http://localhost:8888/zc15/index.php?main_page=product_info&cPath=18&products_id=910&number_of_uploads=0&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" id="cart_quantity">
    <input type="hidden" name="securityToken" value="6f64e3a15e24fa6d55e1813bc6cf99ec"></input>	
    <input type="hidden" name="id[TEXT_PREFIX9]" value="Text"></input>
    <input type="hidden" name="id[TEXT_PREFIX5]" value="_-_-_-_-_-_-_-_-_-_-"></input>
    <input type="hidden" name="cart_quantity" value="1"></input>
    <input type="hidden" name="products_id" value="910"></input>
    
    <input name="" type="submit" value="submit"></input>
    Make sure you send the correct attributes of the product.

    Think, that using the securityToken you can embed swf that send product to the cart.

    Enjoy!

    THREAT SOLVED!!
    Last edited by aire; 10 Jul 2014 at 10:10 AM. Reason: Mark as SOLVED!

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,870
    Plugin Contributions
    96

    Default Re: Add product to Cart URL ZC 1.5.1

    ... or you could have created the form using the function zen_draw_form and it would have added the hidden field for the securityToken as part of its processing.

 

 

Similar Threads

  1. Replies: 1
    Last Post: 14 Jan 2013, 03:43 AM
  2. Attribute add to cart url
    By Endre in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 26 Oct 2009, 03:16 PM
  3. Add a return URL to add to cart
    By directpc in forum General Questions
    Replies: 9
    Last Post: 31 Oct 2007, 07:14 PM
  4. Products URL and Add to Cart
    By digidiva-kathy in forum General Questions
    Replies: 2
    Last Post: 18 Sep 2007, 02:50 PM
  5. Add Product to Cart URL
    By Webbo1969 in forum Customization from the Admin
    Replies: 24
    Last Post: 27 Mar 2007, 01:38 AM

Posting Permissions

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