Adding a Customer Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • becker
    Mini Mivite

    • Nov 2013
    • 47

    #1

    Adding a Customer Field

    Is there a way to add a customer field (Store settings -> Customer Fields)?

    I'm having issues with customers entering their company name for their home business, and then shipping products with FedEx to their home address. This is giving them the company rate on FedEx shipping when the actual amount to ship is the residential rate. FedEx web services seems to decide on company/residential rate based on there being a name in the Company box, so I would like to hide this box, but I still want to retrieve the company name for a customer's order.

    Changing the way that FedEx web services decides if an order is residential/company would also solve this issue. Is there a way to do this?
  • Brennan
    Super Moderator









    • Jun 2009
    • 3481

    #2
    Re: Adding a Customer Field

    Yes, Miva has built in custom fields that allow you to add custom customer fields.

    Here are some resources to get you started:

    The most flexible & secure ecommerce software on the market. Build your online store today with a shopping cart platform by Miva Merchant.

    The most flexible & secure ecommerce software on the market. Build your online store today with a shopping cart platform by Miva Merchant.


    To hide the built in Company Field you can mark it as hidden under Store Settings. Keep in Mind, if you have customized account create / OCST pages, changing this validation will revert these pages to default. After you make the settings adjustment you will need to go into these pages and recall the previous version then manually remove the company field form the template.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    • becker
      Mini Mivite

      • Nov 2013
      • 47

      #3
      Re: Adding a Customer Field

      Thank you for those resources, very helpful.

      So far I've got a custom order field set up and an input for it on the customer information page. Now, I need to actually write the data from that input to the order field. I see the appropriate code for this,
      Code:
      <mvt:item name="customfields" param="Write_Order( 1000, 'custom_field_code', 'value')" />
      But my issue now is that I'm not sure what the best method to get that code executed would be. I believe the page is mostly the standard OCST template (checkout: customer information), and the form is submitting POST data with the action:
      Code:
      action="&mvt:global:secure_sessionurl;"
      How can I add my necessary processing code to the action to have the value written to the custom field? Perhaps I can just process the data on the next page of the checkout process? If this is a good method, how can I retrieve the POST data from the form using SMT?
      Last edited by becker; 02-19-14, 12:23 PM.

      Comment

      • Brennan
        Super Moderator









        • Jun 2009
        • 3481

        #4
        Re: Adding a Customer Field

        If you are doing this on the account create screen you would want to use Write_Customer_Login Not Write_Order since they would not have an order number to save the data to at that point.


        All form inputs automatically become global variables on the page the form was posted to. You can access them like by using g.input_name


        So for what you are trying to do, on ACAD (Account Add) you would add an input to the form to collect the company name. It would look something like this:


        Code:
        <input type="text" name="Company_Name" value="" >

        Then on the page the form submits to, typically ACED you would add the Write_Customer_Login function to save the value of that input to the custom customer field


        Code:
        <mvt:if expr="g.Action EQ 'ICST' ">
            <mvt:item name="customfields" param="Write_Customer_Login( g.customer:login, 'custom_field_code', g.Company_Name)" />
        </mvt:if>

        The value of g.Company_Name will be whatever the customer typed in on the previous page. I also wrapped it in a check for the ICST action (which is the account create action) so it only executes when a new account is being created, not each time someone visits the ACED page.
        Last edited by Brennan; 02-19-14, 02:57 PM.
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment

        • becker
          Mini Mivite

          • Nov 2013
          • 47

          #5
          Re: Adding a Customer Field

          Perfect, got it all figured out now. Thanks for the help.

          Comment

          Working...
          X