uc_googleanalytics on custom order complete page

ecofinn - November 6, 2009 - 19:13
Project:Ubercart
Version:6.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

When the uc_googleanalytics.module is enabled, it should add the appropriate Google Analytics code to the footer of the page upon a successful checkout.

If the "Alternate checkout completion page:" option is used in the Checkout settings, this doesn't seem to work for url aliased completion pages.

Lines 69 - 74 of uc_googleanalytics.module (6.x-2.0) read as follows:

// Or if the URL is the custom completion page.
  $completion_page = variable_get('uc_cart_checkout_complete_page', '');

  if (!empty($completion_page) && $completion_page == $_GET['q']) {
    return TRUE;
  }

For a completion page stored as its url alias, this should compare the alias of $_GET['q'] with the 'uc_cart_checkout_complete_page variable, as follows

// Or if the URL is the custom completion page.
  $completion_page = variable_get('uc_cart_checkout_complete_page', '');

  if (!empty($completion_page) && $completion_page == drupal_get_path_alias($_GET['q'])) {
    return TRUE;
  }

This is a small change, but it took me a while to figure out.

I just checked out the latest HEAD version, and while the code has changed somewhat, it still seems to compare the uc_cart_checkout_complete_page variable directly with $_GET['q'].

It's only a one liner, but I attach a patch against HEAD in case it is of use.

Hope this helps.

AttachmentSize
uc_googleanalytics_20091106_HEAD.patch1.01 KB
 
 

Drupal is a registered trademark of Dries Buytaert.