Jump to content

Order Hooks not working after 5.3.3 Upgrade


Fr3DBr

Recommended Posts

Hello,

 

Yes, the steps are very easy.

 

1) Make a new product.

2) Make a new addon for it.

3) Order this product.

4) Login to client area and click in Order.

5) Select product addons

6) Now choose the addon and add it to the cart, and observe the hooks, make sure to have all them prepared to be logged (The order hooks)

you will notice only : PreCalculateCartTotals will be called, before you press 'Checkout'.

 

However it had to call the pre-hooks like : ShoppingCartValidateProductUpdate and it is never called (for the product addon only, it seems).

Link to comment
Share on other sites

Fr3DBr,

 

Using the same hooks file Andrew provided you in your ticket - which registers hooks for 10 of the 11 order hooks listed in the hooks documentation - and logs to the activity log that each hook has been called. I have followed your reproduction steps. This is the log of me making an order for a product:

 

19/02/2014 12:32

Running hook ShoppingCartCheckoutCompletePage

19/02/2014 12:32

Running hook AfterShoppingCartCheckout

19/02/2014 12:32

Email Sent to B User (Order Confirmation) - User ID: 2

19/02/2014 12:32

New Order Placed - Order ID: 5 - User ID: 2

19/02/2014 12:32

Running hook PreShoppingCartCheckout

19/02/2014 12:32

Running hook PreCalculateCartTotals

19/02/2014 12:32

Running hook ShoppingCartValidateCheckout

19/02/2014 12:32

Running hook PreCalculateCartTotals

19/02/2014 12:32

Running hook ShoppingCartValidateProductUpdate

19/02/2014 12:32

Running hook PreCalculateCartTotals

 

Here is the log of me ordering only an product addon:

 

19/02/2014 12:33

Running hook AfterShoppingCartCheckout

19/02/2014 12:33

Email Sent to B User (Order Confirmation) - User ID: 2

Email Sent to B User (Customer Invoice) - User ID: 2

19/02/2014 12:33

Created Invoice - Invoice ID: 4

19/02/2014 12:33

New Order Placed - Order ID: 6 - User ID: 2

19/02/2014 12:33

Running hook PreShoppingCartCheckout

19/02/2014 12:33

Running hook PreCalculateCartTotals

19/02/2014 12:33

Running hook ShoppingCartValidateCheckout

19/02/2014 12:33

Running hook PreCalculateCartTotals

 

There are two hooks which are not called in ordering the addon that are called when ordering a product: ShoppingCartCheckoutCompletePage and ShoppingCartValidateProductUpdate.

 

I checked on a fresh 5.2.16 installation and the same number of hooks were called in both cases.

 

I have opened a case to discuss with our development team what the intended behavior of: ShoppingCartValidateProductUpdate is. I can see an assumption that it would only be called to validate a shopping cart that contains an product, and since only ordering a Product Addon is not ordering a product it would not be called. I have opened case 4119 to track that discussion.

 

If that is the case, our documentation could be clearer and we will work on updating that.

 

P.S. If you order a product and the product addon, it successfully calls ShoppingCartValidateProductUpdate.

Link to comment
Share on other sites

Hello,

 

Ok the problem is, how can we perform validation in addons then ? There is simple no way right now... we can't even return an error to the user in case of a restriction... which makes it unflexible, because we must check which addons may be added at which amount to certain products and now we just can't :/

 

About :

 

P.S. If you order a product and the product addon, it successfully calls ShoppingCartValidateProductUpdate.

 

This is not useful, because it is only being called, because a 'regular product' is being added to the cart, what makes it not exactly the purpose I said above.

 

So either it has to be called for addons, or we need a : ShoppingCartValidateAddonUpdate ?

Edited by Fr3DBr
Link to comment
Share on other sites

Fr3DBr,

 

Yes there are a few ways to make things work as needed, the options you listed are two of them. Alternatively you could listen to the hook for ShoppingCartValidateCheckout which is called in both cases at the checkout phase and trigger your error then. Its less then ideal, but it should meet your immediate needs.

 

This issue will be discussed during our normal triage meeting, a plan will be decided, and it will get fixed at some point.

 

Now that you have confirmed that this is not a regression of behavior in 5.3, nor all order hooks not working, and since we have a case that we will follow up internally, I am going to close this forum thread.

 

Since this is not a regression, nor intended functionality that is not working as expected, I will be labeling this thread as 'Not a Bug' to hopefully communicate to someone else who comes across the start of the thread and gets the impression that all order hooks are not working after the 5.3.3 update is not actually what was going on.

 

Have a great day.

 

Nate C

Edited by WHMCS Nate
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated