Im getting this every time in the Checkout complete page

Notice: Undefined offset: 0 in commerce_google_analytics_ecommerce_js() (line 68 of C:\damp\www\es_gshop\sites\all\modules\commerce_google_analytics\commerce_google_analytics.module).

Any hint?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brunorios1’s picture

Priority: Normal » Major
urlaub’s picture

I can confirm this bug under latest drupal dev 7.11 and drupal commerce 7.1.0

wayout’s picture

Can also confirm I get this same message.

yannisc’s picture

Same here. PHP 5.3

yannisc’s picture

A quick solution to hide the notice is to change line 68 of commerce_google_analytics.module from:

$tax_sum += commerce_currency_amount_to_decimal($tax_component[0]['price']['amount'], $tax_component[0]['price']['currency_code']);

to:

$tax_sum += @commerce_currency_amount_to_decimal($tax_component[0]['price']['amount'], $tax_component[0]['price']['currency_code']);

willieseabrook’s picture

Status: Active » Needs review
FileSize
891 bytes

This occurred for me when a tax rate is not applied. If the tax is not applied, then $tax_component[0]['price']['amount'] never exists.

The specific example on our site is that we ship to two countries - Australia and New Zealand.

Australian tax is applied to orders shipped to Australia
New Zealand tax applied to orders shipping to New Zealand

So for each order, one tax is not applied.

See my patch which adds a condition to first check whether the tax has been applied or not.

Cyberschorsch’s picture

This still needs to be reviewed please.

Cyberschorsch’s picture

Status: Needs review » Fixed

Commited in new 7.10 release

Cyberschorsch’s picture

Status: Fixed » Closed (fixed)
zambrey’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Looks like this fix wasn't commited
http://drupal.org/node/1136656/commits

Error still occurs in 7.x-1.0.

zambrey’s picture

Priority: Major » Normal
Status: Reviewed & tested by the community » Needs review
FileSize
1.15 KB

Actually the patch needs to be rerolled.
Also removed some extra whitespaces.

douggreen’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.11 KB

Here is the same patch as above but without the extra spaces, and adds a period to the end of the comment (proper Drupal coding standards).

This patch (and the one above) works for me.

Cyberschorsch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks ppl! Committed and pushed in the dev release for now.

Status: Fixed » Closed (fixed)

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