Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

About the bug in google analytics version 2.3.4: #104

Description

@joeszeto

Please follow it for the future version too

About the bug in google analytics version 2.3.4:

Problem 1 (fixed):
Payment error wrongly send to the google analytics as a successful case.

Modules:
modules/ganalytics/ganalytics.php

Situation:

Payment error should not send to the google analytics, since it has a checking code when buyers click the “pay” in payment side. After the checking, the data which insert to the database table “ps_ganalytics” will send to google analytics. And the first time checking, payment error can be correctly rejected to insert to the database table “ps_ganalytics”

Problem:

In some special case, payment error also insert to the database table “ps_ganalytics”. It leads google analytics show the wrong information.

For example, I have a payment error record in 10:00am and this record is correctly showed in the admin url > orders > orders. This record does not insert to the database table “ps_ganalytics”, everything is still fine.

However, once our employees who view the record in the admin url > orders > orders, and click the “View” for more details in this payment error at 5:00pm.

The module of ganalytics will be double checked the record to send to google analytics or not, if not, module will send again.

Line716:
if ($this->context->controller->controller_name == 'AdminOrders')
{
if (Tools::getValue('id_order'))
{
$order = new Order((int)Tools::getValue('id_order'));
if (Validate::isLoadedObject($order) && strtotime('+1 day', strtotime($order->date_add)) > time()) {
$ga_order_sent = Db::getInstance()->getValue('SELECT id_order FROM '._DB_PREFIX_.'ganalytics WHERE id_order = '.(int)Tools::getValue('id_order'));

As you see, the red font is line716.
Here will not check the record which is payment error or not.
Then this error record will insert to the database table “ps_ganalytics” and the time is 5:00pm.

Finally, it means that if our employees check the reason of payment in admin url, this record will also be sent to google analytics as a successful case.

Solution:

Edit the line 716 to check payment error:

if (Validate::isLoadedObject($order) && strtotime('+1 day', strtotime($order->date_add)) > time() && $order->getCurrentState() != (int)Configuration::get('PS_OS_ERROR')) {

Problem 2 (not fixed):
Some of payment record missing by double orders references.

Situation:
Since some product are special cases, they are limited in some regions.
For the shipping of these products, they have specialized shipping method.

However, some buyers may buy more than one products which include special products and normal products. It will become a two shipping for this payment.

For this case, prestashop will combine two shipping cost as one order.
For the admin url > orders > orders, this payment record will become two different orders but same order reference.

For the modules of ganalytics.php, it will only insert one order reference record and ignore another one to the database table “ps_ganalytics”.

In the end, google analytics will miss some payment record.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions