Jump to content

Call varibles for TrustedShop script code


Recommended Posts

Hello guys,

I already have a big headache with one TrustedShop code.I need to import that code in order-confirmation.php.I have no problems here, but that TrustedShop code wants some Varibles from prestashop database and i dont know how to call him.

 

There is the code whitch i shoud import in order-confirmation.php

 

<?php

/*******************************************************************************
* Pazaruvaj.com trusted shop program
* Example code integration to the webshop
*
*
* Please note, that the example detailed below can not be simply copy-pasted
* into your webshop’s code, it has to be customized adequately.
*
* Setup steps:
* 1. Copy TrustedShop.php file to a place accessible by the webshop engine.
* 2. Copy this example code to the page of the webshop where the e-mail address
*    of the customer and the names of the purchased products are retrievable
*    from the webshop engine. Generally this is the webshop’s confirmation
*    page of the purchase.
* 3. Customize the pasted example code according to the following:
*    - Modify path of TrustedShop.php in require_once() in such a way that
*	  the webshop engine can use it.
*    - Check that the proper WebAPI key is set, if not, modify it. You can find
*	  the WebAPI key on the partner portal.
*    - Set the customer’s e-mail address.
*    - Add the names of the purchased products.
*    - Implement an error handling if you want (optional).
*
******************************************************************************/

require_once 'TrustedShop.php';

try {

 // Provide your own WebAPI key.
 // You can find your WebAPI key on your partner portal.

 $Client = new TrustedShop('0c361d47addf816d08b476e144XXXXX');

 // Provide the e-mail address of your customer.
 // You can retrieve the e-amil address from the webshop engine.

 $Client->SetEmail('[email protected]');

 // Provide the name of the purchased products.
 // You can get the name of the products from the webshop engine.
 // The AddProduct method must be called for each of the purchased products.
 //
 // It is optional to provide the name of the products, so if this data is not
 // available, you can leave out the AddProduct calls.

 $Client->AddProduct('Name of first purchased product');
 $Client->AddProduct('Name of second purchased product');

 // This method sends us the e-mail address and the name of the purchased
 // products set above. After the data arrived to us, we store them
 // with the time stamp and the WebAPI key.
 // This lets us know that someone has purchased at your webshop, to whom
 // we later have to send the questionnaire for evaluating your shop.

 $Client->Send();

} catch (Exception $Ex) {

 // Here you can implement error handling. The error message can be obtained
 // in the manner shown below. Implementing error handling is optional.

 $ErrorMessage = $Ex->getMessage();
}

?>

 

This code call one file called "TrustedShop.php"

 

Big problem is there that i dont know what i shoud fill in this line:

$Client->SetEmail('[email protected]');

And this

$Client->AddProduct('Name of first purchased product');

$Client->AddProduct('Name of second purchased product');

 

I heart something about that i shoud use some of this varibles: ($_GET): id_cart,

id_order, key. And i must use these to reach the required datas by the classes and

functions of the webshop engine or write own SQL queries. But i dont have enought knowlege to do that.

 

Please, if someone can help me to fill this lines with right varibles, let's do it.

 

Really sorry for my bad english, but i think you understand me.

 

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...