Skip to main content

Developer Note: PayPal Only Checkout - Changing the Confirm Order Button

If your store will only be using PayPal as a payment handler, the customer experience can be improved by replacing the "Confirm Order" button at the end of the checkout process with an actual PayPal button.

The old button doesn't convey to your customer that they will be taken to PayPal to complete their order.

All we're going to do with this post, is show how to change that "Confirm Order" button into this a Paypal button

The file you want to edit is found here:

\components\com_virtuemart\themes\default\templates\checkout\get_final_confirmation.tpl.php

Within this file, search near the bottom for the following code:

<div align="center">
<input type="submit" onclick="return( submit_order( this.form ) );" class="button" name="formSubmit" value="<?php echo $VM_LANG->_('PHPSHOP_ORDER_CONFIRM_MNU') ?>" />
</div>
The button has a class called input.button found in your templates css file, but we’ll be changing it to a specific id.  Basically, the idea will be to remove the text that is shown so delete the PHP echoed text.  On top of that, we need to change the class to a class or id (this example will assign an id) to handle the new appearance.



The old code should be changed to something similar to the code shown below:
<div align="center">
<input type="submit" onclick="return( submit_order( this.form ) );" id="confirm_button" name="formSubmit" value="" />
</div>
Notice, in the above code, that the id of the button has been changed to confirm_button. You can give it whatever declaration you wish, but you just need it to be unique. You will declare a style for it in your CSS file. We are going to add the id declaration to the template css (ie. template.css) where the class input.button is declared.

Now, go to your template css file and search for the class input.button. Create 2 new id declarations similar to the button class declarations:

#confirm_button{

}
#confirm_button:hover, #confirm_button:focus{

}

Now, grab a PayPal image from the PayPal site. Just right-click and select save image. They give you the option to point to an image on their server, but it’s better to host your own image so that you’re in control if they decide to update their images, again, in the future.

Now, you need to edit your CSS entries for the new button id. Check the width and height of the image you downloaded and enter them into the CSS class. You can play around with the padding, but I just left it the same as the button class. The background image will be the location of the image on your server relative to this CSS file.
#confirm_button{
 width:145px;
 height:42px;
 padding: 3px 5px;
 background: url(../images/btn_xpressCheckout.gif) no-repeat top #FFFFFF;
}
For the hover and focus traits, change the cursor to a pointer. Changing it to an pointer gives this background image the semblance of being an actual button.
#confirm_button:hover, #confirm_button:focus {
 cursor: pointer;
}
After this, you will need to upload 3 files to your server:

1) get_final_confirmation.tpl.php -> with the edited submit button code.
2) the CSS file you edited with the new id for your submit button.
3) the PayPal image in the correct directory relative to your CSS file where it is mentioned.

In summary, you need to edit the style of submit button in get_final_confirmation.tpl.php and remove it’s text that gets echoed to the screen. You then need to either handle the style change right there in the file or in your general CSS file. You will also need to provide the PayPal image to show, which can be found by searching for PayPal images or by going to the link mentioned above in this article.  You may need to edit the button (borders, background color) to get it to fit in with your site.

Overall, this is a great way to customize a site that will only rely on PayPal as your payment option. Adding an actual PayPal button gives your visitors a clear message of where they are going when they click on the button.

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)

Divi Theme - Remove pause 'on hover' of the full width slider

In the Divi theme, open up /js/custom.js Comment out the following code (around line 144) if ( settings.slideshow && et_slides_number > 1 ) { $et_slider.hover( function() { $et_slider.addClass( 'et_slider_hovered' ); if ( typeof et_slider_timer != 'undefined' ) { clearInterval( et_slider_timer ); } }, function() { $et_slider.removeClass( 'et_slider_hovered' ); et_slider_auto_rotate(); } ); }