Download & Extend

uc_googleanalytics on custom order complete page

Project:Ubercart
Version:6.x-2.4
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

AttachmentSizeStatusTest resultOperations
uc_googleanalytics_20091106_HEAD.patch1.01 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uc_googleanalytics_20091106_HEAD.patch.View details

Comments

#1

Version:6.x-2.0» 6.x-2.4

We've encountered this issue too, which still exists in 2.4. This patch provides an effective fix. Here's my +1 for including it in the next release.

Thanks, David

#2

My apologies. This is still an issue in 2.4. However, the patch provided above does not apply successfully to the 2.4 version of uc_googleanalytics.module. I've attached an updated version below.

Thanks, David

AttachmentSizeStatusTest resultOperations
uc_googleanalytics-completion.patch508 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uc_googleanalytics-completion_0.patch.View details

#3

Status:active» needs review

#4

Status:needs review» needs work

The last submitted patch, uc_googleanalytics-completion.patch, failed testing.

#5

Status:needs work» fixed

Committed to both branches.

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.