开发者

Virtuemart - Tie in API function on checkout

What I am trying to do is once the user checks out, say he buy's $25 worth of points; I need to send a message to an API that the user made purchases worth $25 dollars.

I found the file, checkout.thankyou.tpl.php, where the confirmation message is given after all goes well. This is where I am going to tie in the API function.

My question is how do I get the amount that the user just purchased? From the page mentioned above, I need to access th开发者_C百科e total amount that the user just spent. Is it stored in a global variable? Is it still accessible? I will appreciate any ideas that you may have.


On this last step of the checkout ps_checkout->add() is called to add the shopping cart items into the database, but the same function sends the notification email and clears the cart from the session. What you could do is:

  • Use a system plugin onAfterInitialise that looks for the option/task that triggers the last checkout step
  • recalculate the cart total from the $_SESSION, you also need to initialise the virtuemart session, have a look at virtuemart.php
  • store your result temporarily in a different $_SESSION variable
  • same plugin, check for loading of the thank you page and check for your variable in the session. Then trigger your API.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜