We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12379
    • 460 Posts
    Need to pass some cookie variables into eform from a js cart.

    I have the cart displaying on the checkout page from within &tpl=`orderForm` chunk.

    [!eForm2db_contact!]

    [!eForm? &formid=`orderForm` &subject=`[+subject+]` &to=`[email protected]` &ccsender=`1` &eFormOnBeforeMailSent=`eForm2db_contact` &tpl=`orderForm` &report=`ContactFormReport` &gotoid=`34`!]

    normally the posted variables would look something like this in my old php email processing script:

    $QUANTITY_1
    $PRICE_1
    $NAME_1

    $QUANTITY_2
    $PRICE_2
    $NAME_2
    etc

    $SUBTOTAL
    $TOTAL
    $SHIPPING

    Any suggestions for getting them into eForm please?
      Mostly harmless.
      • 7231
      • 4,205 Posts
      Add a function to add these to the email report. Yuo can edit the efor2db snippet and include this function as well on the same event. Check in /assets/snippets/eform/docs/eform_example_events.htm for an example of how to do this, but you will need to edit it to work with cookie variables.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 12379
        • 460 Posts
        OK gotcha but have just discovered the cart automatically generates the hidden fields anyhow when it’s called on the checkout page.

        I’m no programmer, but any clues for a script that loops to show the code below for each item, times the number of items in the cart?

        &report chunk "orderReport"

        (loop 1 displays...)
         <p>ID_1: [+ID_1+]</p>
         <p>QUANTITY_1: [+QUANTITY_1+]</p>
         <p>PRICE_1: [+PRICE_1+]</p>
         <p>SHIPPING_1: [+SHIPPING_1+]</p>
         <p>ADDTLINFO_1: [+ADDTLINFO_1+]</p>
        
        (loop 2 displays...)
         <p>ID_2: [+ID_2+]</p>
         <p>QUANTITY_2: [+QUANTITY_2+]</p>
         <p>PRICE_2: [+PRICE_2+]</p>
         <p>SHIPPING_2: [+SHIPPING_2+]</p>
         <p>ADDTLINFO_2: [+ADDTLINFO_2+]</p>
        
          Mostly harmless.