How do I store custom fields Perch Shop/Members?

  • I'm currently using the method provided over in the docs: https://docs.grabaperch.com/addons/shop/examples/no-account/


    Incustomer_create_passwordless.html I modified the template as follows:


    When submitted and I look at the order area, pickup_location, tour_date, andterms-conditions are neither stored with the order (where it's supposed to be) nor the member profile.

    I tried utilizing cart-property in this template but it through an error.

    How can I collect and store these bits of information as a part of the customer's order?

  • This isn't the whole solution, but is a piece of the puzzle related to members. It may be enough for you figure out the rest in relation to shop.


    In templates > members > member.html, add your custom fields.


    The default member.html template looks like this:


    Code
    1. <perch:members type="text" id="first_name" label="First name" listing="true" order="1" />
    2. <perch:members type="text" id="last_name" label="Last name" listing="true" order="2" />


    Add your custom fields to this file:


    Code
    1. <perch:members type="text" id="pickup_location" label="Pickup location" listing="true" order="3" />


    Now your custom fields will appear in the control panel for each member.


    BTW I don't think you need an action in your perch form tag, why do you have that? You can use next="/shop/checkout/" if you need to advance the form to a specific page on submit.


  • So, JayW, this was indeed a great help.


    For justanotherdave and montlewis, the solution was found in /shop/customers/customer.html, I'm able to store and re-use as necessary.


    Thanks for the help guys.

    Anyone, know how to disable the first <option> in a <select>? The answer seems to have been on the old forum (https://forum.grabaperch.com/f…dselected-in-select-input) but this page is no longer available.

  • JayW, I was able to find the solution. I had already tried with the allowempty attribute, but that was not what I was looking for as it was still a valid option.

    Disabling the first <option> with the disabled attribute allows you to have filler text that will force users to pick an option and ensure there is a message available to inform the user what it is they're supposed to do.

    I got the solution. I added it to the forum here: Disabling and selecting first <option> in <perch:input type="select">?

    Thanks for all the help. :)

  • Disabling the first <option> with the disabled attribute allows you to have filler text that will force users to pick an option and ensure there is a message available to inform the user what it is they're supposed to do.

    Good to know that "!" disables an option. Personally I wouldn't use that for placeholder or instruction text, but it depends on the project.


    The HTML input label's job is to inform the user what to do for that input. If you need to force users to pick an option, you can use "allowempty" in combination with "required". The user will not be able to submit the form without selecting an option. But each to their own!


    Regarding "next", it replaces the word "action" in your perch form tag. This allows you to advance to other pages including the same page. You can use query strings... so for example "next=/member-profile?updated=1". When users edit their profile and click save, you can look for that query and present a message "details successfully updated" on the same page.