Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: Two field comparison  (Read 686 times)

Offline AVS

  • Newbie
  • *
  • Posts: 42
  • Karma: +6/-0
    • View Profile
Two field comparison
« on: October 19, 2017, 12:30:33 AM »
Hi All
 Please tell me how to add Confirm Email Field in Guest Checkout _Step_1 page.  Confirm Email field and Email Field must match, If not throw error to the user. As many are aware of, this kind of matching field elements is most commonly used in all types of forms on all over the Internet. In Abantecart, there is no such built in form field for it. In my experience, I have noticed several people make mistakes while typing email addresses in forms in a hurry or due to some other reason. To avoid typo errors, this Confirm Email field in checkout page_ Step_I is important. This will avoid risks of sending auto response email landing in to wrong email address with personal details of a user.

I searched in this forum about this topic but could not find anything related to this issue.

I am a layman and so someone please give me all steps and code to be included to achieve it. In case if database tables also have to be altered, please tell me how to do it. I don't want to screw-down or mess with database. Hence, please guide me with each and every steps involved in it to achieve this. OR, if any other extension is already available for this, please let me know.
I request developers and others with programing knowledge to give me a solution. I hope this would hugely be useful not only for me but also for all Abantecart users/store owners.

Thanks
AVS  :)

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4152
  • Karma: +251/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Two field comparison
« Reply #1 on: October 20, 2017, 07:06:21 PM »
If you review development manuals AbanteCart is based on MVC (model/view/controller)

What you need, should be done in view or just controller listed below:

View for the page is located here:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default/template/pages/checkout/guest_step_1.tpl#L27

At line #27 there is a foreach loop that builds list of fields for general group.

In corresponding controller that builds data for the view above you can see section that prepares fields for general section:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/checkout/guest_step_1.php#L225

What you need to do, is add extra field with confirm email and add validation for it in here:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/checkout/guest_step_1.php#L599

Ideally, (to be safe on updates) we suggest to add changes in extension with the hook to controller and replacement template file.
You can read more about hooks and extensions in the manual:
https://abantecart.atlassian.net/wiki/spaces/DOC/overview

 


We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline AVS

  • Newbie
  • *
  • Posts: 42
  • Karma: +6/-0
    • View Profile
Re: Two field comparison
« Reply #2 on: October 21, 2017, 01:45:10 AM »
If you review development manuals AbanteCart is based on MVC (model/view/controller)

Thank you very much for explaining with how to do it. I understand a little on the flow of this related topic. Only part I will be stuck up with is to do validation code to compare both fields. Any help on this would be great. Thanks
AVS :)

 

Powered by SMFPacks Social Login Mod