place an order from within a script

  • Posts: 151
  • Thank you received: 9
11 years 3 months ago #122954

Hi,

We need to connect our shop to another webshop. Our products are displayed in this other shop.
When someone buys one (or more) of our products in this external shop, there must be an API call to our shop that:

- creates a customer account if non-existing
- confirm the account, send the password to the new account holder
- place the order with one or more products
- set the orderstatus to a special orderstatus that we have to create yet
- make sure the confirmation e-mail with download links is sent to the new customer

We only sell digital downloads.

Any ideas how to do this?
API Call? SOAP Integration? HTML post (via cURL)? Other solution?

Oh, of course there must at least some kind of authentication?

Please advice,
Maurice

Last edit: 11 years 3 months ago by Maurice.

Please Log in or Create an account to join the conversation.

  • Posts: 26165
  • Thank you received: 4029
  • MODERATOR
11 years 3 months ago #122988

Hi,

Both shops are HikaShop ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 151
  • Thank you received: 9
11 years 3 months ago #123173

No, only ours is Hikashop. The other is something completely different.
So when they get the payment confirmation, they have to start a script that connects to our site that does these things.

Please Log in or Create an account to join the conversation.

  • Posts: 151
  • Thank you received: 9
11 years 3 months ago #123249

If there's no easy (standard) solution to this, I was thinking of this:

Create a script on our server where hikashop is running.
Let the external shop do a form post (maybe with cURL or whatever) to our script.

Let our script do some sort of authentication, retrieve the posted values and put them in hikashop.

But what do we need to do in that script to actually place a confirmed order in hikashop?

Maurice

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
11 years 3 months ago #123498

Hi,

I think that you will have to indeed to a cURL request to the website (ideally a joomla system plugin) with the necessary information in the POST to:
- create the user in Joomla with the save function of the JUser object of Joomla (you have an example of that in the "register" function of the file adminsitrator/components/com_hikashop/classes/user.php which is used upon registration of users via hikaShop to register the user in Joomla). You will also find the code to send the email notification to the user. In fact, if you respect the POST data used by that function you could directly use it.
- create an order in HikaShop. If the order is created as confirmed the download links will be directly in the order creation notification email which is sent automatically by the system when the order is created as long as you do it via the save function of class.order).
You can find an example of creation of an order in the pay_confirm function of the file administrator/components/com_hikashop/classes/user.php where an order is created fro the payment of the affiliate commissions of a partner. A more complete but more complex one is in the after_confirm function of the file components/com_hikashop/controllers/checkout.php where the order is created at the end of the checkout.

Please Log in or Create an account to join the conversation.

Time to create page: 0.059 seconds
Powered by Kunena Forum