Skip to main content

Developer’s Note: Condensing Forms Displayed During VirtueMart Checkout

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):

  • 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

Popular posts from this blog

How To Run Chrome From Within Notepad++

If you have recently tried to Run  Chrome from within Notepad++ recently, you've probably encountered the same issue I did.  Chrome didn't run. The fix is actually really simple.  Open up the Run box in Notepad++ and browse to your installation of Chrome. ie.  C:\Program Files\Google\Chrome\Application\Chrome.exe Select the file when you find it.  Now, the trick is: Put quotation marks around the path you see in the Run  box.  Now, put 1 space after the closing quotation mark. Type this: $(FULL_CURRENT_PATH) It'll look something like this: Click Run .  If Chrome opens, click Save and set your hotkey.

Developer Note: Virtuemart - Editing the Add to Cart MooTool Popup

To edit the “Add To Cart” popup that appears when you add an item to a cart in Virtuemart, there are few files that you need to know about. These are the files to know \components\com_virtuemart\themes\default\theme.js \components\com_virtuemart\js\mootools\   - contains the files for editing the appearance of the popup. To edit the appearance of the box, edit \components\com_virtuemart\js\mootools\mooPrompt.css to change the styles as well as editing the 2 images in the directory to edit how they appear as well (close box and header-background)

Proper Viewport Scaling on iPad and iPhone

So, this is a little silly and I'm a little embarrassed to say that I've spent far too much of my time on this issue. I had a multi-page site that wasn't displaying correctly on my iPad.  One page would look great, but the next would have the top menu cut off on the right and everything would be slightly zoomed in. I realized that it was a scaling issue, but for all the experimenting I did with the meta viewport tag , I couldn't get it to work. Then I thought of something...some pages didn't have as much content as the others.  The longer pages were displaying great, it was the pages short on content that weren't.  So, I went ahead and set a min-height for each page of 1050px (I figured it had to be a little larger than the 1024px portrait height of an iOS device) and voila, it worked. All the pages showed correctly.  Now, I fully admit that this is most likely a hack that isn't considered the "proper way", but I am absolutely open to sugge...