By default, the VirtueMart checkout process will ask for more information from your customer than is actually needed by your store. To help reduce the form-field overload that you customer may face when trying to purchase a product from your online store, it can help to actually remove fields that are not necessary to your business. Do you really need to know the “company", "title", or "fax number” of a customer? If not, then this tutorial will show you how to remove those fields.
Changing the following file will impact the Billing Information and the Shipping Information (Shipping Address) forms that appear during the VirtueMart checkout process.
The file you will need to edit can be found here:
/administrator/components/com_virtuemart/classes/ps_userfield.php
Search for the function getSkipFields()
By default, the skipped fields are the username, password, password check, and the check for the terms of service agreement.
function getSkipFields() {
return array( 'username', 'password', 'password2', 'agreed' );
}
What this function does is returns an array to the caller of the fields that should be skipped when generating the forms. The choice for fields are (* required by VirtueMart):
You can add any of the above fields to the return array. For example:
function getSkipFields() {
return array( 'username', 'password', 'password2', 'agreed', 'company', 'title', 'fax', 'phone_2', 'middle_name' );
}
After adding the fields that you don’t want shown, you need to make one more change to the ps_userfield.php file.
Search for the function getUserFields and change the variable $exclude_skipfields to true. Basically, this will tell the function to obey the array in getSkipFields() when generating the form for user information.
The final step is to edit the following file which displays the information back to the user on the shipping address page:
/components/com_virtuemart/themes/default/templates/checkout/customer_info.tpl.php
Look within this file and remove the table rows that correspond with the fields that your removed. For example, if you added company to the skip fields array above, you will want to remove the entire row that displays company in customer_info.tpl.php.
After you have completed those two steps, upload the files to your server and you should see the changes immediately.
Changing the following file will impact the Billing Information and the Shipping Information (Shipping Address) forms that appear during the VirtueMart checkout process.
The file you will need to edit can be found here:
/administrator/components/com_virtuemart/classes/ps_userfield.php
Search for the function getSkipFields()
By default, the skipped fields are the username, password, password check, and the check for the terms of service agreement.
function getSkipFields() {
return array( 'username', 'password', 'password2', 'agreed' );
}
What this function does is returns an array to the caller of the fields that should be skipped when generating the forms. The choice for fields are (* required by VirtueMart):
- username
- password
- password2
- agreed
- company
- title
- fax
- phone*
- phone_2
- first_name*
- middle name
- last_ name*
- city*
- address*
- address_2
- zip*
- country*
- state*
You can add any of the above fields to the return array. For example:
function getSkipFields() {
return array( 'username', 'password', 'password2', 'agreed', 'company', 'title', 'fax', 'phone_2', 'middle_name' );
}
After adding the fields that you don’t want shown, you need to make one more change to the ps_userfield.php file.
Search for the function getUserFields and change the variable $exclude_skipfields to true. Basically, this will tell the function to obey the array in getSkipFields() when generating the form for user information.
The final step is to edit the following file which displays the information back to the user on the shipping address page:
/components/com_virtuemart/themes/default/templates/checkout/customer_info.tpl.php
Look within this file and remove the table rows that correspond with the fields that your removed. For example, if you added company to the skip fields array above, you will want to remove the entire row that displays company in customer_info.tpl.php.
After you have completed those two steps, upload the files to your server and you should see the changes immediately.
Comments
Post a Comment