passing hidden products with custom form

Discussion in 'Templates customization' started by dale_s, Oct 19, 2018.

  1. dale_s

    dale_s aMember Pro Customer

    Joined:
    Apr 12, 2013
    Messages:
    96
    We use this custom form in WordPress to sign members up to product:

    Code:
    <form action="/members/signup" class="am-signup-form" id="page-0" method="post" name="page-0">
    <input class="form-control" id="name_f-0" name="name_f" size="15" type="text">
    <input class="form-control" id="email-0" name="email" size="30" type="text">
    <input class="btn btn-warning space-below-paragraph" id="_qf_page-0_next-0" name="_qf_page-0_next" type="submit" value="Get Access Now">
    <input height="1" id="_qf_default" name="_qf_page-0_next" src="/members/application/default/views/public/img/empty.gif" style="display: none;" type="image" width="1">
    <input id="_save_-0" name="_save_" type="hidden" value="page-0">
    <input data-first_price="0.00" data-paysys="" data-second_price="" id="product_id_page-0-0" name="product_id_page-0" type="hidden" value="2-2">
    <input id="paysys_id-0" name="paysys_id" type="hidden" value="paypal">
    </form>
    The form also has javascript (which we didn't include here) and it works great.

    We are trying to pass multiple hidden products through with the form. For example, in the from above, you can see:

    Code:
    <input data-first_price="0.00" data-paysys="" data-second_price="" id="product_id_page-0-0" name="product_id_page-0" type="hidden" value="2-2">
    But if we try to include 3 total hidden products in the form, it only gives the member one of the products:

    Code:
    <form action="/members/signup" class="am-signup-form" id="page-0" method="post" name="page-0">
    <input class="form-control" id="name_f-0" name="name_f" size="15" type="text">
    <input class="form-control" id="email-0" name="email" size="30" type="text">
    <input class="btn btn-warning space-below-paragraph" id="_qf_page-0_next-0" name="_qf_page-0_next" type="submit" value="Get Access Now">
    <input height="1" id="_qf_default" name="_qf_page-0_next" src="/members/application/default/views/public/img/empty.gif" style="display: none;" type="image" width="1"> 
    <input id="_save_-0" name="_save_" type="hidden" value="page-0">
    <input data-first_price="0.00" data-paysys="" data-second_price="" id="product_id_page-0-0" name="product_id_page-0" type="hidden" value="2-2"> 
    <input data-first_price="0.00" data-paysys="" data-second_price="" id="product_id_page-0-0" name="product_id_page-0" type="hidden" value="16-16"> 
    <input data-first_price="0.00" data-paysys="" data-second_price="" id="product_id_page-0-0" name="product_id_page-0" type="hidden" value="15-15"> 
    <input id="paysys_id-0" name="paysys_id" type="hidden" value="paypal">
    </form>
    You can see the 2 additional products (15 and 16) in the hidden form fields above.

    I know when creating custom forms within aMember admin in the "Forms Editor" area, there is an option to subscribe members to multiple hidden products using "Add Subscription Before Payment."

    But when creating our own custom forms (straight from html and javascript) within WordPress, is there a method to subscribe members to multiple hidden products?

    Thanks for any help with this.
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Please replace name of input elements to product_id_page-0[]:
    HTML:
    <input data-first_price="0.00" data-paysys="" data-second_price="" name="product_id_page-0[]" type="hidden" value="2-2">
    <input data-first_price="0.00" data-paysys="" data-second_price="" name="product_id_page-0[]" type="hidden" value="16-16">
    <input data-first_price="0.00" data-paysys="" data-second_price="" name="product_id_page-0[]" type="hidden" value="15-15">
    It should help.
  3. dale_s

    dale_s aMember Pro Customer

    Joined:
    Apr 12, 2013
    Messages:
    96
    Caesar,

    Thank you for the suggestion. I made the change to all the product hidden fields, but whenever I test a signup, no products are added to the new test member. The test member shows in aMember admin as pending, with no products added.

    Also, as in your example, instead of excluding...

    Code:
    id="product_id_page-0-0"
    ... I tried changing it to...

    Code:
    id="product_id_page-0[]"
    This didn't help either. The new member still comes back as pending with no products added.

    You can see/test form on the following page on our test site (right above footer where it says "Don't Miss Anything!"):

    https://www.healthyhouseclub.com

    Any other suggestions on what I can do to get this working? Thank you for any help with this.
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295

Share This Page