Problem: points earned by customers are not awarded

Problem: points earned by customers are not awarded

Some merchants are experiencing anomalies with the allocation of points.

The points are attributed by the module, automatically, after the purchase.
At this stage, the points are not usable and remain pending validation.

Only validation will allow customers to use the points earned.
The validation is done, automatically, when the order goes to the status chosen by the merchant in the module configuration.

If, for example, the module is configured to award points for the status "Delivered", the points will be valid as soon as the order takes this status.

The bug reported is the following: the status of the order corresponds to the status used by the module to award the points earned to the customer.
Despite this, the points remain in the "pending" status and cannot be used.

How can we prevent this from happening again?

In this case, the following checks should be made.

1) Check that the "Merchandise Returns" option is not activated in the back office.
This option adds 14 days to validate the points, starting from the day the order takes the status that validates the points.

If the option is active, the points will be "Available"  only at the end of this period. 
This option is useful to prevent fraud: it prevents customers from using the earned points to place a second order and then request a refund for the first order.

The problem could be related to this option. In this case, the points will be awarded correctly within 14 days.

If this is not the cause of the problem, check the second point.

2) This type of problem can happen when another module uses the same hook that the "Loyalty Program" uses.

You will have to check this in the back-office:
- Go to the menu item Desing > Positions.
- Check the option to display all hooks 

- Look for the actionOrderStatusUpdate hook
- Check that the module "Loyalty Program" is in the first position in the list:

If this is not the case, move the module to the first position with a drag and drop.
This way the other modules will not interfere with the "Loyalty Program" and the points will be allocated correctly.

How to solve the problem?

We have seen how to prevent this problem from occurring. Now let's see how to validate the items that were pending validation and never validated.

If you are able to act on your site's database, you can run an SQL query to correct the problem.
To begin, identify the IDs corresponding to the status of the points. For example:

Points awaiting validation > ID 1
Validated points > ID 2

Then run this query to validate the pending points.
UPDATE 'ps_totloyalty' SET 'id_loyalty_state' = 2 WHERE 'id_loyalty_state' = 1 ;
Where the IDs used correspond to those in the example:
Points awaiting validation > ID 1
Validated points > ID 2

Warning: this query updates ALL the non-validated points (also for unpaid orders).

If you want to update only a few commands, here is the query to use: 
UPDATE 'ps_totloyalty' SET 'id_loyalty_state' = 2 WHERE 'id_order' = IN (10, 15, 18) ;

Where 10, 15, 18 are the IDs of orders with pending points.

Please use these requests only if you are familiar with this type of modification. If you are not, please contact our support team here: