OpenCart интеграция на Коректен Магазин в Pazaruvaj


New Member
Здравейте, имам нужда от малко професионална помощ относно интеграцията. Открих две теми в този форум
, но от Pazaruvaj са направили промени в кода.

Новият код е:

* 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('123456789...');

/** Provide the e-mail address of your customer. You can retrieve the e-amil address from the webshop engine. */
$Client->SetEmail('[email protected]');

/** Customer's cart example. */
$Cart = array(
'AAA111' => 'Name of first purchased product',
'BBB222' => 'Name of second purchased product'

/** Provide the name and the identifier of the purchased products.
* You can get those from the webshop engine.
* It must be called for each of the purchased products. */
foreach($Cart as $ProductIdentifier => $ProductName) {
/** If both product name and identifier are available, you can provide them this way: */
$Client->AddProduct($ProductName, $ProductIdentifier);
/** If only product name is available, you can provide it with the following call: */
/** If neither is available, you can leave out these calls. */

/** This method perpares to send us the e-mail address and the name of the purchased products set above.
* It returns an HTML code snippet which must be added to the webshop's source.
* After the generated code is downloaded into the customer's browser it begins to send purchase information. */
echo $Client->Prepare();

/** Here you can implement error handling. The error message can be obtained in the manner shown below. This step is optional. */
} catch (Exception $Ex) {
$ErrorMessage = $Ex->getMessage();
който мисля, че трябва да вградя в /catalog/controller/checkout/success.php

$Client = new TrustedShop('123456789...'); - е ясен.

Ще работи ли коректно ако заменя:
$Client->SetEmail('$this->customer->isLogged() ? $this->customer->getEmail() : $this->session->data['guest']['email']');

За този код нямам никаква идея:
/** Customer's cart example. */
$Cart = array(
'AAA111' => 'Name of first purchased product',
'BBB222' => 'Name of second purchased product'

Моля помагайте! :)


Well-Known Member
Мога да препоръчам @alexkuzmov :)

На мен ми направи цялата интеграция на същата версия успешно, преди няколко месеца.