Announcement

Collapse
No announcement yet.

Replacing the EmporiumPlus Custom Customer Fields Interface module

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bruce - PhosphorMedia
    replied
    If by trigger, you mean "when does the detection occur" it would be before since miva's is processed on page load and jQuery is DOM specific (meaning it occurs ON the page). However, ".appendTo()" specifically adds the content to the 'end' of the div.

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    You could try using the jQuery .appendto() method.

    Code:
    $(document).ready(function (){ $('#customField1, #customField2').change(function(){ if($("#customField1").val().length && $("#customField2").val().length){ $("#confirm_button_login").prop('disabled', false); } else { $("#confirm_button_login").prop('disabled', true); ("Sorry, we need more info".appendTo( "#Error_Message" );} }); }); <input type="submit" id="confirm_button_login" value="Login" disabled="disabled"/>
    Added: ("Sorry, we need more info".appendTo( "#Error_Message" )

    where Error_Message is the id of the existing error message display. would probably take some tweaking of that code as this just an 'example' of the method and would need to create variables so you can identify the field.

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    The easiest method is just use the HTML5 "required" attribute on the form.


    <input type="text" name="customField1" value="&mvt:customField1;" required>

    If the customer attempts to submit the form, it will display a small prompt indicating that a value is needed.

    Another method would be jQuery as i prefer to let people know it won't work BEFORE they try

    Code:
     
     $(document).ready(function (){     $('#customField1, #customField2').change(function(){         if($("#customField1").val().length && $("#customField2").val().length){                 $("#confirm_button_login").prop('disabled', false);         } else {                 $("#confirm_button_login").prop('disabled', true);         }     }); });  <input type="submit" id="confirm_button_login" value="Login" disabled="disabled"/>
    This will work for any input since we are using the .change trigger (many examples use .keyup for some reason)

    Otherwise, you can test on the ACED screen for the values, then do a redirect back to ACAD (with Query Strings indicating the missing data)

    Leave a comment:


  • lesliekirk
    replied
    So back to my issues with trying to replace the EP module. How can I make these custom fields required like the EP module can?

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    yea, that's why i never read the documentation :)

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Bruce - PhosphorMedia View Post

    It's under the "Show Items" list on the batch edit mode for Customers (not Store Settings | Customers) or under Custom Fields for the individual customers so the Guide as a typo.
    That's kind of a big typo

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Originally posted by lesliekirk View Post
    Color me even more confused. I'm reading through the Miva Docs for Custom Fields. Under the Type +Customer. It says it's to "Add customer filed to the Store Settings > Customer Field Tab." I'm not seeing any of these Customer Custom Fields showing up on the Store Settings > Customer Fields Tab at all.





    It would be awesome if this worked as advertised.
    It's under the "Show Items" list on the batch edit mode for Customers (not Store Settings | Customers) or under Custom Fields for the individual customers so the Guide as a typo.

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Originally posted by lesliekirk View Post

    Point of clarification - the Custom fields empty on the ACAD screen, the data passes to the ACED once the error has been fixed.
    That's what I thought you meant, and coding that on the ACAD screen should prevent the dumping of the data entered.

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Originally posted by lesliekirk View Post
    On the ACAD screen, what does this script do?



    Code:
    <mvt:if expr="g.Basket:cust_id AND g.Customer_Session_Verified AND l.settings:customer:address_count">
    <script type="text/javascript">
    var MvCustomerAddresses = [];
    
    <mvt:foreach iterator="address" array="customer:addresses">
    MvCustomerAddresses[ <mvt:eval expr="int( l.settings:address:id )" /> ] = {
    "id": <mvt:eval expr="int( l.settings:address:id )" />,
    "cust_id": <mvt:eval expr="int( l.settings:address:cust_id )" />,
    "descrip": "&mvtj:address:descrip;",
    "fname": "&mvtj:address:fname;",
    "lname": "&mvtj:address:lname;",
    "email": "&mvtj:address:email;",
    "comp": "&mvtj:address:comp;",
    "phone": "&mvtj:address:phone;",
    "fax": "&mvtj:address:fax;",
    "addr1": "&mvtj:address:addr1;",
    "addr2": "&mvtj:address:addr2;",
    "city": "&mvtj:address:city;",
    "state": "&mvtj:address:state;",
    "zip": "&mvtj:address:zip;",
    "cntry": "&mvtj:address:cntry;",
    "resdntl": <mvt:if expr="l.settings:address:resdntl">true<mvt:else>false</mvt:if>
    };
    </mvt:foreach>
    </script>
    </mvt:if>
    These create a list (and accompanying data) for the drop down box of 'Other Addresses'. If you where going to support custom fields with multiple saved addresses, you'd have to add them to this list as well.

    Leave a comment:


  • lesliekirk
    replied
    Color me even more confused. I'm reading through the Miva Docs for Custom Fields. Under the Type +Customer. It says it's to "Add customer field to the Store Settings > Customer Field Tab." I'm not seeing any of these Customer Custom Fields showing up on the Store Settings > Customer Fields Tab at all.





    It would be awesome if this worked as advertised.
    Last edited by lesliekirk; 08-05-20, 04:55 AM.

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Bruce - PhosphorMedia View Post
    Just use Custom Customer Fields...unless I'm missing something...as for losing data...just make sure you read the CGI variables back into the field. For example, if you have:

    Referred By: <input type="text" name="refer_custom_field" value="&mvte:global:refer_custom_field;">

    on page reload, the g.refer_custom_field should contain whatever was entered.
    Point of clarification - the Custom fields empty on the ACAD screen, the data passes to the ACED once the error has been fixed.

    Leave a comment:


  • lesliekirk
    replied
    On the ACAD screen, what does this script do?



    Code:
    <mvt:if expr="g.Basket:cust_id AND g.Customer_Session_Verified AND l.settings:customer:address_count">
        <script type="text/javascript">
            var MvCustomerAddresses = [];
    
            <mvt:foreach iterator="address" array="customer:addresses">
                    MvCustomerAddresses[ <mvt:eval expr="int( l.settings:address:id )" /> ] = {
                        "id":       <mvt:eval expr="int( l.settings:address:id )" />,
                    "cust_id":  <mvt:eval expr="int( l.settings:address:cust_id )" />,
                    "descrip":  "&mvtj:address:descrip;",
                    "fname":    "&mvtj:address:fname;",
                    "lname":    "&mvtj:address:lname;",
                    "email":    "&mvtj:address:email;",
                    "comp":     "&mvtj:address:comp;",
                    "phone":    "&mvtj:address:phone;",
                    "fax":      "&mvtj:address:fax;",
                    "addr1":    "&mvtj:address:addr1;",
                    "addr2":    "&mvtj:address:addr2;",
                    "city":     "&mvtj:address:city;",
                    "state":    "&mvtj:address:state;",
                    "zip":      "&mvtj:address:zip;",
                    "cntry":    "&mvtj:address:cntry;",
                    "resdntl":  <mvt:if expr="l.settings:address:resdntl">true<mvt:else>false</mvt:if>
            };
            </mvt:foreach>
        </script>
    </mvt:if>

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Just use Custom Customer Fields...unless I'm missing something...as for losing data...just make sure you read the CGI variables back into the field. For example, if you have:

    Referred By: <input type="text" name="refer_custom_field" value="&mvte:global:refer_custom_field;">

    on page reload, the g.refer_custom_field should contain whatever was entered.

    Leave a comment:


  • Replacing the EmporiumPlus Custom Customer Fields Interface module

    I'm working on converting as store using this module to using "default" coding. The way the module handled it seems so easy. Additional Customer information is being collected when a customer creates an account on the ACAD screen. Then that same information is displayed on the ACED screen and can also be updated there.

    Here's an example of one of many additional fields

    There is a Custom Customer Field "TYPE" and to collect the data this is used:


    Code:
    <mvt:item name="custedit" param="TYPE" />
    <mvt:if expr="g.error_messages AND ISNULL l.settings:custedit:current:value">
        <div class="&mvte:global:BillFirstName_Row; invalid">
    <label class="required" for="l-Customer_&mvt:custedit:current:name;"><strong><span style="color:#FF0000;">&mvt:custedit:current:name;:</span></strong></label>
    <mvt:else>
        <div class="&mvte:global:BillFirstName_Row;">
    <label class="required" for="l-Customer_CCF_TYPE"><strong>&mvt:custedit:current:name;:</strong></label>    
        </mvt:if>    
    <input type="text" size="25" name="Customer_CCF_TYPE" value="&mvte:custedit:current:value;" id="l-Customer_CCF_TYPE" class="input">
    
            </div>

    To display the content on the ACED screen, this code is used:

    Code:
    <div class="&mvte:global:BillFirstName_Row;">
                <label class="required" for="l-Customer_ShipFirstName">Type of Business?:</label>
                <input type="text" size="25" name="Customer_CCF_TYPE" value="&mvte:global:Customer_CCF_TYPE;" class="input">
            </div>

    Something else I have noticed with this code, if an error message reloads the page, all the content entered into these fields is wiped out. Very very frustrating.

    So is there an easy peasy method to replace this code? And will that method retain the information in the field if the page reloads due to an error?



Working...
X