Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2007
    Posts
    25
    Plugin Contributions
    0

    Default Intercepting order and adding to cart with PHP cURL

    I have a few unique products that required custom attributes that I couldn't achieve with the standard admin attributes tools.

    The solution I'm working on requires the add-to-cart button to point to a form processor I'm writing.

    I have it finished enough to test, but it's failing every time. Here is the basic flow

    Users submits add to cart button on my custom form
    POST is sent to my custom form processor
    the form processor works with the data
    then POSTS to form to /path-to-folder/zencart/index.php?main_page=product_info&number_of_uploads=0&action=add_product& amp;products_id=#

    zen-cart is rejecting the order and I can't figure out why.

    The form fields I am submitting seem to be identical to what a standard product page would contain

    Array
    (
    [cart_quantity] => 1
    [products_id] => 2
    [id] => Array
    (
    [5] => #
    [txt_6] => text
    [txt_7] => text
    [4] => #
    [2] => #
    [txt_3] => #
    [txt_8] => text
    [9] => Array
    (
    [20] => 20
    [22] => 22
    [23] => 23
    )
    )
    )

    Submitted as multipart data

    Any ideas on what I am lacking that zen-cart is expecting in that post?

    Thanks!

  2. #2
    Join Date
    Mar 2004
    Posts
    16,042
    Plugin Contributions
    5

    Default Re: Intercepting order and adding to cart with PHP cURL

    what exactly were you not able to setup with stock attributes?
    Zen cart PCI compliant Hosting

  3. #3
    Join Date
    Oct 2007
    Posts
    25
    Plugin Contributions
    0

    Default Re: Intercepting order and adding to cart with PHP cURL

    Quote Originally Posted by Merlinpa1969 View Post
    what exactly were you not able to setup with stock attributes?
    You can see the page here
    http://noteableyou.com/zencart/index...&products_id=2

    I'm doing a few other things behind the scenes, but the one that pushed me in this direction is...
    I have about 350 fields (check boxes and text inputs) that get validated and condensed into one field that zen-cart receives. The checkboxes are generated dynamically so this method seemed like the best approach to me.

    Just to test I copied all the source from a zen-cart generated page into a plain html page here just to see if it would post
    link

    Those get added to the cart no problem. So I have a feeling it's something in the way I am formating or sending the data.

    Does anyone know of a PHP function that will show the raw data submitted from a form including headers and all so I could compare the two?

    Thanks!

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Intercepting order and adding to cart with PHP cURL

    Posting to the cart via CURL is going to be pointless because the cart session you create via CURL is only valid for that CURL session, which is completely unrelated to your current browser session.

    You'll have to post directly to the cart using the same browser instance as the customer is already using.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Oct 2007
    Posts
    25
    Plugin Contributions
    0

    Default Re: Intercepting order and adding to cart with PHP cURL

    Quote Originally Posted by DrByte View Post
    Posting to the cart via CURL is going to be pointless because the cart session you create via CURL is only valid for that CURL session, which is completely unrelated to your current browser session.

    You'll have to post directly to the cart using the same browser instance as the customer is already using.
    I'm not a security expert so perhaps that is completely the case. I was under the impression that if the cURL script captured the header information (including the sessionID and cookies) from the post the user made and modified the outgoing headers to match that cURL could make a transparent post appearing as if nothing was out of the ordinary.

    I may revisit this at some point, but for now I suppose I'll proceed to do things without cURL for the sake of time.

    Thanks so much for your input DrByte & Merlinpa1969!
    Last edited by jds580s; 29 Oct 2007 at 08:40 PM. Reason: spelling

 

 

Similar Threads

  1. v151 using easyphp getting CURL and CURL SSL support error
    By lepitite in forum Installing on a Windows Server
    Replies: 2
    Last Post: 6 Jan 2014, 02:48 PM
  2. Having problem with order.php and checkout_process.php with OLD Zen Cart v1.2.3
    By wolfbane01 in forum Managing Customers and Orders
    Replies: 0
    Last Post: 28 Jul 2010, 01:56 AM
  3. XAMPP and PHP cURL in php.ini
    By Jack28 in forum General Questions
    Replies: 2
    Last Post: 21 Dec 2009, 02:46 AM
  4. Intercepting Order confirmation email - injecting license key
    By savage in forum Customization from the Admin
    Replies: 0
    Last Post: 24 May 2007, 11:58 PM
  5. Adding products to cart with CURL?
    By borkybrown in forum General Questions
    Replies: 7
    Last Post: 11 Aug 2006, 04:07 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